Table of Contents | Previous | Next | Index

Netscape Directory SDK 3.0 for C Programmer’s Guide
     Chapter 18 Functions

ldap_free_urldesc()

The 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.

Syntax

#include <ldap.h>
void ldap_free_urldesc( LDAPURLDesc *ludp );

Parameters

This function has the following parameters:

ludp

Pointer to a LDAPURLDesc structure.

Example

The following section of code parses an LDAP URL and then frees the 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 );
...

See Also

ldap_url_parse().


Table of Contents | Previous | Next | Index

Last Updated: 10/01/98 17:06:23