]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Add PORT of ldap.conf support from -devel.
authorKurt Zeilenga <kurt@openldap.org>
Mon, 30 Nov 1998 20:57:00 +0000 (20:57 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 30 Nov 1998 20:57:00 +0000 (20:57 +0000)
33 files changed:
clients/fax500/main.c
clients/fax500/rp500.c
clients/finger/main.c
clients/gopher/go500.c
clients/gopher/go500gw.c
clients/mail500/main.c
clients/rcpt500/main.c
clients/tools/ldapdelete.c
clients/tools/ldapmodify.c
clients/tools/ldapmodrdn.c
clients/tools/ldapsearch.c
clients/ud/auth.c
clients/ud/main.c
clients/ud/util.c
doc/man/man1/ldapdelete.1
doc/man/man1/ldapmodify.1
doc/man/man1/ldapmodrdn.1
doc/man/man1/ldapsearch.1
doc/man/man1/ud.1
doc/man/man5/ldap.conf.5 [new file with mode: 0644]
doc/man/man5/ud.conf.5
include/ldapconfig.h.edit
libraries/libldap/Makefile.in
libraries/libldap/cldap.c
libraries/libldap/init.c [new file with mode: 0644]
libraries/libldap/ldap-int.h
libraries/libldap/open.c
libraries/libldap/request.c
libraries/libldap/url.c
servers/slapd/tools/centipede.c
servers/slapd/tools/sizecount.c
servers/slurpd/config.c
servers/slurpd/re.c

index 2e1131df4db1b8ed2b0ff431e967ed0fd7c5127c..240f7372938a99d943874d988ea590462cbb4f5b 100644 (file)
@@ -315,14 +315,14 @@ main ( int argc, char **argv )
 static int
 connect_to_x500( void )
 {
-       if ( (ld = ldap_open( LDAPHOST, LDAP_PORT )) == NULL ) {
+       if ( (ld = ldap_open( NULL, 0 )) == NULL ) {
                syslog( LOG_ALERT, "ldap_open failed" );
                return( -1 );
        }
        ld->ld_sizelimit = FAX_MAXAMBIGUOUS;
        ld->ld_deref = LDAP_DEREF_ALWAYS;
 
-       if ( ldap_simple_bind_s( ld, FAX_BINDDN, FAX_BIND_CRED ) != LDAP_SUCCESS ) {
+       if ( ldap_simple_bind_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
                syslog( LOG_ALERT, "ldap_simple_bind_s failed" );
                return( -1 );
        }
index 9b9c695d16a4d00ed238c268f2221012bcf99425..bd6744ad98e18d713f27521de884206a98da3853 100644 (file)
@@ -39,8 +39,8 @@
 #define DEFAULT_SIZELIMIT      50
 
 int            debug;
-char   *ldaphost = LDAPHOST;
-char   *base = RP_BASE;
+char   *ldaphost = NULL;
+char   *base = NULL;
 int            deref;
 int            sizelimit;
 LDAPFiltDesc   *filtd;
@@ -111,14 +111,14 @@ main( int argc, char **argv )
                exit( -1 );
        }
 
-       if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
+       if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
                perror( "ldap_open" );
                exit( -1 );
        }
        ld->ld_sizelimit = sizelimit ? sizelimit : DEFAULT_SIZELIMIT;
        ld->ld_deref = deref;
 
-       if ( ldap_simple_bind_s( ld, RP_BINDDN, RP_BIND_CRED ) != LDAP_SUCCESS ) {
+       if ( ldap_simple_bind_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
                fprintf( stderr, "X.500 is temporarily unavailable.\n" );
                ldap_perror( ld, "ldap_simple_bind_s" );
                exit( -1 );
index ec281f7f1eee92d31193e7b483c7120078fc679f..b359bee984db6c2ce5bf38ba58cbc51d57fa3023 100644 (file)
@@ -36,9 +36,9 @@
 
 
 int    dosyslog = 1;
-char   *ldaphost = LDAPHOST;
-int    ldapport = LDAP_PORT;
-char   *base = FINGER_BASE;
+char   *ldaphost = NULL;
+int    ldapport = 0;
+char   *base = NULL;
 int    deref;
 char   *filterfile = FILTERFILE;
 char   *templatefile = TEMPLATEFILE;
@@ -160,7 +160,7 @@ do_query( void )
        ld->ld_sizelimit = FINGER_SIZELIMIT;
        ld->ld_deref = deref;
 
-       if ( ldap_simple_bind_s( ld, FINGER_BINDDN, FINGER_BIND_CRED )
+       if ( ldap_simple_bind_s( ld, NULL, NULL )
                != LDAP_SUCCESS )
        {
                fprintf( stderr, FINGER_UNAVAILABLE );
index 26dc535a5af10431ee3c3f92845dfd62a9af7b26..05d56b2136aa612709b339ae8c12311f37d46384 100644 (file)
@@ -46,8 +46,8 @@ int   dosyslog;
 int    inetd;
 int    dtblsize;
 
-char   *ldaphost = LDAPHOST;
-char   *base = GO500_BASE;
+char   *ldaphost = NULL;
+char   *base = NULL;
 int    rdncount = GO500_RDNCOUNT;
 char   *filterfile = FILTERFILE;
 char   *templatefile = TEMPLATEFILE;
@@ -378,7 +378,7 @@ do_queries( int s )
        if ( *query == '~' || *query == '@' ) {
                ld = NULL;
        } else {
-               if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
+               if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
                        fprintf(fp,
                            "0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
                            LDAP_SERVER_DOWN, myhost, myport );
@@ -388,7 +388,7 @@ do_queries( int s )
                }
 
                ld->ld_deref = GO500_DEREF;
-               if ( (rc = ldap_simple_bind_s( ld, GO500_BINDDN, GO500_BIND_CRED ))
+               if ( (rc = ldap_simple_bind_s( ld, NULL, NULL ))
                    != LDAP_SUCCESS ) {
                        fprintf(fp,
                            "0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
index e73b28ce366e66305554b41f389393e06cff6990..2c6142507b2c15bd7768f53e5657a7da15615ce8 100644 (file)
@@ -48,8 +48,8 @@ int   dosyslog;
 int    inetd;
 int    dtblsize;
 
-char           *ldaphost = LDAPHOST;
-int            ldapport = LDAP_PORT;
+char           *ldaphost = NULL;
+int            ldapport = 0;
 int            searchaliases = 1;
 char           *helpfile = GO500GW_HELPFILE;
 char           *filterfile = FILTERFILE;
@@ -442,7 +442,7 @@ do_queries( int s )
        if ( !searchaliases )
                ld->ld_deref = LDAP_DEREF_FINDING;
 
-       if ( (rc = ldap_simple_bind_s( ld, GO500GW_BINDDN, NULL ))
+       if ( (rc = ldap_simple_bind_s( ld, NULL, NULL ))
            != LDAP_SUCCESS ) {
                if ( debug ) ldap_perror( ld, "ldap_simple_bind_s" );
                fprintf(fp, "0An error occurred (explanation)\tE%d\t%s\t%d\r\n",
index a53f0a3a6096b8277ea1f5956a4f8cdc47f570b5..d826499e0feb610ef4af1593701e3e157346cbe3 100644 (file)
@@ -61,7 +61,7 @@ char  *vacationhost = NULL;
 char   *errorsfrom = NULL;
 char   *mailfrom = NULL;
 char   *host = NULL;
-char   *ldaphost = LDAPHOST;
+char   *ldaphost = NULL;
 int    hostlen = 0;
 int    debug;
 
@@ -352,14 +352,14 @@ main ( int argc, char **argv )
 static int
 connect_to_x500( void )
 {
-       if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
+       if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
                syslog( LOG_ALERT, "ldap_open failed" );
                return( -1 );
        }
        ld->ld_sizelimit = MAIL500_MAXAMBIGUOUS;
        ld->ld_deref = LDAP_DEREF_ALWAYS;
 
-       if ( ldap_simple_bind_s( ld, MAIL500_BINDDN, NULL ) != LDAP_SUCCESS ) {
+       if ( ldap_simple_bind_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
                syslog( LOG_ALERT, "ldap_simple_bind_s failed" );
                return( -1 );
        }
index 4cc86f85f06026818fba713d5e991fcade8153f1..346c5fc10d3e4e22a8ddd5885d92c93cf9564de3 100644 (file)
@@ -28,9 +28,9 @@ int derefaliases = 1;
 int sizelimit = RCPT500_SIZELIMIT;
 int rdncount = RCPT500_RDNCOUNT;
 int ldapport = 0;
-char *ldaphost = LDAPHOST;
-char *searchbase = RCPT500_BASE;
-char *dapuser = RCPT500_BINDDN;
+char *ldaphost = NULL;
+char *searchbase = NULL;
+char *dapuser = NULL;
 char *filterfile = FILTERFILE;
 char *templatefile = TEMPLATEFILE;
 static char reply[ MAXSIZE * RCPT500_LISTLIMIT ];
index 4eb6f7a407d96b9c534b466ea339b38e791c37da..ea8c29fa00423aa98b6c8542c4ad6f2a3131d85b 100644 (file)
 
 #include "ldapconfig.h"
 
-static char    *binddn = LDAPDELETE_BINDDN;
-static char    *passwd = LDAPDELETE_BIND_CRED;
-static char    *base = LDAPDELETE_BASE;
-static char    *ldaphost = LDAPHOST;
-static int     ldapport = LDAP_PORT;
+static char    *binddn = NULL;
+static char    *passwd = NULL;
+static char    *base = NULL;
+static char    *ldaphost = NULL;
+static int     ldapport = 0;
 static int     not, verbose, contoper;
 static LDAP    *ld;
 
index b38ec5d167cc2f9d4e241abd062800b82cdc9047..1817696c3d1e95e1989d0b7eb5a50d2c258dc396 100644 (file)
 #include "ldapconfig.h"
 
 static char    *prog;
-static char    *binddn = LDAPMODIFY_BINDDN;
-static char    *passwd = LDAPMODIFY_BIND_CRED;
-static char    *ldaphost = LDAPHOST;
-static int     ldapport = LDAP_PORT;
+static char    *binddn = NULL;
+static char    *passwd = NULL;
+static char    *ldaphost = NULL;
+static int     ldapport = 0;
 static int     new, replace, not, verbose, contoper, force, valsfromfiles;
 static LDAP    *ld;
 
@@ -264,7 +264,7 @@ process_ldif_rec( char *rbuf )
            if ( !use_record && strcasecmp( type, T_REPLICA_STR ) == 0 ) {
                ++saw_replica;
                if (( p = strchr( value, ':' )) == NULL ) {
-                   replicaport = LDAP_PORT;
+                   replicaport = 0;
                } else {
                    *p++ = '\0';
                    replicaport = atoi( p );
index 84f2a172af4643f0ba612fa3415e6bb824483d4d..229468473d2f307296d88063085d9b3a878c5586 100644 (file)
 
 #include "ldapconfig.h"
 
-static char    *binddn = LDAPMODRDN_BINDDN;
-static char    *passwd = LDAPMODRDN_BIND_CRED;
-static char    *base = LDAPMODRDN_BASE;
-static char    *ldaphost = LDAPHOST;
-static int     ldapport = LDAP_PORT;
+static char    *binddn = NULL;
+static char    *passwd = NULL;
+static char    *base = NULL;
+static char    *ldaphost = NULL;
+static int     ldapport = 0;
 static int     not, verbose, contoper;
 static LDAP    *ld;
 
index de3904936af37b3eaf0c72a19778ed2a1a7da2e4..f476af77f7082b6201ca1d07dcd84b8ff8c014b8 100644 (file)
@@ -74,11 +74,11 @@ static int dosearch LDAP_P((
     char       *filtpatt,
     char       *value));
 
-static char    *binddn = LDAPSEARCH_BINDDN;
-static char    *passwd = LDAPSEARCH_BIND_CRED;
-static char    *base = LDAPSEARCH_BASE;
-static char    *ldaphost = LDAPHOST;
-static int     ldapport = LDAP_PORT;
+static char    *binddn = NULL;
+static char    *passwd = NULL;
+static char    *base = NULL;
+static char    *ldaphost = NULL;
+static int     ldapport = 0;
 static char    *sep = DEFSEP;
 static char    *sortattr = NULL;
 static int     skipsortattr = 0;
index 8b0ee4c6fc783769fee81694065035e2c9fbeb7f..0461261f2bd98b030445c11c7e2eb36b8838e6b4 100644 (file)
@@ -264,7 +264,7 @@ auth( char *who, int implicit )
                else
                        ldap_perror(ld, "ldap_bind_s" );
                (void) ldap_bind_s(ld, default_bind_object,
-                        (char *) UD_BIND_CRED, LDAP_AUTH_SIMPLE);
+                        (char *) NULL, LDAP_AUTH_SIMPLE);
                if (default_bind_object == NULL)
                        set_bound_dn(NULL);
                else
index d22f3ab85baf28f41c5bdf5c335dc71f91ff1db2..673b1e040dbc94125ac0e33f385a76f4930b52e4 100644 (file)
@@ -58,10 +58,10 @@ char copyright[] =
 static char *server = NULL;
 static char *config_file = UD_CONFIG_FILE;
 static char *filter_file = FILTERFILE;
-static int ldap_port = LDAP_PORT;
+static int ldap_port = 0;
 static int dereference = TRUE;
 
-char *default_bind_object = UD_BINDDN;
+char *default_bind_object = NULL;
 
 char *bound_dn;                        /* bound user's Distinguished Name */
 char *group_base;              /* place in LDAP tree where groups are */
@@ -487,7 +487,7 @@ change_base( int type, char **base, char *s )
        /* set the search base back to the original default value */
        else if (!strcasecmp(s, "default")) {
                if (type == BASE_SEARCH)
-                       StrFreeDup(base, UD_BASE);
+                       StrFreeDup(base, NULL);
                else if (type == BASE_GROUPS)
                        StrFreeDup(base, UD_WHERE_GROUPS_ARE_CREATED);
                printbase(output_string, *base);
@@ -582,6 +582,16 @@ initialize_client( void )
                                        continue;
                                server = strdup(cp);
                        }
+                       else if (!strncasecmp(buffer, "host", 4)) {
+                               if (server != NULL)
+                                       continue;
+                               cp = buffer + 4;
+                               while (isspace(*cp))
+                                       cp++;
+                               if ((*cp == '\0') || (*cp == '\n'))
+                                       continue;
+                               server = strdup(cp);
+                       }
                        else if (!strncasecmp(buffer, "base", 4)) {
                                cp = buffer + 4;
                                while (isspace(*cp))
@@ -604,10 +614,6 @@ initialize_client( void )
        }
        if (group_base == NULL)
                group_base = strdup(UD_WHERE_GROUPS_ARE_CREATED);
-       if (search_base == NULL)
-               search_base = strdup(UD_BASE);
-       if (server == NULL)
-               server = strdup(LDAPHOST);
 
        /*
         *  Set up our LDAP connection.  The values of retry and timeout
@@ -619,7 +625,7 @@ initialize_client( void )
                exit(0);
                /* NOTREACHED */
        }
-       if (ldap_bind_s(ld, (char *) default_bind_object, (char *) UD_BIND_CRED,
+       if (ldap_bind_s(ld, (char *) default_bind_object, (char *) NULL,
            LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
                fprintf(stderr, "  The LDAP Directory is temporarily unavailable.  Please try again later.\n");
                if (ld->ld_errno != LDAP_UNAVAILABLE)
index 32e21619c53a845ea2d8ea04cafa5c7ef42ff1f0..a0bd8497904a27db77d91e9e5abca0c4361e82c2 100644 (file)
@@ -40,7 +40,7 @@
 char *
 mygetpass( char *prompt )
 {
-#if !defined(HAVE_TERMIOS) && !defined(HAVE_SGTTY_H)
+#if !defined(HAVE_POSIX_TERMIOS) && !defined(HAVE_SGTTY_H)
        static char buf[256];
        int i, c;
 
@@ -525,7 +525,7 @@ my_ldap_dn2ufn( char *s )
        register char **cpp;
        static char short_DN[BUFSIZ];
 
-       if (strstr(s, UD_BASE) == NULL)
+       if (strstr(s, NULL) == NULL)
                return(ldap_dn2ufn(s));
        cpp = ldap_explode_dn(s, TRUE);
        sprintf(short_DN, "%s, %s", *cpp, *(cpp + 1));
index ea2f4726c2b77dbd9ff95265dac797e3a0073873..efc15b3ca79d81cce409e8d6135c47d75f712090 100644 (file)
@@ -1,4 +1,4 @@
-.TH LDAPDELETE 1 "13 November 1995" "U-M LDAP LDVERSION"
+.TH LDAPDELETE 1 "10 November 1998" "OpenLDAP LDVERSION"
 .SH NAME
 ldapdelete \- ldap delete entry tool
 .SH SYNOPSIS
@@ -67,7 +67,7 @@ is treated as a pattern where the first occurrence of \fB%s\fP is
 replaced with a line from \fIfile\fP.
 .TP
 .B \-D binddn
-Use \fIbinddn\fP to bind to the X.500 directory. \fIbinddn\fP should be
+Use \fIbinddn\fP to bind to the LDAP directory. \fIbinddn\fP should be
 a string-represented DN as defined in RFC 1779.
 .TP
 .B \-w passwd
@@ -93,6 +93,7 @@ course it would probably be necessary to supply a \fIbinddn\fP and
 Exit status is 0 if no errors occur.  Errors result in a non-zero exit
 status and a diagnostic message being written to standard error.
 .SH "SEE ALSO"
+.BR ldap.conf (5),
 .BR ldapadd (1),
 .BR ldapmodify (1),
 .BR ldapmodrdn (1),
@@ -107,3 +108,8 @@ Kille, S.,
 ISODE Consortium, March 1995.
 .SH BUGS
 There is no interactive mode, but there probably should be.
+.SH ACKNOWLEDGEMENTS
+.B     OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B     OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.  
index 3ffbe59a92f63c27156d2ad78e69edb06a2bb692..b304b01e5a92e4bf245bcd1f55b17347436bc18c 100644 (file)
@@ -1,4 +1,4 @@
-.TH LDAPMODIFY 1 "13 November 1995" "U-M LDAP LDVERSION"
+.TH LDAPMODIFY 1 "10 November 1998" "OpenLDAP LDVERSION"
 .SH NAME
 ldapmodify, ldapadd \- ldap modify entry and ldap add entry tools
 .SH SYNOPSIS
@@ -104,7 +104,7 @@ Read the entry modification information from \fIfile\fP instead of from
 standard input.
 .TP
 .B \-D binddn
-Use \fIbinddn\fP to bind to the X.500 directory. \fIbinddn\fP should be
+Use \fIbinddn\fP to bind to the LDAP directory. \fIbinddn\fP should be
 a string-represented DN as defined in RFC 1779.
 .TP
 .B \-w passwd
@@ -285,6 +285,7 @@ status and a diagnostic message being written to standard error.
 .BR ldapdelete (1),
 .BR ldapmodrdn (1),
 .BR ldapsearch (1),
+.BR ldap.conf (5),
 .BR ldap (3),
 .BR ldap_add (3),
 .BR ldap_delete (3),
@@ -299,3 +300,8 @@ Kille, S.,
 ISODE Consortium, March 1995.
 .SH BUGS
 There is no interactive mode, but there probably should be.
+.SH ACKNOWLEDGEMENTS
+.B     OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B     OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.  
index 8468e7a4e59032df9ed36e314f08d19fa9b41990..f2a17099e0974ee04e22f4fedee7d1f84072457c 100644 (file)
@@ -1,4 +1,4 @@
-.TH LDAPMODRDN 1 "13 November 1995" "U-M LDAP LDVERSION"
+.TH LDAPMODRDN 1 "10 November 1998" "OpenLDAP LDVERSION"
 .SH NAME
 ldapmodrdn \- ldap modify entry RDN tool
 .SH SYNOPSIS
@@ -67,7 +67,7 @@ Read the entry modification information from \fIfile\fP instead of from
 standard input or the command-line.
 .TP
 .B \-D binddn
-Use \fIbinddn\fP to bind to the X.500 directory. \fIbinddn\fP should be
+Use \fIbinddn\fP to bind to the LDAP directory. \fIbinddn\fP should be
 a string-represented DN as defined in RFC 1779.
 .TP
 .B \-w passwd
@@ -120,6 +120,7 @@ status and a diagnostic message being written to standard error.
 .BR ldapdelete (1),
 .BR ldapmodify (1),
 .BR ldapsearch (1),
+.BR ldap.conf (5),
 .BR ldap (3),
 .BR ldap_modrdn2 (3)
 .LP
@@ -130,3 +131,8 @@ Kille, S.,
 ISODE Consortium, March 1995.
 .SH BUGS
 There is no interactive mode, but there probably should be.
+.SH ACKNOWLEDGEMENTS
+.B     OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B     OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.  
index f1b5d43a55e32473cca95cbdb86ced02f861bdfe..1453f073d56203f7394397b5ca8e0b9b09bdbb8c 100644 (file)
@@ -1,4 +1,4 @@
-.TH LDAPSEARCH 1 "22 September 1998" "OpenLDAP LDVERSION"
+.TH LDAPSEARCH 1 "10 November 1998" "OpenLDAP LDVERSION"
 .SH NAME
 ldapsearch \- ldap search tool
 .SH SYNOPSIS
@@ -123,7 +123,7 @@ replaced with a line from \fIfile\fP.  If \fIfile\fP is a single \fI-\fP
 character, then the lines are read from standard input.
 .TP
 .B \-D binddn
-Use \fIbinddn\fP to bind to the X.500 directory. \fIbinddn\fP should be
+Use \fIbinddn\fP to bind to the LDAP directory. \fIbinddn\fP should be
 a string-represented DN as defined in RFC 1779.
 .TP
 .B \-w bindpasswd
@@ -275,6 +275,7 @@ status and a diagnostic message being written to standard error.
 .BR ldapdelete (1),
 .BR ldapmodify (1),
 .BR ldapmodrdn (1),
+.BR ldap.conf (5),
 .BR ldap (3),
 .BR ldap_search (3)
 .LP
index 43284a7f74d6177743c76e0f5b07cb85b4aa2c49..aeb572c612a69a51d2cd9fd7502e955762823c16 100644 (file)
@@ -1,7 +1,7 @@
-.TH UD 1 "18 March 1993" "U-M LDAP LDVERSION"
+.TH UD 1 "10 November 1998" "OpenLDAP LDVERSION"
 .UC 6
 .SH NAME
-ud \- interactive X.500 Directory Server query program
+ud \- interactive LDAP Directory Server query program
 .SH SYNOPSIS
 .B ud
 [-Dv] [-s 
@@ -59,6 +59,7 @@ Prints out a list of valid ud debug masks.
 ETCDIR/ud.conf         The ud configuration file.
 .SH "SEE ALSO"
 .BR ud.conf (5),
+.BR ldap.conf (5),
 .BR ldap (3)
 .SH DIAGNOSTICS
 .B ud
@@ -71,3 +72,8 @@ uses the ldap_perror() routine to print an informative diagnostic.
 Too numerous to mention.
 .SH AUTHOR
 Bryan Beecher, University of Michigan
+.SH ACKNOWLEDGEMENTS
+.B     OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B     OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.  
diff --git a/doc/man/man5/ldap.conf.5 b/doc/man/man5/ldap.conf.5
new file mode 100644 (file)
index 0000000..26c0781
--- /dev/null
@@ -0,0 +1,72 @@
+.TH LDAP.CONF 5 "29 November 1998" "OpenLDAP LDVERSION"
+.UC 6
+.SH NAME
+ldap.conf \- ldap configuration file
+.SH SYNOPSIS
+ETCDIR/ldap.conf
+.SH DESCRIPTION
+The
+.I ldap.conf
+configuration file is used to set system-wide defaults to be applied when
+running
+.I ldap
+clients.
+Note that each user may specify an optional configuration file,
+.IR .ldaprc ,
+in his/her home directory which will be used to override system-wide
+defaults file.  The user may also provide a local configuration
+file
+.I ldaprc
+which will be used to override per-user and system-wide defaults.
+Environmental variables may be used to file based defaults.
+.SH OPTIONS
+The different configuration options are:
+.TP 1i
+.TP 1i
+\fBBASE <base>\fP
+Used to specify the default base dn to use when performing ldap operations.
+The base must be specified as a Distinguished Name in LDAP format.
+\fBHOST <name[:port] ...>\fP
+Used to specify the name(s) of an LDAP server(s) to which 
+.I ldap 
+library should connect to.  Each server's name can be specified as a
+domain-style name or an IP address and optionally followed a ':' and
+the port number the ldap server is listening on.  A space separated
+listed of host may be provided.
+.TP 1i
+\fBPORT <port>\fP
+Used to specify the port used with connecting to LDAP servers(s).
+The port may be specified as a number.
+.TP 1i
+\fBSIZELIMIT <integer>\fP
+Used to specify a size limit to use when performing searches.  The
+number should be an non-negative integer.  \fISIZELIMIT\fP of zero (0)
+specifies unlimited search size.
+.TP 1i
+\fBTIMELIMIT <integer>\fP
+Used to specify a time limit to use when performing searches.  The
+number should be an non-negative integer.  \fITIMELIMIT\fP of zero (0)
+specifies unlimited search time to be used.
+.TP 1i
+\fBDEREF <never|searching|finding|always>\fP
+Specify how aliases dereferencing is done.  \fIDEREF\fP should
+be set to one of
+.B never,
+.B always,
+.B search,
+or 
+.B find 
+to specify that aliases are never dereferenced, always dereferenced,
+dereferenced when searching, or dereferenced only when locating the
+base object for the search.  The default is to never dereference aliases.
+.SH FILES
+.I  ETCDIR/ldap.conf
+.SH "SEE ALSO"
+ldap(3)
+.SH AUTHOR
+Kurt Zeilenga, The OpenLDAP Project
+.SH ACKNOWLEDGEMENTS
+.B     OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B     OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.  
index 13575bf7ea579c6d7d18513f5899f5feb1360070..0ab9fdf283ae4b9d24391836680094ab13383fa4 100644 (file)
@@ -1,9 +1,9 @@
-.TH UD.CONF 5 "18 March 1993" "U-M LDAP LDVERSION"
+.TH UD.CONF 5 "22 September 1998" "OpenLDAP LDVERSION"
 .UC 6
 .SH NAME
 ud.conf \- ud configuration file
 .SH SYNOPSIS
-/etc/ud.conf
+ETCDIR/ud.conf
 .SH DESCRIPTION
 The
 .I ud
@@ -17,13 +17,13 @@ configuration file.
 .SH OPTIONS
 The different configuration options are:
 .TP 1i
-\fBserver <name>\fP
+\fBHOST <name>\fP
 Used to specify the name of an LDAP server to which 
 .I ud 
 should connect.  There may be only one entry per config file.
 The server's name can be specified as a domain-style name or an IP address.
 .TP 1i
-\fBbase <base>\fP
+\fBBASE <base>\fP
 Used to specify the search base to use when performing search operations.
 The base may be changed by those using
 .I ud
@@ -33,7 +33,7 @@ command.
 There may be only one entry per config file.
 The base must be specified as a Distinguished Name in LDAP format.
 .TP 1i
-\fBgroupbase <base>\fP
+\fBGROUPBASE <base>\fP
 Used to specify the base used when creating groups.
 The base may be changed by those using
 .I ud
@@ -43,7 +43,7 @@ command.
 There may be only one entry per config file.
 The base must be specified as a Distinguished Name in LDAP format.
 .TP 1i
-\fBsearch <algorithm>\fP
+\fBSEARCH <algorithm>\fP
 Used to specify a search algorithm to use when performing searches.  More than
 one algorithm may be specified, and each is tried in turn until a suitable
 response is found.
@@ -88,9 +88,14 @@ For example,
 causes this algorithm to be applied when the number of fields is exactly equal
 to one.  If there is exactly one field, the token is looked up as a UID.
 .SH FILES
-.I  /etc/ud.conf
+.I  ETCDIR/ud.conf
 .SH "SEE ALSO"
 ud(1),
 ldap(3)
 .SH AUTHOR
 Bryan Beecher, University of Michigan
+.SH ACKNOWLEDGEMENTS
+.B     OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B     OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.  
index 82d347822e2b4874436f4a88cabb8bca8d8ab3a6..f384d3b0466d66e0d2e1dfa30fe3368734dc0e7b 100644 (file)
 #define DEFAULT_SYSCONFDIR     "%SYSCONFDIR%"
 #define DEFAULT_LIBEXECDIR     "%LIBEXECDIR%"
 
-/* default ldap host */
-#define LDAPHOST       "localhost"
+#define DEFAULT_LDAP_CONF_FILE "%SYSCONFDIR%/ldap.conf"
+#define DEFAULT_LDAP_USERRC_FILE "ldaprc"
+#define DEFAULT_LDAP_ENV_PREFIX "LDAP"
 
-#define DEFAULT_LDAPHOST_FILE "%SYSCONFDIR%/ldaphost"
-/* default place to start searching */
-#define DEFAULT_BASE   "o=Your Organization Name, c=US"
-#define DEFAULT_BASE_FILE "%SYSCONFDIR%/ldapbase"
-
-/*
- * default binddn and creditials
- *  use files, make sure they are not generally readable
- */
-#define DEFAULT_BINDDN         NULL
-#define DEFAULT_BINDDN_FILE "%SYSCONFDIR%/ldapbinddn"
-
-#define DEFAULT_BIND_CRED      NULL
-#define DEFAULT_BIND_CRED_FILE "%SYSCONFDIR%/ldapbindcred"
 
 /*********************************************************************
  *                                                                   *
 /*
  * FINGER DEFINITIONS
  */
-       /* who to bind as */
-#define FINGER_BINDDN                  NULL
-#define FINGER_BIND_CRED               NULL
-       /* where to search */
-#define FINGER_BASE                            DEFAULT_BASE
        /* banner to print */
-#define FINGER_BANNER          "X.500 Finger Service...\r\n"
+#define FINGER_BANNER          "OpenLDAP Finger Service...\r\n"
        /* who to report errors to */
 #define FINGER_ERRORS          "System Administrator"
        /* what to say if no matches are found */
@@ -107,11 +89,6 @@ Please try again later.\r\n"
 /*
  * GO500 GOPHER GATEWAY DEFINITIONS
  */
-       /* who to bind as */
-#define GO500_BINDDN   NULL
-#define GO500_BIND_CRED        NULL
-       /* where to search */
-#define GO500_BASE     DEFAULT_BASE
        /* port on which to listen */
 #define GO500_PORT     5555
        /* how to handle aliases */
@@ -133,9 +110,6 @@ Please try again later.\r\n"
 /*
  * GO500GW GOPHER GATEWAY DEFINITIONS
  */
-       /* who to bind as */
-#define GO500GW_BINDDN                 NULL
-#define GO500GW_BIND_CRED              NULL
        /* where the helpfile lives */
 #define GO500GW_HELPFILE       "%DATADIR%/go500gw.help"
        /* port on which to listen */
@@ -157,9 +131,6 @@ Please try again later.\r\n"
 /*
  * RCPT500 MAIL RESPONDER GATEWAY DEFINITIONS
  */
-       /* who to bind as */
-#define RCPT500_BINDDN         NULL
-#define RCPT500_BIND_CRED      NULL
        /* where the helpfile lives */
 #define RCPT500_HELPFILE       "%DATADIR%/rcpt500.help"
        /* maximum number of matches returned */
@@ -169,8 +140,6 @@ Please try again later.\r\n"
        /* command that will accept an RFC822 message text on standard
           input, and send it.  sendmail -t does this nicely. */
 #define RCPT500_PIPEMAILCMD    "%SENDMAIL% -t"
-        /* where to search */
-#define RCPT500_BASE             DEFAULT_BASE
        /* attribute to use when sorting results */
 #define RCPT500_SORT_ATTR      SORT_ATTR
        /* max number of hits displayed in full before a list is presented */
@@ -180,48 +149,9 @@ Please try again later.\r\n"
        /* number of DN components to show in entry displays */
 #define RCPT500_RDNCOUNT       DEFAULT_RDNCOUNT        
 
-/*
- * LDAPSEARCH TOOL
- */
-       /* who to bind as */
-#define LDAPSEARCH_BINDDN              NULL
-#define LDAPSEARCH_BIND_CRED   NULL
-       /* search base */
-#define LDAPSEARCH_BASE                DEFAULT_BASE
-
-/*
- * LDAPMODIFY TOOL
- */
-       /* who to bind as */
-#define LDAPMODIFY_BINDDN              NULL
-#define LDAPMODIFY_BIND_CRED   NULL
-       /* search base */
-#define LDAPMODIFY_BASE                DEFAULT_BASE
-
-/*
- * LDAPDELETE TOOL
- */
-       /* who to bind as */
-#define LDAPDELETE_BINDDN              NULL
-#define LDAPDELETE_BIND_CRED   NULL
-       /* search base */
-#define LDAPDELETE_BASE                DEFAULT_BASE
-
-/*
- * LDAPMODRDN TOOL
- */
-       /* who to bind as */
-#define LDAPMODRDN_BINDDN              NULL
-#define LDAPMODRDN_BIND_CRED   NULL
-       /* search base */
-#define LDAPMODRDN_BASE                DEFAULT_BASE
-
 /*
  * MAIL500 MAILER DEFINITIONS
  */
-       /* who to bind as */
-#define MAIL500_BINDDN                 NULL
-#define MAIL500_BIND_CRED                      NULL
        /* max number of ambiguous matches reported */
 #define MAIL500_MAXAMBIGUOUS   10
        /* max subscribers allowed (size limit when searching for them ) */
@@ -240,12 +170,6 @@ Please try again later.\r\n"
 #define UD_DEFAULT_EDITOR      "%EDITOR%"
        /* default bbasename of user config file */
 #define UD_USER_CONFIG_FILE    ".udrc"
-       /* default user to bind as */
-#define UD_BINDDN              NULL
-       /* default password to bind with */
-#define UD_BIND_CRED   NULL
-       /* default search base */
-#define UD_BASE                DEFAULT_BASE
        /* default base where groups are created */
 #define UD_WHERE_GROUPS_ARE_CREATED    ""
        /* default base below which all groups live */
@@ -254,11 +178,6 @@ Please try again later.\r\n"
 /*
  * FAX500 DEFINITIONS
  */
-       /* what to bind as */
-#define FAX_BINDDN             NULL
-#define FAX_BIND_CRED  NULL
-       /* default search base */
-#define FAX_BASE               DEFAULT_BASE
        /* how long to wait for searches */
 #define FAX_TIMEOUT            180
        /* maximum number of ambiguous matches reported */
@@ -271,12 +190,6 @@ Please try again later.\r\n"
 /*
  * RP500 DEFINITIONS
  */
-       /* what to bind as */
-#define RP_BINDDN              NULL
-#define RP_BIND_CRED   NULL
-       /* default search base */
-#define RP_BASE                        DEFAULT_BASE
-
        /* prefix to add to non-fully-qualified numbers */
 #define RP_PHONEPREFIX ""
 
index fd739a8a82b08ebd79a160ba7d493a0acf3f856f..4a3f9383f99e09ee679e2641c073cbe512f52072 100644 (file)
@@ -10,14 +10,14 @@ SRCS        = bind.c open.c result.c error.c compare.c search.c \
        free.c disptmpl.c srchpref.c dsparse.c tmplout.c sort.c \
        getdn.c getentry.c getattr.c getvalues.c addentry.c \
        request.c getdxbyname.c os-ip.c url.c charset.c \
-       strdup.c
+       init.c strdup.c
 OBJS   = bind.lo open.lo result.lo error.lo compare.lo search.lo \
        modify.lo add.lo modrdn.lo delete.lo abandon.lo ufn.lo cache.lo \
        getfilter.lo sbind.lo kbind.lo unbind.lo friendly.lo cldap.lo \
        free.lo disptmpl.lo srchpref.lo dsparse.lo tmplout.lo sort.lo \
        getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
        request.lo getdxbyname.lo os-ip.lo url.lo charset.lo \
-       strdup.lo
+       init.lo strdup.lo
 
 LDAP_INCDIR= ../../include       
 LDAP_LIBDIR= ../../libraries
index 2479f3adf8c08f6bfedf34c49073189eaea2dad1..7a6081712da8a01a4184aa443f635d9860822224 100644 (file)
@@ -66,10 +66,14 @@ cldap_open( char *host, int port )
     char               *p;
     int                        i;
 
+       if(!openldap_ldap_initialized) {
+               openldap_ldap_initialize();
+       }
+
     Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
 
     if ( port == 0 ) {
-           port = LDAP_PORT;
+           port = openldap_ldap_global_options.ldo_defport;
     }
 
     if ( (s = socket( AF_INET, SOCK_DGRAM, 0 )) < 0 ) {
diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c
new file mode 100644 (file)
index 0000000..036ca8d
--- /dev/null
@@ -0,0 +1,280 @@
+#include "portable.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/ctype.h>
+#include <ac/time.h>
+
+#include "lber.h"
+#include "ldap.h"
+
+#include "ldap-int.h"
+#include "ldapconfig.h"
+
+struct ldapoptions openldap_ldap_global_options; 
+
+#undef gopts
+#define gopts openldap_ldap_global_options
+
+int    openldap_ldap_initialized = 0;
+
+#define ATTR_NONE      0
+#define ATTR_BOOL      1
+#define ATTR_INT       2
+#define ATTR_KV                3
+#define ATTR_STRING    4
+
+struct ol_keyvalue {
+       char*           key;
+       int                     value;
+};
+
+static struct ol_keyvalue deref_kv[] = {
+       {"never", LDAP_DEREF_NEVER},
+       {"searching", LDAP_DEREF_SEARCHING},
+       {"finding", LDAP_DEREF_FINDING},
+       {"always", LDAP_DEREF_ALWAYS},
+       {NULL, 0}
+};
+
+static struct ol_attribute {
+       int                     type;
+       char*           name;
+       void*           data;
+       size_t          offset;
+} attrs[] = {
+       {ATTR_KV,               "DEREF",        deref_kv, /* or &deref_kv[0] */
+               offsetof(struct ldapoptions, ldo_deref)},
+       {ATTR_INT,              "SIZELIMIT",    NULL,
+               offsetof(struct ldapoptions, ldo_sizelimit)},
+       {ATTR_INT,              "TIMELIMIT",    NULL,
+               offsetof(struct ldapoptions, ldo_timelimit)},
+       {ATTR_STRING,   "BASE",                 NULL,
+               offsetof(struct ldapoptions, ldo_defbase)},
+       {ATTR_STRING,   "HOST",                 NULL,
+               offsetof(struct ldapoptions, ldo_defhost)},
+       {ATTR_INT,              "PORT",                 NULL,
+               offsetof(struct ldapoptions, ldo_defport)},
+       {ATTR_NONE,             NULL,           NULL,   0}
+};
+
+#define MAX_LDAP_ATTR_LEN  sizeof("SIZELIMIT")
+#define MAX_LDAP_ENV_PREFIX_LEN 8
+
+static void openldap_ldap_init_w_conf(const char *file)
+{
+       char linebuf[128];
+       FILE *fp;
+       int i;
+       char *cmd, *opt;
+       char *start, *end;
+
+       if (file == NULL) {
+               /* no file name */
+               return;
+       }
+
+       fp = fopen(file, "r");
+       if(fp == NULL) {
+               /* could not open file */
+               return;
+       }
+
+       while((start = fgets(linebuf, sizeof(linebuf), fp)) != NULL) {
+               /* skip lines starting with '#' */
+               if(*start == '#') continue;
+
+               /* trim leading white space */
+               while((*start != '\0') && isspace(*start)) start++;
+
+               /* anything left? */
+               if(*start == '\0') continue;
+
+               /* trim trailing white space */
+               end = &start[strlen(start)-1];
+               while(isspace(*end)) end--;
+               end[1] = '\0';
+
+               /* anything left? */
+               if(*start == '\0') continue;
+               
+
+               /* parse the command */
+               cmd=start;
+               while((*start != '\0') && !isspace(*start)) {
+                       start++;
+               }
+               if(*start == '\0') {
+                       /* command has no argument */
+                       continue;
+               } 
+
+               *start++ = '\0';
+
+               /* we must have some non-whitespace to skip */
+               while(isspace(*start)) start++;
+               opt = start;
+
+               for(i=0; attrs[i].type != ATTR_NONE; i++) {
+                       void *p;
+
+                       if(strcasecmp(cmd, attrs[i].name) != 0) {
+                               continue;
+                       }
+
+                       p = &((char *) &gopts)[attrs[i].offset];
+
+                       switch(attrs[i].type) {
+                       case ATTR_INT:
+                               * (int*) p = atoi(opt);
+                               break;
+
+                       case ATTR_KV: {
+                                       struct ol_keyvalue *kv;
+
+                                       for(kv = (struct ol_keyvalue *) attrs[i].data;
+                                               kv->key != NULL;
+                                               kv++) {
+
+                                               if(strcasecmp(opt, kv->key) == 0) {
+                                                       * (int*) p = kv->value;
+                                                       break;
+                                               }
+                                       }
+                               } break;
+
+                       case ATTR_STRING:
+                               if (* (char**) p != NULL) free(* (char**) p);
+                               * (char**) p = ldap_strdup(opt);
+                               break;
+                       }
+               }
+       }
+}
+
+static void openldap_ldap_init_w_userconf(const char *file)
+{
+       char *home;
+       char *path;
+
+       if (file == NULL) {
+               /* no file name */
+               return;
+       }
+
+       home = getenv("HOME");
+
+       if (home != NULL) {
+               path = malloc(strlen(home) + strlen(file) + 3);
+       } else {
+               path = malloc(strlen(file) + 3);
+       }
+
+       if(home != NULL && path != NULL) {
+               /* we assume UNIX path syntax is used... */
+
+               /* try ~/file */
+               sprintf(path, "%s/%s", home, file);
+               openldap_ldap_init_w_conf(path);
+
+               /* try ~/.file */
+               sprintf(path, "%s/.%s", home, file);
+               openldap_ldap_init_w_conf(path);
+       }
+
+       if(path != NULL) {
+               free(path);
+       }
+
+       /* try file */
+       openldap_ldap_init_w_conf(file);
+}
+
+static void openldap_ldap_init_w_env(const char *prefix)
+{
+       char buf[MAX_LDAP_ATTR_LEN+MAX_LDAP_ENV_PREFIX_LEN];
+       int len;
+       int i;
+       void *p;
+       char *value;
+
+       if (prefix == NULL) {
+               prefix = DEFAULT_LDAP_ENV_PREFIX;
+       }
+
+       strncpy(buf, prefix, MAX_LDAP_ENV_PREFIX_LEN);
+       buf[MAX_LDAP_ENV_PREFIX_LEN] = '\0';
+       len = strlen(buf);
+
+       for(i=0; attrs[i].type != ATTR_NONE; i++) {
+               strcpy(&buf[len], attrs[i].name);
+               value = getenv(buf);
+
+               if(value == NULL) {
+                       continue;
+               }
+
+               p = &((char *) &gopts)[attrs[i].offset];
+
+               switch(attrs[i].type) {
+               case ATTR_INT:
+                       * (int*) p = atoi(value);
+                       break;
+
+               case ATTR_KV: {
+                               struct ol_keyvalue *kv;
+
+                               for(kv = (struct ol_keyvalue *) attrs[i].data;
+                                       kv->key != NULL;
+                                       kv++) {
+
+                                       if(strcasecmp(value, kv->key) == 0) {
+                                               * (int*) p = kv->value;
+                                               break;
+                                       }
+                               }
+                       } break;
+
+               case ATTR_STRING:
+                       if (* (char**) p != NULL) free(* (char**) p);
+                       if (*value == '\0') {
+                               * (char**) p = NULL;
+                       } else {
+                               * (char**) p = ldap_strdup(value);
+                       }
+                       break;
+               }
+       }
+}
+
+void openldap_ldap_initialize( void )
+{
+       if ( openldap_ldap_initialized ) {
+               return;
+       }
+
+       gopts.ldo_deref =       LDAP_DEREF_NEVER;
+       gopts.ldo_timelimit = LDAP_NO_LIMIT;
+       gopts.ldo_sizelimit = LDAP_NO_LIMIT;
+
+       gopts.ldo_defhost = ldap_strdup("localhost");
+       gopts.ldo_defport = LDAP_PORT;
+
+       openldap_ldap_init_w_conf(DEFAULT_LDAP_CONF_FILE);
+       openldap_ldap_init_w_userconf(DEFAULT_LDAP_USERRC_FILE);
+
+       {
+               char *altfile = getenv("LDAPRC");
+
+               if( altfile != NULL ) {
+                       openldap_ldap_init_w_conf( altfile );
+               }
+       }
+
+       openldap_ldap_init_w_env(NULL);
+
+       openldap_ldap_initialized = 1;
+}
index 3cd9762daeaa92dbf3d06e4ed0653ac8cbfc8217..15c1d4acf00acc7231d25486e4296a1c16f81f45 100644 (file)
@@ -26,6 +26,26 @@ LDAP_BEGIN_DECL
 #endif /* LDAP_DNS */
 #endif /* LDAP_REFERRALS */
 
+/*
+ * structure representing get/set'able options
+ * which have global defaults.
+ */
+struct ldapoptions {
+       int             ldo_deref;
+       int             ldo_timelimit;
+       int             ldo_sizelimit;
+
+       char*   ldo_defbase;
+       char*   ldo_defhost;
+       int             ldo_defport;
+};
+
+extern struct ldapoptions openldap_ldap_global_options; 
+extern int     openldap_ldap_initialized;
+
+/* in init.c */
+void openldap_ldap_initialize LDAP_P(( void ));
+
 /*
  * in cache.c
  */
index 865fad636d24e2717f49c3c40ced665ad64d37cb..a1e0049d0ab472bd81cfd0e48176d14abf52a00c 100644 (file)
@@ -101,6 +101,10 @@ ldap_init( char *defhost, int defport )
 {
        LDAP                    *ld;
 
+       if(!openldap_ldap_initialized) {
+               openldap_ldap_initialize();
+       }
+
        Debug( LDAP_DEBUG_TRACE, "ldap_init\n", 0, 0, 0 );
 
 #ifdef HAVE_WINSOCK2
@@ -164,7 +168,8 @@ ldap_init( char *defhost, int defport )
        }
 
 
-       ld->ld_defport = ( defport == 0 ) ? LDAP_PORT : defport;
+       ld->ld_defport = ( defport == 0 ) ?
+               openldap_ldap_global_options.ldo_defport : defport;
        ld->ld_version = LDAP_VERSION;
        ld->ld_lberoptions = LBER_USE_DER;
        ld->ld_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT;
index baf3a2137b7df863e89797b37f2ec40bad132916..1d2c36aba8b3cad0ec5fe5bad53229657d1711d7 100644 (file)
@@ -698,7 +698,7 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
                                *ports++ = '\0';
                                srv->lsrv_port = atoi( ports );
                        } else {
-                               srv->lsrv_port = LDAP_PORT;
+                               srv->lsrv_port = openldap_ldap_global_options.ldo_defport;
                        }
 #ifdef LDAP_DNS
                } else {
@@ -881,7 +881,7 @@ dn2servers( LDAP *ld, char *dn )    /* dn can also be a domain.... */
        srvlist = NULL;
 
        for ( i = 0; dxs[ i ] != NULL; ++i ) {
-               port = LDAP_PORT;
+               port = openldap_global_ldap_options.ldo_defport;
                server_dn = NULL;
                if ( strchr( dxs[ i ], ':' ) == NULL ) {
                        host = dxs[ i ];
index f479fd59c60e41a4f7d62d14daa7d91b40f3c4f3..69f8da23891f50d4336799b7ba5292f7c24b2004 100644 (file)
@@ -274,7 +274,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
                        err = -1;
                } else {
                        if ( ludp->lud_port == 0 ) {
-                               srv->lsrv_port = LDAP_PORT;
+                               srv->lsrv_port = openldap_ldap_global_options.ldo_defport;
                        } else {
                                 srv->lsrv_port = ludp->lud_port;
                        }
index 25cc1a0ef45fa75c2e3867942a0c6e3f879b478d..83b12df09e355f37cc0c8812dc3d91f316ccf7bb 100644 (file)
@@ -90,8 +90,8 @@ main( int argc, char **argv )
 
        ldapsrcurl = NULL;
        ldapdesturl = NULL;
-       ldaphost = LDAPHOST;
-       ldapbase = DEFAULT_BASE;
+       ldaphost = NULL;
+       ldapbase = NULL;
        srcldapauthmethod = LDAP_AUTH_SIMPLE;
        destldapauthmethod = LDAP_AUTH_SIMPLE;
        srcldapbinddn = NULL;
@@ -384,7 +384,7 @@ start_ldap_search(
                fflush( stdout );
        }
 
-       if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
+       if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
                perror( "ldap_open" );
                return( NULL );
        }
@@ -961,7 +961,7 @@ bind_to_destination_ldap(
        free( ldapbase );
        ldapbase = strdup( buf );
 
-       if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
+       if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
                perror( "ldap_open" );
                return( NULL );
        }
index 535243f330a4fc8586dc24a1e011b460ec353608..c88ff565c57c741f9697c958c074ebde6b2db8b4 100644 (file)
@@ -47,7 +47,7 @@ main( int argc, char **argv )
        ldap_debug = 255;
        lber_debug = 255;
 */
-       if ( (ld = ldap_open( "vertigo:5555", LDAP_PORT )) == NULL ) {
+       if ( (ld = ldap_open( "vertigo:5555", 0 )) == NULL ) {
                perror( "ldap_open" );
                exit( 1 );
        }
index 8fa21f67524ae4c06b3c485b2d08052c0f5157a3..43a4bcd90b8796ac465a22086461a29d18a5bd0b 100644 (file)
@@ -339,7 +339,7 @@ parse_replica_line(
                ri->ri_port = atoi( hp );
            }
            if ( ri->ri_port <= 0 ) {
-               ri->ri_port = LDAP_PORT;
+               ri->ri_port = 0;
            }
            ri->ri_hostname = strdup( val );
            gots |= GOT_HOST;
index c7358fddc1a0814298ca7fac02f85f88a7dbe244..5792850d7eda50bde168ead293cde90352deb902 100644 (file)
@@ -293,7 +293,7 @@ get_repl_hosts(
        if ( str_parse_line( line, &type, &value, &len ) < 0 ) {
            return( NULL );
        }
-       port = LDAP_PORT;
+       port = 0;
        if (( p = strchr( value, ':' )) != NULL ) {
            *p = '\0';
            p++;