mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-18 18:18:06 -05:00
Add PORT of ldap.conf support from -devel.
This commit is contained in:
parent
b2c72c8b30
commit
7e9d02ba61
33 changed files with 506 additions and 176 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ];
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
#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;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
#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 );
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
#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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
72
doc/man/man5/ldap.conf.5
Normal file
72
doc/man/man5/ldap.conf.5
Normal file
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -28,23 +28,10 @@
|
|||
#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"
|
||||
|
||||
/*********************************************************************
|
||||
* *
|
||||
|
|
@ -68,13 +55,8 @@
|
|||
/*
|
||||
* 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 ""
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ) {
|
||||
|
|
|
|||
280
libraries/libldap/init.c
Normal file
280
libraries/libldap/init.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 ];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue