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

LDAP-ADD client program!!!



HI All,
	I have a openldap 2.0.11 server on my linux box,and I am trying to contact
this ldap server thru Win32 client.
I have written a small code for adding a entry thru this prog I am getting
an error saying : "ldap_add_ext: No such Object".
Can any one help me in this.
I am typing my slapd.conf file and the program I am using....
I have already some entries added thru "slapadd" and "ldapadd (the shell
command)".

/********************SLAPD.CONF*****************************************/
	database        ldbm
	suffix          "o=magnaquest, c=IN"
	#suffix         "o=My Organization Name,c=IN"
	rootdn          "cn=Manager, o=magnaquest, c=IN"
	# Cleartext passwords, especially for the rootdn, should
	# be avoid.  See slappasswd(8) and slapd.conf(5) for details.
	# Use of strong authentication encouraged.
	rootpw	          secret
/*************************************************************************/
And my program is........
	After ldap_init()
		ldap_bind_s()
............

 void free_mods( LDAPMod **mods );//not defined by us
  LDAPMod      **mods;
  parse_rc = 0;  msgid = 0;finished = 0;i=0; rc = 0;

	char *object_vals[] = {"top" , "person" , NULL };
	char *cn_vals[] = { "arshad", NULL };
      char *sn_vals[] = { "reddy", NULL };

	zerotime.tv_sec = zerotime.tv_usec = 0L;

/* Construct the array of LDAPMod structures representing the attributes
 of the new entry. */

	mods = ( LDAPMod ** ) malloc(( NUM_MODS + 1 ) * sizeof( LDAPMod * ));
	if ( mods == NULL ) {
		fprintf( stderr, "Cannot allocate memory for mods array\n" );
		exit( 1 );
	}
	for ( i = 0; i < NUM_MODS; i++ ) {
		if (( mods[ i ] = ( LDAPMod * ) malloc( sizeof( LDAPMod ))) == 				NULL )
{
		  fprintf( stderr, "Cannot allocate memory for mods element\n" );
		  exit( 1 );
		}
	}

	mods[ 0 ]->mod_op = 0;
	mods[ 0 ]->mod_type = "objectClass";
	mods[ 0 ]->mod_values = object_vals;
	mods[ 1 ]->mod_op = 0;
	mods[ 1 ]->mod_type = "cn";
	mods[ 1 ]->mod_values = cn_vals;
	mods[ 2 ]->mod_op = 0;
	mods[ 2 ]->mod_type = "sn";
	mods[ 2 ]->mod_values = sn_vals;
	mods[ 3 ] = NULL;

	/* Send the LDAP add request. */

	rc = ldap_add_ext( ld, "cn=arshad, o=maganquest, c=IN", mods, NULL, NULL,
&msgid );

Can any one help me in this...........

thanks in advace..

regards
majeed.