[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Developing client in c



printf ("%s: %s\nlength: %d\n\n", a, vals[i], sizeof (vals[i]));

vals is a struct berval**.

This means vals[i] is a struct berval*.

This means the sizeof operator, which returns the size of the type, will always return the size of the pointer, because it's only a pointer. This means 4 on most 32bit systems and 8 on most 64bit systems.

And bervals are not strings. If you want to know the length, you'll have to look inside the berval. In lber.h, we have

typedef struct berval {
        ber_len_t       bv_len;
        char            *bv_val;
} BerValue;

char *
encode_64 (char *message)
{
#include <openssl/bio.h>
#include <openssl/evp.h>

Why are you including headers inside a function?

Matthew Backes
Symas Corporation
mbackes@symas.com