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

Re: error with openldap upgrade



Jeremiah Martell writes:
> I do a memset on the struct making everything 0, and then I do the 5
> assignments I posted in my last email. So everything else is 0 when I
> call ldap_url_desc2str.

Maybe you are doing
    memset( &url, sizeof( url ), 0 );
instead of
    memset( &url, 0, sizeof( url ));
?

If not, the only things I can think of are a typo or some machine
where null pointers are not all bits zero - if OpenLDAP even
supports that.

What does this program do?  And if it misbehaves, please inspect
the structure with gdb like Pierangeo asked (and the function's
local variables), even though you know it should be right.

#include <ldap.h>
#include <string.h>
#include <stdio.h>

int main( void )
{
    LDAPURLDesc url;
    memset( &url, 0, sizeof( url ));
    url.lud_host   = "directory.example.com";
    url.lud_port   = 389;
    url.lud_scope  = LDAP_SCOPE_SUBTREE;
    url.lud_scheme = "ldap";
    url.lud_dn     = "";
    if( url.lud_attrs || url.lud_filter || url.lud_exts )
	puts( "Argh!  Null pointers are not all bits zero!" );
    printf( "URL <%s>\n", ldap_url_desc2str( &url ));
    return 0;
}

-- 
Hallvard