Commit 1fc810bf authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Added support for ldap.conf file. See ldap.conf(5) for details.

Modified clients to reduce use of ldapconfig.h.edit.
ldap_{get,set}_option support is relatively complete.  Needs
to be extended to support other "features" of OpenLDAP.
parent 962b8dc2
......@@ -308,7 +308,7 @@ connect_to_x500()
int sizelimit = FAX_MAXAMBIGUOUS;
int deref = LDAP_DEREF_ALWAYS;
if ( (ld = ldap_open( LDAPHOST, LDAP_PORT )) == NULL ) {
if ( (ld = ldap_open( NULL, 0 )) == NULL ) {
syslog( LOG_ALERT, "ldap_open failed" );
return( -1 );
}
......@@ -316,7 +316,7 @@ connect_to_x500()
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &sizelimit);
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
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 );
}
......
......@@ -32,8 +32,8 @@
#define DEFAULT_SIZELIMIT 50
int debug;
char *ldaphost = LDAPHOST;
char *base = RP_BASE;
char *ldaphost = NULL;
char *base = NULL;
int deref = LDAP_DEREF_ALWAYS;
int sizelimit = DEFAULT_SIZELIMIT;
LDAPFiltDesc *filtd;
......@@ -116,7 +116,7 @@ main (argc, argv)
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &sizelimit);
ldap_set_option(ld, LDAP_OPT_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 );
......
......@@ -34,9 +34,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;
......@@ -167,7 +167,7 @@ static do_query()
}
ldap_set_option(ld, LDAP_OPT_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 );
......
......@@ -44,8 +44,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;
......@@ -391,7 +391,7 @@ int s;
int deref = GO500_DEREF;
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
rc = ldap_simple_bind_s( ld, GO500_BINDDN, GO500_BIND_CRED );
rc = ldap_simple_bind_s( ld, NULL, NULL );
if ( rc != LDAP_SUCCESS ) {
fprintf(fp,
"0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
......
......@@ -45,8 +45,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;
......@@ -440,7 +440,7 @@ int s;
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
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",
......
......@@ -56,7 +56,7 @@ char *vacationhost = NULL;
char *errorsfrom = NULL;
char *mailfrom = NULL;
char *host = NULL;
char *ldaphost = LDAPHOST;
char *ldaphost = NULL;
int hostlen = 0;
int debug;
......@@ -356,7 +356,7 @@ connect_to_x500()
opt = LDAP_DEREF_ALWAYS;
ldap_set_option(ld, LDAP_OPT_DEREF, &opt);
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 );
}
......
......@@ -27,9 +27,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;
char reply[ MAXSIZE * RCPT500_LISTLIMIT ];
......
......@@ -12,13 +12,11 @@
#include <lber.h>
#include <ldap.h>
#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;
......
......@@ -22,13 +22,11 @@
#include <ldap.h>
#include <ldif.h>
#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;
......
......@@ -12,13 +12,11 @@
#include <lber.h>
#include <ldap.h>
#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;
......
......@@ -11,8 +11,6 @@
#include <ldap.h>
#include <ldif.h>
#include "ldapconfig.h"
#define DEFSEP "="
#ifdef LDAP_DEBUG
......@@ -76,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;
......
......@@ -257,7 +257,7 @@ 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,7 +58,7 @@ static char *filter_file = FILTERFILE;
static int ldap_port = LDAP_PORT;
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 */
......@@ -510,7 +510,7 @@ char **base, *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);
......@@ -603,6 +603,16 @@ void initialize_client()
if ((*cp == '\0') || (*cp == '\n'))
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;
......@@ -626,10 +636,6 @@ void initialize_client()
}
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
......@@ -641,7 +647,7 @@ void initialize_client()
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, NULL,
LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
int ld_errno = 0;
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
......
......@@ -526,7 +526,7 @@ 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));
......
.TH LDAPDELETE 1 "22 September 1998" "OpenLDAP 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),
......
.TH LDAPMODIFY 1 "22 September 1998" "OpenLDAP 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),
......
.TH LDAPMODRDN 1 "22 September 1998" "OpenLDAP 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
......
.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
......
.TH UD 1 "22 September 1998" "OpenLDAP 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
......
.TH LDAP 3 "22 September 1998" "OpenLDAP LDVERSION"
.TH LDAP 3 "10 November 1998" "OpenLDAP LDVERSION"
.SH NAME
ldap - Lightweight Directory Access Protocol package
.SH SYNOPSIS
......@@ -12,7 +12,7 @@ ldap - Lightweight Directory Access Protocol package
.LP
The Lightweight Directory Access Protocol provides TCP/IP access to
the X.500 Directory or to a stand-alone LDAP server.
The University of Michigan LDAP package includes a stand-alone server in
The OpenLDAP LDAP package includes a stand-alone server in
.BR slapd (8),
an LDAP to X.500 gateway in
.BR ldapd (8),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment