From cb68aab469680082fb5794dd55df8fb22b5ae95b Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Sun, 13 Jun 1999 21:49:35 +0000
Subject: [PATCH] s/ldap_open/ldap_init/ calls... ldap_open is deprecated.

---
 clients/fax500/main.c           | 4 ++--
 clients/fax500/rp500.c          | 4 ++--
 clients/finger/main.c           | 4 ++--
 clients/gopher/go500.c          | 2 +-
 clients/gopher/go500gw.c        | 4 ++--
 clients/mail500/main.c          | 4 ++--
 clients/rcpt500/query.c         | 2 +-
 clients/ud/main.c               | 4 ++--
 contrib/saucer/main.c           | 4 ++--
 contrib/web_ldap/web_ldap.c     | 8 ++++----
 contrib/whois++/whois++.c       | 4 ++--
 libraries/libldap/test.c        | 7 ++++---
 servers/slapd/tools/centipede.c | 8 ++++----
 servers/slapd/tools/sizecount.c | 4 ++--
 servers/slurpd/ldap_op.c        | 6 +++---
 15 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/clients/fax500/main.c b/clients/fax500/main.c
index a4a6e30857..654a3df0a6 100644
--- a/clients/fax500/main.c
+++ b/clients/fax500/main.c
@@ -323,8 +323,8 @@ connect_to_x500( void )
 	int sizelimit = FAX_MAXAMBIGUOUS;
 	int deref = LDAP_DEREF_ALWAYS;
 
-	if ( (ld = ldap_open( NULL, 0 )) == NULL ) {
-		syslog( LOG_ALERT, "ldap_open failed" );
+	if ( (ld = ldap_init( NULL, 0 )) == NULL ) {
+		syslog( LOG_ALERT, "ldap_init failed" );
 		return( -1 );
 	}
 
diff --git a/clients/fax500/rp500.c b/clients/fax500/rp500.c
index f4f9c58425..2df90c6ba3 100644
--- a/clients/fax500/rp500.c
+++ b/clients/fax500/rp500.c
@@ -115,8 +115,8 @@ main( int argc, char **argv )
 	(void) SIGNAL( SIGPIPE, SIG_IGN );
 #endif
 
-	if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
-		perror( "ldap_open" );
+	if ( (ld = ldap_init( ldaphost, 0 )) == NULL ) {
+		perror( "ldap_init" );
 		exit( -1 );
 	}
 
diff --git a/clients/finger/main.c b/clients/finger/main.c
index 1dc1664d80..9b1cf975f9 100644
--- a/clients/finger/main.c
+++ b/clients/finger/main.c
@@ -158,9 +158,9 @@ do_query( void )
 	fd_set		readfds;
 	LDAP		*ld;
 
-	if ( (ld = ldap_open( ldaphost, ldapport )) == NULL ) {
+	if ( (ld = ldap_init( ldaphost, ldapport )) == NULL ) {
 		fprintf( stderr, FINGER_UNAVAILABLE );
-		perror( "ldap_open" );
+		perror( "ldap_init" );
 		exit( 1 );
 	}
 
diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c
index 7b5141bbed..d9a0d64447 100644
--- a/clients/gopher/go500.c
+++ b/clients/gopher/go500.c
@@ -392,7 +392,7 @@ do_queries( int s )
 
 	if ( *query == '~' || *query == '@' ) {
 		ld = NULL;
-	} else if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
+	} else if ( (ld = ldap_init( ldaphost, 0 )) == NULL ) {
 		fprintf(fp,
 			"0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
 			LDAP_SERVER_DOWN, myhost, myport );
diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c
index 9381acda5b..843e7d25a2 100644
--- a/clients/gopher/go500gw.c
+++ b/clients/gopher/go500gw.c
@@ -441,8 +441,8 @@ do_queries( int s )
 		/* NOT REACHED */
 	}
 
-	if ( (ld = ldap_open( ldaphost, ldapport )) == NULL ) {
-		if ( debug ) perror( "ldap_open" );
+	if ( (ld = ldap_init( ldaphost, ldapport )) == NULL ) {
+		if ( debug ) perror( "ldap_init" );
 		fprintf(fp, "0An error occurred (explanation)\tE%d\t%s\t%d\r\n",
 		    LDAP_SERVER_DOWN, myhost, myport );
 		fprintf( fp, ".\r\n" );
diff --git a/clients/mail500/main.c b/clients/mail500/main.c
index dec8e66d3e..7719d959e8 100644
--- a/clients/mail500/main.c
+++ b/clients/mail500/main.c
@@ -360,8 +360,8 @@ connect_to_x500( void )
 {
 	int opt;
 
-	if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
-		syslog( LOG_ALERT, "ldap_open failed" );
+	if ( (ld = ldap_init( ldaphost, 0 )) == NULL ) {
+		syslog( LOG_ALERT, "ldap_init failed" );
 		return( -1 );
 	}
 
diff --git a/clients/rcpt500/query.c b/clients/rcpt500/query.c
index c035881849..c83a02bdab 100644
--- a/clients/rcpt500/query.c
+++ b/clients/rcpt500/query.c
@@ -77,7 +77,7 @@ query_cmd( struct msginfo *msgp, char *reply )
 	ldp = cldap_open( ldaphost, ldapport );
     else
 #endif /* LDAP_CONNECTIONLESS */
-	ldp = ldap_open( ldaphost, ldapport );
+	ldp = ldap_init( ldaphost, ldapport );
 
     if ( ldp == NULL ) {
 	strcat( reply, errpreface );
diff --git a/clients/ud/main.c b/clients/ud/main.c
index bb0bb8ca7e..a4d742bbee 100644
--- a/clients/ud/main.c
+++ b/clients/ud/main.c
@@ -648,8 +648,8 @@ initialize_client( void )
 	 *  are meaningless since we will immediately be doing a null bind
 	 *  because we want to be sure to use TCP, not UDP.
 	 */
-	if ((ld = ldap_open(server, ldap_port)) == NULL) {
-		fprintf(stderr, "  The LDAP Directory is temporarily unavailable.  Please try again later.\n");
+	if ((ld = ldap_init(server, ldap_port)) == NULL) {
+		fprintf(stderr, "  Initialization of LDAP session failed.\n");
 		exit(0);
 		/* NOTREACHED */
 	}
diff --git a/contrib/saucer/main.c b/contrib/saucer/main.c
index 605c1ad4ed..d99d3e558d 100644
--- a/contrib/saucer/main.c
+++ b/contrib/saucer/main.c
@@ -639,8 +639,8 @@ int main(int argc, char **argv)
 
 	rc = user_tailor();
 
-	if (!(ld = ldap_open(hostname, portnum))) {
-		fprintf(stderr, "%s: unable to connect to server at host `%s' on port %d\n",
+	if (!(ld = ldap_init(hostname, portnum))) {
+		fprintf(stderr, "%s: unable to initialize LDAP session (%s:%d)\n",
 				progname, hostname, portnum);
 		exit(2);
 	}
diff --git a/contrib/web_ldap/web_ldap.c b/contrib/web_ldap/web_ldap.c
index 37376d1ec9..0be574aec2 100644
--- a/contrib/web_ldap/web_ldap.c
+++ b/contrib/web_ldap/web_ldap.c
@@ -321,20 +321,20 @@ main(int argc, char ** argv) {
 	 time(&now);
 	 sprintf(temp,"\n==< Results >==\n\n");
 	 fputs(temp,logfp);
-	 sprintf(temp,"** performing ldap_open at %s\n", ctime(&now));
+	 sprintf(temp,"** performing ldap_init at %s\n", ctime(&now));
 	 fputs(temp,logfp);
 	 fflush(logfp);
 	 fclose(logfp);
       }
    }
-   if ( (ld = ldap_open(ldap_data.servername, ldap_data.ldap_port_num) ) == NULL)
+   if ( (ld = ldap_init(ldap_data.servername, ldap_data.ldap_port_num) ) == NULL)
      {
-	printf("<font color=red><b>ldap_open error</b></font>\n");
+	printf("<font color=red><b>ldap_init error</b></font>\n");
 	if (ldap_data.debug != 0) {
 	   if ((logfp = fopen("web_ldap.log","a")) == 0) {
 	   }
 	   else {
-	      sprintf(temp,"++ ldap_open error\n");
+	      sprintf(temp,"++ ldap_init error\n");
 	      fputs(temp,logfp);
 	      fflush(logfp);
 	      fclose(logfp);
diff --git a/contrib/whois++/whois++.c b/contrib/whois++/whois++.c
index 023b25b9e9..469e3ac664 100644
--- a/contrib/whois++/whois++.c
+++ b/contrib/whois++/whois++.c
@@ -178,10 +178,10 @@ char	**argv;
 		}
 	}
 
-	if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
+	if ( (ld = ldap_init( ldaphost, LDAP_PORT )) == NULL ) {
 		printFormatted( lineLength, TRUE, stdout,
 			"Connection to LDAP port on %s has failed", ldaphost );
-		syslog( LOG_ERR, "Connection to LDAP port on %s has failed",
+		syslog( LOG_ERR, "Initialization of LDAP session (%s)",
 			ldaphost );
 		exit( 1 );
 	}
diff --git a/libraries/libldap/test.c b/libraries/libldap/test.c
index 4d7234f3c9..b6aab5924d 100644
--- a/libraries/libldap/test.c
+++ b/libraries/libldap/test.c
@@ -346,7 +346,8 @@ main( int argc, char **argv )
 		exit( 1 );
 	}
 	
-	printf( "%sldap_open( %s, %d )\n", cldapflg ? "c" : "",
+	printf( "%s( %s, %d )\n",
+		cldapflg ? "cldap_open" : "ldap_init",
 		host == NULL ? "(null)" : host, port );
 
 	if ( cldapflg ) {
@@ -354,11 +355,11 @@ main( int argc, char **argv )
 		ld = cldap_open( host, port );
 #endif /* LDAP_CONNECTIONLESS */
 	} else {
-		ld = ldap_open( host, port );
+		ld = ldap_init( host, port );
 	}
 
 	if ( ld == NULL ) {
-		perror( "ldap_open" );
+		perror( cldapflg ? "cldap_open" : "ldap_init" );
 		exit(1);
 	}
 
diff --git a/servers/slapd/tools/centipede.c b/servers/slapd/tools/centipede.c
index c558b1c487..f3b36d72f3 100644
--- a/servers/slapd/tools/centipede.c
+++ b/servers/slapd/tools/centipede.c
@@ -383,8 +383,8 @@ start_ldap_search(
 		fflush( stdout );
 	}
 
-	if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
-		perror( "ldap_open" );
+	if ( (ld = ldap_init( ldaphost, 0 )) == NULL ) {
+		perror( "ldap_init" );
 		return( NULL );
 	}
 
@@ -976,8 +976,8 @@ bind_to_destination_ldap(
 	free( ldapbase );
 	ldapbase = strdup( buf );
 
-	if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
-		perror( "ldap_open" );
+	if ( (ld = ldap_init( ldaphost, 0 )) == NULL ) {
+		perror( "ldap_init" );
 		return( NULL );
 	}
 
diff --git a/servers/slapd/tools/sizecount.c b/servers/slapd/tools/sizecount.c
index 4d881faf64..e04ced459f 100644
--- a/servers/slapd/tools/sizecount.c
+++ b/servers/slapd/tools/sizecount.c
@@ -48,8 +48,8 @@ main( int argc, char **argv )
 	ldap_debug = 255;
 	lber_debug = 255;
 */
-	if ( (ld = ldap_open( "vertigo:5555", 0 )) == NULL ) {
-		perror( "ldap_open" );
+	if ( (ld = ldap_init( "vertigo:5555", 0 )) == NULL ) {
+		perror( "ldap_init" );
 		exit( 1 );
 	}
 
diff --git a/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c
index 9ae70dc78d..404f321ef4 100644
--- a/servers/slurpd/ldap_op.c
+++ b/servers/slurpd/ldap_op.c
@@ -611,11 +611,11 @@ do_bind(
 	ri->ri_ldp = NULL;
     }
 
-    Debug( LDAP_DEBUG_ARGS, "Open connection to %s:%d\n",
+    Debug( LDAP_DEBUG_ARGS, "Initializing session to %s:%d\n",
 	    ri->ri_hostname, ri->ri_port, 0 );
-    ri->ri_ldp = ldap_open( ri->ri_hostname, ri->ri_port );
+    ri->ri_ldp = ldap_init( ri->ri_hostname, ri->ri_port );
     if ( ri->ri_ldp == NULL ) {
-	Debug( LDAP_DEBUG_ANY, "Error: ldap_open(%s, %d) failed: %s\n",
+	Debug( LDAP_DEBUG_ANY, "Error: ldap_init(%s, %d) failed: %s\n",
 		ri->ri_hostname, ri->ri_port, sys_errlist[ errno ] );
 	return( BIND_ERR_OPEN );
     }
-- 
GitLab