ldap_free_urldesc() function frees memory allocated by the ldap_url_parse() function. For more information, see "Freeing the Components of an LDAP URL" on page 252.
#include <ldap.h>
void ldap_free_urldesc( LDAPURLDesc *ludp );
ludp |
LDAPURLDesc structure from memory after verifying that the LDAP URL is valid.
#include <stdio.h>
#include <ldap.h>
...
char *my_url = "ldap://ldap.netscape.com:5000/o=Airius.com?cn,mail,telephoneNumber?sub?(sn=Jensen)";
LDAPURLDesc *ludpp;
int res, i;
...
if ( ( res = ldap_url_parse( my_url, &ludpp ) ) != 0 ) { switch( res ){case LDAP_URL_ERR_NOTLDAP:
printf( "URL does not begin with \"ldap://\"\n" );
break;
case LDAP_URL_ERR_NODN:
printf( "URL does not contain a distinguished name\n" );
break;
case LDAP_URL_ERR_BADSCOPE:
printf( "URL contains an invalid scope\n" );
break;
case LDAP_URL_ERR_MEM:
printf( "Not enough memory\n" );
break;
default:
printf( "Unknown error\n" );
}
return( 1 );
}
printf( "URL is a valid LDAP URL\n" );
ldap_free_urldesc( ludpp );
...
ldap_url_parse().
Last Updated: 10/01/98 17:06:23