mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-02-17 14:00:30 +08:00
struct ldap is now opaque to clients.
updated clients to use ldap_get/set_options ld_options is renamed ld_booleans. ldap-int.h has accessor macros. updated libldap to use new accessor macros.
This commit is contained in:
parent
1203736b7b
commit
8333a03346
@ -31,11 +31,6 @@
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
#if LDAP_VERSION < LDAP_VERSION3
|
||||
/* quick fix until we have ldap_set_options */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
|
||||
#include <ldapconfig.h>
|
||||
|
||||
#define USER 0
|
||||
@ -310,12 +305,16 @@ char **argv;
|
||||
|
||||
connect_to_x500()
|
||||
{
|
||||
int sizelimit = FAX_MAXAMBIGUOUS;
|
||||
int deref = LDAP_DEREF_ALWAYS;
|
||||
|
||||
if ( (ld = ldap_open( LDAPHOST, LDAP_PORT )) == NULL ) {
|
||||
syslog( LOG_ALERT, "ldap_open failed" );
|
||||
return( -1 );
|
||||
}
|
||||
ld->ld_sizelimit = FAX_MAXAMBIGUOUS;
|
||||
ld->ld_deref = LDAP_DEREF_ALWAYS;
|
||||
|
||||
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 ) {
|
||||
syslog( LOG_ALERT, "ldap_simple_bind_s failed" );
|
||||
@ -685,7 +684,10 @@ do_group_members( e, dn, to, nto, togroups, ngroups, err, nerr )
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
/* for each subtree to look in... */
|
||||
ld->ld_sizelimit = FAX_MAXMEMBERS;
|
||||
{
|
||||
int sizelimit = FAX_MAXMEMBERS;
|
||||
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &sizelimit);
|
||||
}
|
||||
for ( i = 0; base[i].b_dn != NULL; i++ ) {
|
||||
/* find entries that have joined this group... */
|
||||
rc = ldap_search_st( ld, base[i].b_dn,
|
||||
@ -784,7 +786,10 @@ do_group_members( e, dn, to, nto, togroups, ngroups, err, nerr )
|
||||
|
||||
ldap_msgfree( res );
|
||||
}
|
||||
ld->ld_sizelimit = FAX_MAXAMBIGUOUS;
|
||||
{
|
||||
int sizelimit = FAX_MAXAMBIGUOUS;
|
||||
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &sizelimit);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -26,11 +26,6 @@
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
||||
#if LDAP_VERSION < LDAP_VERSION3
|
||||
/* quick fix until we have ldap_set_options */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
|
||||
#include <ldapconfig.h>
|
||||
|
||||
#define DEFAULT_PORT 79
|
||||
@ -39,8 +34,8 @@
|
||||
int debug;
|
||||
char *ldaphost = LDAPHOST;
|
||||
char *base = RP_BASE;
|
||||
int deref;
|
||||
int sizelimit;
|
||||
int deref = LDAP_DEREF_ALWAYS;
|
||||
int sizelimit = DEFAULT_SIZELIMIT;
|
||||
LDAPFiltDesc *filtd;
|
||||
|
||||
static print_entry();
|
||||
@ -72,7 +67,6 @@ main (argc, argv)
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
deref = LDAP_DEREF_ALWAYS;
|
||||
while ( (i = getopt( argc, argv, "ab:d:f:x:z:" )) != EOF ) {
|
||||
switch( i ) {
|
||||
case 'a': /* do not deref aliases when searching */
|
||||
@ -118,8 +112,9 @@ main (argc, argv)
|
||||
perror( "ldap_open" );
|
||||
exit( -1 );
|
||||
}
|
||||
ld->ld_sizelimit = sizelimit ? sizelimit : DEFAULT_SIZELIMIT;
|
||||
ld->ld_deref = deref;
|
||||
|
||||
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 ) {
|
||||
fprintf( stderr, "X.500 is temporarily unavailable.\n" );
|
||||
@ -129,7 +124,8 @@ main (argc, argv)
|
||||
|
||||
result = NULL;
|
||||
if ( strchr( key, ',' ) != NULL ) {
|
||||
ld->ld_deref = LDAP_DEREF_FINDING;
|
||||
int ld_deref = LDAP_DEREF_FINDING;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &ld_deref);
|
||||
if ( (rc = ldap_ufn_search_s( ld, key, attrs, 0, &result ))
|
||||
!= LDAP_SUCCESS && rc != LDAP_SIZELIMIT_EXCEEDED &&
|
||||
rc != LDAP_TIMELIMIT_EXCEEDED )
|
||||
|
@ -28,11 +28,6 @@
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
#if LDAP_VERSION < LDAP_VERSION3
|
||||
/* quick fix until we have ldap_set_options */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
|
||||
#include "disptmpl.h"
|
||||
|
||||
#include "ldapconfig.h"
|
||||
@ -165,8 +160,12 @@ static do_query()
|
||||
perror( "ldap_open" );
|
||||
exit( 1 );
|
||||
}
|
||||
ld->ld_sizelimit = FINGER_SIZELIMIT;
|
||||
ld->ld_deref = deref;
|
||||
|
||||
{
|
||||
int limit = FINGER_SIZELIMIT;
|
||||
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &limit);
|
||||
}
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
|
||||
if ( ldap_simple_bind_s( ld, FINGER_BINDDN, FINGER_BIND_CRED )
|
||||
!= LDAP_SUCCESS )
|
||||
@ -258,6 +257,7 @@ char *buf;
|
||||
char **title;
|
||||
int rc, matches, i, ufn;
|
||||
struct timeval tv;
|
||||
LDAPFiltDesc *fd;
|
||||
LDAPFiltInfo *fi;
|
||||
LDAPMessage *result, *e;
|
||||
static char *attrs[] = { "cn", "title", "objectClass", "joinable",
|
||||
@ -286,16 +286,16 @@ char *buf;
|
||||
ufn = 1;
|
||||
} else {
|
||||
#endif
|
||||
if ( (ld->ld_filtd = ldap_init_getfilter( filterfile ))
|
||||
if ( (fd = ldap_init_getfilter( filterfile ))
|
||||
== NULL ) {
|
||||
fprintf( stderr, "Cannot open filter file (%s)\n",
|
||||
filterfile );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
for ( fi = ldap_getfirstfilter( ld->ld_filtd, "finger", buf );
|
||||
for ( fi = ldap_getfirstfilter( fd, "finger", buf );
|
||||
fi != NULL;
|
||||
fi = ldap_getnextfilter( ld->ld_filtd ) )
|
||||
fi = ldap_getnextfilter( fd ) )
|
||||
{
|
||||
tv.tv_sec = FINGER_TIMEOUT;
|
||||
tv.tv_usec = 0;
|
||||
|
@ -3,14 +3,15 @@
|
||||
##
|
||||
PROGRAMS= go500gw go500
|
||||
|
||||
SRCS= detach.c go500.c go500gw.c setproctitle.c
|
||||
SRCS= detach.c go500.c go500gw.c
|
||||
XSRCS= gwversion.o goversion.o
|
||||
GOOBJS = go500.o detach.o setproctitle.o
|
||||
GWOBJS = go500gw.o detach.o setproctitle.o
|
||||
GOOBJS = go500.o detach.o
|
||||
GWOBJS = go500gw.o detach.o
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
||||
XLIBS = -llutil @LUTIL_LIBS@
|
||||
|
||||
go500 : goversion.o
|
||||
$(CC) $(LDFLAGS) -o $@ $(GOOBJS) goversion.o $(LIBS)
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#include <ac/setproctitle.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
@ -32,11 +34,7 @@
|
||||
#include "ldapconfig.h"
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
#if LDAP_VERSION < LDAP_VERSION3
|
||||
/* quick fix until we have ldap_set_options */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
#include "ldap_log.h"
|
||||
|
||||
#include "disptmpl.h"
|
||||
|
||||
@ -83,12 +81,12 @@ char **argv;
|
||||
int fromlen;
|
||||
RETSIGTYPE wait4child();
|
||||
extern char *optarg;
|
||||
extern char **Argv;
|
||||
extern int Argc;
|
||||
|
||||
#if defined( LDAP_PROCTITLE ) && !defined( HAVE_SETPROCTITLE )
|
||||
/* for setproctitle */
|
||||
Argv = argv;
|
||||
Argc = argc;
|
||||
Argv = argv;
|
||||
Argc = argc;
|
||||
#endif
|
||||
|
||||
while ( (i = getopt( argc, argv, "b:d:f:lp:c:t:x:I" )) != EOF ) {
|
||||
switch( i ) {
|
||||
@ -201,8 +199,10 @@ char **argv;
|
||||
inet_ntoa( from.sin_addr ) );
|
||||
}
|
||||
|
||||
#ifdef LDAP_PROCTITLE
|
||||
setproctitle( hp == NULL ? inet_ntoa( from.sin_addr ) :
|
||||
hp->h_name );
|
||||
#endif
|
||||
}
|
||||
|
||||
do_queries( 0 );
|
||||
@ -387,7 +387,11 @@ int s;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
ld->ld_deref = GO500_DEREF;
|
||||
{
|
||||
int deref = GO500_DEREF;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
}
|
||||
|
||||
if ( (rc = ldap_simple_bind_s( ld, GO500_BINDDN, GO500_BIND_CRED ))
|
||||
!= LDAP_SUCCESS ) {
|
||||
fprintf(fp,
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#include <ac/setproctitle.h>
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
@ -31,11 +33,7 @@
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
#if LDAP_VERSION < LDAP_VERSION3
|
||||
/* quick fix until we have ldap_set_options */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
#include "ldap_log.h"
|
||||
|
||||
#include "disptmpl.h"
|
||||
|
||||
@ -91,12 +89,12 @@ char **argv;
|
||||
int fromlen;
|
||||
RETSIGTYPE wait4child();
|
||||
extern char *optarg;
|
||||
extern char **Argv;
|
||||
extern int Argc;
|
||||
|
||||
#if defined( LDAP_PROCTITLE ) && !defined( HAVE_SETPROCTITLE )
|
||||
/* for setproctitle */
|
||||
Argv = argv;
|
||||
Argc = argc;
|
||||
Argv = argv;
|
||||
Argc = argc;
|
||||
#endif
|
||||
|
||||
while ( (i = getopt( argc, argv, "P:ad:f:h:lp:t:x:Ic:" )) != EOF ) {
|
||||
switch( i ) {
|
||||
@ -223,8 +221,10 @@ char **argv;
|
||||
inet_ntoa( from.sin_addr ) );
|
||||
}
|
||||
|
||||
#ifdef LDAP_PROCTITLE
|
||||
setproctitle( hp == NULL ? inet_ntoa( from.sin_addr ) :
|
||||
hp->h_name );
|
||||
#endif
|
||||
}
|
||||
|
||||
do_queries( 0 );
|
||||
@ -355,6 +355,7 @@ int s;
|
||||
int len;
|
||||
FILE *fp;
|
||||
int rc;
|
||||
int deref;
|
||||
struct timeval timeout;
|
||||
fd_set readfds;
|
||||
LDAP *ld;
|
||||
@ -432,9 +433,11 @@ int s;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
ld->ld_deref = LDAP_DEREF_ALWAYS;
|
||||
deref = LDAP_DEREF_ALWAYS;
|
||||
if ( !searchaliases )
|
||||
ld->ld_deref = LDAP_DEREF_FINDING;
|
||||
deref = LDAP_DEREF_FINDING;
|
||||
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
|
||||
if ( (rc = ldap_simple_bind_s( ld, GO500GW_BINDDN, NULL ))
|
||||
!= LDAP_SUCCESS ) {
|
||||
@ -521,14 +524,16 @@ char *dn;
|
||||
struct timeval timeout;
|
||||
LDAPMessage *res = NULL;
|
||||
static char *attrs[] = { "objectClass", 0 };
|
||||
int sizelimit = 1;
|
||||
|
||||
timeout.tv_sec = GO500GW_TIMEOUT;
|
||||
timeout.tv_usec = 0;
|
||||
ld->ld_sizelimit = 1;
|
||||
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &sizelimit);
|
||||
if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_ONELEVEL,
|
||||
"(objectClass=*)", attrs, 0, &timeout, &res ))
|
||||
== LDAP_SUCCESS || rc == LDAP_SIZELIMIT_EXCEEDED ) {
|
||||
ld->ld_sizelimit = LDAP_NO_LIMIT;
|
||||
sizelimit = LDAP_NO_LIMIT;
|
||||
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &sizelimit);
|
||||
|
||||
numentries = ldap_count_entries( ld, res );
|
||||
if ( res != NULL )
|
||||
@ -584,10 +589,13 @@ char *dn;
|
||||
struct timeval timeout;
|
||||
FriendlyMap *fm = NULL;
|
||||
static char *attrs[] = { "objectClass", 0 };
|
||||
int deref = LDAP_DEREF_FINDING;
|
||||
|
||||
timeout.tv_sec = GO500GW_TIMEOUT;
|
||||
timeout.tv_usec = 0;
|
||||
ld->ld_deref = LDAP_DEREF_FINDING;
|
||||
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
|
||||
if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_ONELEVEL,
|
||||
"(!(objectClass=dSA))", attrs, 0, &timeout, &res )) != LDAP_SUCCESS
|
||||
&& rc != LDAP_SIZELIMIT_EXCEEDED ) {
|
||||
@ -595,7 +603,9 @@ char *dn;
|
||||
rc, myhost, myport );
|
||||
return;
|
||||
}
|
||||
ld->ld_deref = LDAP_DEREF_ALWAYS;
|
||||
|
||||
deref = LDAP_DEREF_ALWAYS;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
|
||||
if ( ldap_count_entries( ld, res ) < 1 ) {
|
||||
return;
|
||||
@ -699,6 +709,7 @@ LDAP *ld;
|
||||
FILE *fp;
|
||||
char *query;
|
||||
{
|
||||
int deref;
|
||||
int scope;
|
||||
char *base, *filter;
|
||||
char *filtertype;
|
||||
@ -722,7 +733,9 @@ char *query;
|
||||
timeout.tv_sec = GO500GW_TIMEOUT;
|
||||
timeout.tv_usec = 0;
|
||||
ldap_ufn_timeout( (void *) &timeout );
|
||||
ld->ld_deref = LDAP_DEREF_FINDING;
|
||||
|
||||
deref = LDAP_DEREF_FINDING;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
|
||||
if ( (rc = ldap_ufn_search_s( ld, filter, attrs, 0, &res ))
|
||||
!= LDAP_SUCCESS && rc != LDAP_SIZELIMIT_EXCEEDED ) {
|
||||
@ -742,8 +755,9 @@ char *query;
|
||||
|
||||
filtertype = (scope == LDAP_SCOPE_ONELEVEL ?
|
||||
"go500gw onelevel" : "go500gw subtree");
|
||||
ld->ld_deref = (scope == LDAP_SCOPE_ONELEVEL ?
|
||||
deref = (scope == LDAP_SCOPE_ONELEVEL ?
|
||||
LDAP_DEREF_FINDING : LDAP_DEREF_ALWAYS);
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
timeout.tv_sec = GO500GW_TIMEOUT;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
@ -768,7 +782,8 @@ char *query;
|
||||
if ( (count = ldap_count_entries( ld, res )) != 0 )
|
||||
break;
|
||||
}
|
||||
ld->ld_deref = LDAP_DEREF_ALWAYS;
|
||||
deref = LDAP_DEREF_ALWAYS;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
ldap_getfilter_free( filtd );
|
||||
#ifdef GO500GW_UFN
|
||||
}
|
||||
@ -847,9 +862,12 @@ char *dn;
|
||||
if ( ldap_entry2text_search( ld, dn, NULL, NULL, tmpllist, NULL, NULL,
|
||||
entry2textwrite,(void *) fp, "\r\n", rdncount, 0 )
|
||||
!= LDAP_SUCCESS ) {
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
|
||||
fprintf(fp,
|
||||
"0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
|
||||
ld->ld_errno, myhost, myport );
|
||||
ld_errno, myhost, myport );
|
||||
}
|
||||
|
||||
if ( tmpllist != NULL ) {
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1990,1991 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that this notice is preserved and that due credit is given
|
||||
* to the University of Michigan at Ann Arbor. The name of the University
|
||||
* may not be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
char **Argv; /* pointer to original (main's) argv */
|
||||
int Argc; /* original argc */
|
||||
|
||||
/*
|
||||
* takes a printf-style format string (fmt) and up to three parameters (a,b,c)
|
||||
* this clobbers the original argv...
|
||||
*/
|
||||
|
||||
/* VARARGS */
|
||||
setproctitle( fmt, a, b, c )
|
||||
char *fmt;
|
||||
char *a, *b, *c;
|
||||
{
|
||||
static char *endargv = (char *)0;
|
||||
char *s;
|
||||
int i;
|
||||
char buf[ 1024 ];
|
||||
|
||||
if ( endargv == (char *)0 ) {
|
||||
/* set pointer to end of original argv */
|
||||
endargv = Argv[ Argc-1 ] + strlen( Argv[ Argc-1 ] );
|
||||
}
|
||||
sprintf( buf, fmt, a, b, c );
|
||||
/* make ps print "([prog name])" */
|
||||
s = Argv[0];
|
||||
*s++ = '-';
|
||||
i = strlen( buf );
|
||||
if ( i > endargv - s - 2 ) {
|
||||
i = endargv - s - 2;
|
||||
buf[ i ] = '\0';
|
||||
}
|
||||
strcpy( s, buf );
|
||||
s += i;
|
||||
while ( s < endargv ) *s++ = ' ';
|
||||
}
|
@ -31,11 +31,6 @@
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
#if LDAP_VERSION < LDAP_VERSION3
|
||||
/* quick fix until we have ldap_set_options */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
|
||||
#include "ldapconfig.h"
|
||||
|
||||
#define USER 0x01
|
||||
@ -345,12 +340,17 @@ char **argv;
|
||||
|
||||
connect_to_x500()
|
||||
{
|
||||
int opt;
|
||||
|
||||
if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
|
||||
syslog( LOG_ALERT, "ldap_open failed" );
|
||||
return( -1 );
|
||||
}
|
||||
ld->ld_sizelimit = MAIL500_MAXAMBIGUOUS;
|
||||
ld->ld_deref = LDAP_DEREF_ALWAYS;
|
||||
|
||||
opt = MAIL500_MAXAMBIGUOUS;
|
||||
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &opt);
|
||||
opt = LDAP_DEREF_ALWAYS;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &opt);
|
||||
|
||||
if ( ldap_simple_bind_s( ld, MAIL500_BINDDN, NULL ) != LDAP_SUCCESS ) {
|
||||
syslog( LOG_ALERT, "ldap_simple_bind_s failed" );
|
||||
@ -774,6 +774,7 @@ do_group_members( e, dn, to, nto, togroups, ngroups, err, nerr )
|
||||
char filter[1024];
|
||||
LDAPMessage *ee, *res;
|
||||
struct timeval timeout;
|
||||
int opt;
|
||||
|
||||
/*
|
||||
* if all has gone according to plan, we've already arranged for
|
||||
@ -832,7 +833,8 @@ do_group_members( e, dn, to, nto, togroups, ngroups, err, nerr )
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
/* for each subtree to look in... */
|
||||
ld->ld_sizelimit = MAIL500_MAXGROUPMEMBERS;
|
||||
opt = MAIL500_MAXAMBIGUOUS;
|
||||
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &opt);
|
||||
for ( i = 0; base[i].b_dn != NULL; i++ ) {
|
||||
/* find entries that have joined this group... */
|
||||
rc = ldap_search_st( ld, base[i].b_dn,
|
||||
@ -892,7 +894,8 @@ do_group_members( e, dn, to, nto, togroups, ngroups, err, nerr )
|
||||
|
||||
ldap_msgfree( res );
|
||||
}
|
||||
ld->ld_sizelimit = MAIL500_MAXAMBIGUOUS;
|
||||
opt = MAIL500_MAXAMBIGUOUS;
|
||||
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &opt);
|
||||
}
|
||||
|
||||
if ( ! anymembers ) {
|
||||
|
@ -18,11 +18,6 @@
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
|
||||
#if LDAP_VERSION < LDAP_VERSION3
|
||||
/* quick fix until we have ldap_set_options */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
|
||||
#include "disptmpl.h"
|
||||
|
||||
#include "rcpt500.h"
|
||||
@ -56,7 +51,7 @@ query_cmd( msgp, reply )
|
||||
LDAP *ldp;
|
||||
LDAPMessage *ldmsgp, *entry;
|
||||
char *s, *dn;
|
||||
int matches, rc, ufn;
|
||||
int matches, rc, ld_errno, ufn;
|
||||
LDAPFiltDesc *lfdp;
|
||||
LDAPFiltInfo *lfi;
|
||||
struct ldap_disptmpl *tmpllist = NULL;
|
||||
@ -113,8 +108,8 @@ query_cmd( msgp, reply )
|
||||
/*
|
||||
* set options for search and build filter
|
||||
*/
|
||||
ldp->ld_deref = derefaliases;
|
||||
ldp->ld_sizelimit = sizelimit;
|
||||
ldap_set_option(ldp, LDAP_OPT_DEREF, &derefaliases);
|
||||
ldap_set_option(ldp, LDAP_OPT_SIZELIMIT, &sizelimit);
|
||||
|
||||
matches = 0;
|
||||
|
||||
@ -179,8 +174,11 @@ query_cmd( msgp, reply )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
if ( ldp->ld_errno == LDAP_TIMELIMIT_EXCEEDED
|
||||
|| ldp->ld_errno == LDAP_SIZELIMIT_EXCEEDED ) {
|
||||
ld_errno = 0;
|
||||
ldap_get_option(ldp, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
|
||||
if ( ld_errno == LDAP_TIMELIMIT_EXCEEDED
|
||||
|| ld_errno == LDAP_SIZELIMIT_EXCEEDED ) {
|
||||
strcat( reply, "(Partial results only - a limit was exceeded)\n" );
|
||||
}
|
||||
|
||||
@ -339,8 +337,11 @@ report_ldap_err( ldp, reply )
|
||||
LDAP *ldp;
|
||||
char *reply;
|
||||
{
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ldp, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
|
||||
strcat( reply, errpreface );
|
||||
strcat( reply, ldap_err2string( ldp->ld_errno ));
|
||||
strcat( reply, ldap_err2string( ld_errno ));
|
||||
strcat( reply, "\n" );
|
||||
}
|
||||
|
||||
|
@ -168,10 +168,8 @@ main( int argc, char **argv )
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
#if LDAP_VERSION > LDAP_VERSION2
|
||||
/* this seems prudent */
|
||||
ldap_set_option( LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
|
||||
#endif
|
||||
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
|
||||
|
||||
if ( !kerberos ) {
|
||||
authmethod = LDAP_AUTH_SIMPLE;
|
||||
|
@ -131,10 +131,8 @@ main( argc, argv )
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
#if LDAP_VERSION > LDAP_VERSION2
|
||||
/* this seems prudent */
|
||||
ldap_set_option( LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
|
||||
#endif
|
||||
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
|
||||
|
||||
if ( !kerberos ) {
|
||||
authmethod = LDAP_AUTH_SIMPLE;
|
||||
|
@ -11,11 +11,6 @@
|
||||
#include <ldap.h>
|
||||
#include <ldif.h>
|
||||
|
||||
#if LDAP_VERSION == LDAP_VERSION2
|
||||
/* until we implement ldap_set_options() */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
|
||||
#include "ldapconfig.h"
|
||||
|
||||
#define DEFSEP "="
|
||||
@ -98,7 +93,7 @@ char **argv;
|
||||
char *infile, *filtpattern, **attrs, line[ BUFSIZ ];
|
||||
FILE *fp;
|
||||
int rc, i, first, scope, kerberos, deref, attrsonly;
|
||||
int ldap_options, timelimit, sizelimit, authmethod;
|
||||
int referrals, timelimit, sizelimit, authmethod;
|
||||
LDAP *ld;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
@ -106,11 +101,7 @@ char **argv;
|
||||
infile = NULL;
|
||||
deref = verbose = allow_binary = not = kerberos = vals2tmp =
|
||||
attrsonly = ldif = 0;
|
||||
#ifdef LDAP_REFERRALS
|
||||
ldap_options = LDAP_OPT_REFERRALS;
|
||||
#else /* LDAP_REFERRALS */
|
||||
ldap_options = 0;
|
||||
#endif /* LDAP_REFERRALS */
|
||||
referrals = (int) LDAP_OPT_ON;
|
||||
sizelimit = timelimit = 0;
|
||||
scope = LDAP_SCOPE_SUBTREE;
|
||||
|
||||
@ -150,12 +141,7 @@ char **argv;
|
||||
++vals2tmp;
|
||||
break;
|
||||
case 'R': /* don't automatically chase referrals */
|
||||
#ifdef LDAP_REFERRALS
|
||||
ldap_options &= ~LDAP_OPT_REFERRALS;
|
||||
#else /* LDAP_REFERRALS */
|
||||
fprintf( stderr,
|
||||
"compile with -DLDAP_REFERRALS for referral support\n" );
|
||||
#endif /* LDAP_REFERRALS */
|
||||
referrals = (int) LDAP_OPT_OFF;
|
||||
break;
|
||||
case 'A': /* retrieve attribute names only -- no values */
|
||||
++attrsonly;
|
||||
@ -270,10 +256,18 @@ char **argv;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
ld->ld_deref = deref;
|
||||
ld->ld_timelimit = timelimit;
|
||||
ld->ld_sizelimit = sizelimit;
|
||||
ld->ld_options = ldap_options;
|
||||
if (ldap_set_option( ld, LDAP_OPT_DEREF, (void *) &deref ) == -1 ) {
|
||||
/* set option error */
|
||||
}
|
||||
if (ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) == -1 ) {
|
||||
/* set option error */
|
||||
}
|
||||
if (ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) == -1 ) {
|
||||
/* set option error */
|
||||
}
|
||||
if (ldap_set_option( ld, LDAP_OPT_REFERRALS, (void *) referrals ) == -1 ) {
|
||||
/* set option error */
|
||||
}
|
||||
|
||||
if ( !kerberos ) {
|
||||
authmethod = LDAP_AUTH_SIMPLE;
|
||||
@ -349,7 +343,11 @@ static int dosearch(
|
||||
|
||||
if ( ldap_search( ld, base, scope, filter, attrs, attrsonly ) == -1 ) {
|
||||
ldap_perror( ld, "ldap_search" );
|
||||
return( ld->ld_errno );
|
||||
#ifdef HAVE_LDERRNO
|
||||
return( ldap_lderrno(ld) );
|
||||
#else
|
||||
return( -1 );
|
||||
#endif
|
||||
}
|
||||
|
||||
matches = 0;
|
||||
|
@ -240,9 +240,11 @@ int implicit;
|
||||
ldap_flush_cache( ld );
|
||||
rc = ldap_bind_s(ld, Entry.DN, passwd, authmethod);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
if (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
|
||||
int ld_errno;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if (ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
|
||||
fprintf(stderr, " Entry has no password\n");
|
||||
else if (ld->ld_errno == LDAP_INVALID_CREDENTIALS)
|
||||
else if (ld_errno == LDAP_INVALID_CREDENTIALS)
|
||||
#ifdef HAVE_KERBEROS
|
||||
if ( authmethod == LDAP_AUTH_KRBV4 ) {
|
||||
fprintf(stderr, " The Kerberos credentials are invalid.\n");
|
||||
|
@ -38,6 +38,7 @@ char *dn;
|
||||
{
|
||||
LDAPMessage *results;
|
||||
static char *attrs[2] = { "objectClass", NULL };
|
||||
int ld_errno = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
@ -46,9 +47,12 @@ char *dn;
|
||||
/* verify that this DN exists in the directory */
|
||||
(void) ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "objectClass=*", attrs, TRUE, &results);
|
||||
(void) ldap_msgfree(results);
|
||||
if ((ld->ld_errno == LDAP_NO_SUCH_OBJECT) || (ld->ld_errno == LDAP_INVALID_DN_SYNTAX))
|
||||
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
|
||||
if ((ld_errno == LDAP_NO_SUCH_OBJECT) || (ld_errno == LDAP_INVALID_DN_SYNTAX))
|
||||
return(0);
|
||||
else if (ld->ld_errno == LDAP_SUCCESS)
|
||||
else if (ld_errno == LDAP_SUCCESS)
|
||||
return(1);
|
||||
else {
|
||||
ldap_perror(ld, "ldap_search");
|
||||
@ -69,6 +73,7 @@ char *who;
|
||||
char response[SMALL_BUF_SIZE]; /* results from user */
|
||||
char *name = NULL; /* DN to lookup */
|
||||
LDAPMessage *mp;
|
||||
int ld_errno = 0;
|
||||
extern void Free();
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -76,11 +81,14 @@ char *who;
|
||||
printf("->disambiguate(%x, %d, %x, %s)\n", result, matches,
|
||||
read_attrs, who);
|
||||
#endif
|
||||
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
|
||||
/*
|
||||
* If we are here, it means that we got back multiple answers.
|
||||
*/
|
||||
if ((ld->ld_errno == LDAP_TIMELIMIT_EXCEEDED)
|
||||
|| (ld->ld_errno == LDAP_SIZELIMIT_EXCEEDED)) {
|
||||
if ((ld_errno == LDAP_TIMELIMIT_EXCEEDED)
|
||||
|| (ld_errno == LDAP_SIZELIMIT_EXCEEDED)) {
|
||||
if (verbose) {
|
||||
printf(" Your query was too general and a limit was exceeded. The results listed\n");
|
||||
printf(" are not complete. You may want to try again with a more refined query.\n\n");
|
||||
@ -206,39 +214,43 @@ int quiet;
|
||||
* here. If we don't find it, treat it as NOT a UFN.
|
||||
*/
|
||||
if (strchr(who, ',') != NULL) {
|
||||
int savederef;
|
||||
int savederef, deref;
|
||||
#ifdef DEBUG
|
||||
if (debug & D_FIND)
|
||||
printf("\"%s\" appears to be a UFN\n", who);
|
||||
#endif
|
||||
savederef = ld->ld_deref;
|
||||
ld->ld_deref = LDAP_DEREF_FINDING;
|
||||
ldap_get_option(ld, LDAP_OPT_DEREF, &savederef);
|
||||
deref = LDAP_DEREF_FINDING;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
|
||||
if ((rc = ldap_ufn_search_s(ld, who, search_attrs, FALSE, &res)) !=
|
||||
LDAP_SUCCESS && rc != LDAP_SIZELIMIT_EXCEEDED &&
|
||||
rc != LDAP_TIMELIMIT_EXCEEDED) {
|
||||
ldap_perror(ld, "ldap_ufn_search_s");
|
||||
ld->ld_deref = savederef;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
|
||||
return(NULL);
|
||||
}
|
||||
if ((matches = ldap_count_entries(ld, res)) < 0) {
|
||||
ldap_perror(ld, "ldap_count_entries");
|
||||
ld->ld_deref = savederef;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
|
||||
return(NULL);
|
||||
} else if (matches == 1) {
|
||||
if (ldap_search_s(ld, ldap_get_dn(ld, ldap_first_entry(ld, res)), LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res) != LDAP_SUCCESS) {
|
||||
if (ld->ld_errno == LDAP_UNAVAILABLE)
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if (ld_errno == LDAP_UNAVAILABLE)
|
||||
printf(" Could not contact the LDAP server to find \"%s\".\n", who);
|
||||
else
|
||||
ldap_perror(ld, "ldap_search_s");
|
||||
return(NULL);
|
||||
}
|
||||
ld->ld_deref = savederef;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
|
||||
return(res);
|
||||
} else if (matches > 1 ) {
|
||||
return( disambiguate( ld, res, matches, read_attrs,
|
||||
who ) );
|
||||
}
|
||||
ld->ld_deref = savederef;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -419,7 +431,9 @@ char *group;
|
||||
|
||||
sprintf(filter, "%s=%s", "memberOfGroup", group);
|
||||
if (ldap_search_s(ld, search_base, LDAP_SCOPE_SUBTREE, filter, attributes, FALSE, &result) != LDAP_SUCCESS) {
|
||||
if (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if (ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
|
||||
return(0);
|
||||
ldap_perror(ld, "ldap_search_s");
|
||||
return(0);
|
||||
@ -461,7 +475,9 @@ struct attribute attr;
|
||||
#endif
|
||||
attributes[0] = attr.quipu_name;
|
||||
if (ldap_search_s(ld, who, LDAP_SCOPE_BASE, "objectClass=*", attributes, FALSE, &result) != LDAP_SUCCESS) {
|
||||
if (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if (ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
|
||||
return("FALSE");
|
||||
ldap_perror(ld, "ldap_search_s");
|
||||
ldap_msgfree(result);
|
||||
|
@ -235,7 +235,9 @@ char *name;
|
||||
* Now remove this from the LDAP Directory.
|
||||
*/
|
||||
if (ldap_delete_s(ld, dn) != 0) {
|
||||
if (ld->ld_errno == LDAP_INSUFFICIENT_ACCESS)
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if (ld_errno == LDAP_INSUFFICIENT_ACCESS)
|
||||
printf(" You do not own the group \"%s\".\n", name);
|
||||
else
|
||||
ldap_perror(ld, " ldap_delete_s");
|
||||
@ -326,9 +328,11 @@ char *name;
|
||||
#endif
|
||||
|
||||
if (ldap_modify_s(ld, bound_dn, mods)) {
|
||||
if ((action == G_JOIN) && (ld->ld_errno == LDAP_TYPE_OR_VALUE_EXISTS))
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if ((action == G_JOIN) && (ld_errno == LDAP_TYPE_OR_VALUE_EXISTS))
|
||||
printf(" You are already subscribed to \"%s\"\n", group_name);
|
||||
else if ((action == G_RESIGN) && (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE))
|
||||
else if ((action == G_RESIGN) && (ld_errno == LDAP_NO_SUCH_ATTRIBUTE))
|
||||
printf(" You are not subscribed to \"%s\"\n", group_name);
|
||||
else
|
||||
mod_perror(ld);
|
||||
@ -928,7 +932,9 @@ int offset;
|
||||
#endif
|
||||
|
||||
if (my_ldap_modify_s(ld, group, mods)) {
|
||||
if (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE) {
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if (ld_errno == LDAP_NO_SUCH_ATTRIBUTE) {
|
||||
printf(" Could not locate value \"%s\"\n",
|
||||
new_value);
|
||||
continue;
|
||||
@ -987,7 +993,9 @@ int offset;
|
||||
* A "No such attribute" error is no big deal.
|
||||
* We only wanted to clear the attribute anyhow.
|
||||
*/
|
||||
if (ld->ld_errno != LDAP_NO_SUCH_ATTRIBUTE) {
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if (ld_errno != LDAP_NO_SUCH_ATTRIBUTE) {
|
||||
mod_perror(ld);
|
||||
return;
|
||||
}
|
||||
|
@ -255,11 +255,14 @@ do_commands()
|
||||
printf(" Verbose mode has been turned on.\n");
|
||||
}
|
||||
else if (!strncasecmp("dereference", cmd, strlen(cmd))) {
|
||||
int deref;
|
||||
dereference = 1 - dereference;
|
||||
if (dereference == 1)
|
||||
ld->ld_deref = LDAP_DEREF_ALWAYS;
|
||||
else
|
||||
ld->ld_deref = LDAP_DEREF_NEVER;
|
||||
if (dereference == 1) {
|
||||
deref = LDAP_DEREF_ALWAYS;
|
||||
} else {
|
||||
deref = LDAP_DEREF_NEVER;
|
||||
}
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, (void *) &deref);
|
||||
}
|
||||
else if (!strncasecmp("tidy", cmd, strlen(cmd)))
|
||||
tidy_up();
|
||||
@ -282,15 +285,22 @@ status()
|
||||
{
|
||||
void printbase();
|
||||
register char **rdns;
|
||||
char *host;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug & D_TRACE)
|
||||
printf("->status()\n");
|
||||
#endif
|
||||
printf(" Current server is %s", server);
|
||||
if ( ld != NULL && ld->ld_host != NULL && strcasecmp( ld->ld_host,
|
||||
server ) != 0 )
|
||||
printf( " (%s)", ld->ld_host );
|
||||
if ( ld != NULL ) {
|
||||
char *host = NULL;
|
||||
|
||||
ldap_get_option(ld, LDAP_OPT_HOST_NAME, &host);
|
||||
|
||||
if (( host != NULL ) && (strcasecmp( host, server ) != 0 )) {
|
||||
printf( " (%s)", host );
|
||||
}
|
||||
}
|
||||
putchar( '\n' );
|
||||
printbase(" Search base is ", search_base);
|
||||
printbase(" Group base is ", group_base);
|
||||
@ -303,7 +313,10 @@ status()
|
||||
}
|
||||
printf( " Verbose mode is %sabled\n", ( verbose ? "en" : "dis" ));
|
||||
if ( ld != NULL ) {
|
||||
printf( " Aliases are %sbeing dereferenced\n", ( ld->ld_deref == LDAP_DEREF_ALWAYS ) ? "" : "not" );
|
||||
int deref = LDAP_DEREF_NEVER;
|
||||
ldap_get_option(ld, LDAP_OPT_DEREF, &deref);
|
||||
printf( " Aliases are %sbeing dereferenced\n",
|
||||
( deref == LDAP_DEREF_ALWAYS ) ? "" : "not" );
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,8 +432,10 @@ char **base, *s;
|
||||
* type a number at that point too.
|
||||
*/
|
||||
if (ldap_search_s(ld, *base, LDAP_SCOPE_ONELEVEL, "(|(objectClass=quipuNonLeafObject)(objectClass=externalNonLeafObject))", attrs, FALSE, &mp) != LDAP_SUCCESS) {
|
||||
if ((ld->ld_errno == LDAP_TIMELIMIT_EXCEEDED) ||
|
||||
(ld->ld_errno == LDAP_SIZELIMIT_EXCEEDED)) {
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
if ((ld_errno == LDAP_TIMELIMIT_EXCEEDED) ||
|
||||
(ld_errno == LDAP_SIZELIMIT_EXCEEDED)) {
|
||||
if (verbose) {
|
||||
printf(" Your query was too general and a limit was exceeded. The results listed\n");
|
||||
printf(" are not complete. You may want to try again with a more refined query.\n\n");
|
||||
@ -626,13 +641,19 @@ initialize_client()
|
||||
}
|
||||
if (ldap_bind_s(ld, (char *) default_bind_object, (char *) UD_BIND_CRED,
|
||||
LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
|
||||
fprintf(stderr, " The LDAP Directory is temporarily unavailable. Please try again later.\n");
|
||||
if (ld->ld_errno != LDAP_UNAVAILABLE)
|
||||
if (ld_errno != LDAP_UNAVAILABLE)
|
||||
ldap_perror(ld, " ldap_bind_s");
|
||||
exit(0);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
ld->ld_deref = LDAP_DEREF_ALWAYS;
|
||||
{
|
||||
int deref = LDAP_DEREF_ALWAYS;
|
||||
ldap_set_option(ld, LDAP_OPT_DEREF, (void *) &deref);
|
||||
}
|
||||
bind_status = UD_NOT_BOUND;
|
||||
if ( default_bind_object != NULL ) {
|
||||
bound_dn = strdup(default_bind_object);
|
||||
|
@ -52,6 +52,7 @@ char *who;
|
||||
static char printed_warning = 0; /* for use with the */
|
||||
struct attribute no_batch_update_attr;
|
||||
extern char * fetch_boolean_value();
|
||||
int ld_errno;
|
||||
#endif
|
||||
int is_a_group; /* TRUE if it is; FALSE otherwise */
|
||||
extern void Free();
|
||||
@ -111,7 +112,10 @@ char *who;
|
||||
*/
|
||||
no_batch_update_attr.quipu_name = "noBatchUpdates";
|
||||
(void) fetch_boolean_value(dn, no_batch_update_attr);
|
||||
if (verbose && !printed_warning && (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)) {
|
||||
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
|
||||
if (verbose && !printed_warning && (ld_errno == LDAP_NO_SUCH_ATTRIBUTE)) {
|
||||
printed_warning = 1;
|
||||
printf("\n WARNING!\n");
|
||||
printf(" You are about to make a modification to an LDAP entry\n");
|
||||
@ -799,15 +803,22 @@ char *url;
|
||||
|
||||
mod_perror( LDAP *ld )
|
||||
{
|
||||
if ( ld == NULL || ( ld->ld_errno != LDAP_UNAVAILABLE &&
|
||||
ld->ld_errno != LDAP_UNWILLING_TO_PERFORM )) {
|
||||
int ld_errno = 0;
|
||||
|
||||
if(ld != NULL) {
|
||||
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
}
|
||||
|
||||
if (( ld == NULL ) || ( ld_errno != LDAP_UNAVAILABLE &&
|
||||
ld_errno != LDAP_UNWILLING_TO_PERFORM ))
|
||||
{
|
||||
ldap_perror( ld, "modify" );
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf( stderr, "\n modify: failed because part of the online directory is not able\n" );
|
||||
fprintf( stderr, " to be modified right now" );
|
||||
if ( ld->ld_errno == LDAP_UNAVAILABLE ) {
|
||||
if ( ld_errno == LDAP_UNAVAILABLE ) {
|
||||
fprintf( stderr, " or is temporarily unavailable" );
|
||||
}
|
||||
fprintf( stderr, ".\n Please try again later.\n" );
|
||||
|
@ -12,11 +12,6 @@
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#if LDAP_VERSION < LDAP_VERSION3
|
||||
/* quick fix until we have ldap_set_options */
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
#endif
|
||||
|
||||
#ifdef DOS
|
||||
#define MAX_VALUES 8
|
||||
#else
|
||||
|
@ -24,32 +24,42 @@ LDAP_BEGIN_DECL
|
||||
#define LDAP_VERSION LDAP_VERSION2
|
||||
#define LDAP_VERSION_MAX LDAP_VERSION2
|
||||
|
||||
/*
|
||||
* We'll use 2000+draft revision for our API version number
|
||||
* As such, the number will be above the old RFC but below
|
||||
* whatever number does finally get assigned
|
||||
*/
|
||||
#define LDAP_API_VERSION 2001
|
||||
#define LDAP_VENDOR "OpenLDAP"
|
||||
/* We'll eventually release as 200 */
|
||||
#define LDAP_VENDOR_VERSION 190
|
||||
|
||||
#define LDAP_COMPAT20
|
||||
#define LDAP_COMPAT30
|
||||
#if defined(LDAP_COMPAT20) || defined(LDAP_COMPAT30)
|
||||
#define LDAP_COMPAT
|
||||
#endif
|
||||
|
||||
#define LDAP_OPT_API_INFO 0x00
|
||||
#define LDAP_OPT_DESC 0x01
|
||||
#define LDAP_OPT_DEREF 0x02
|
||||
#define LDAP_OPT_SIZELIMIT 0x03
|
||||
#define LDAP_OPT_TIMELIMIT 0x04
|
||||
#define LDAP_OPT_REFERRALS 0x08
|
||||
#define LDAP_OPT_RESTART 0x09
|
||||
#define LDAP_OPT_PROTOCOL_VERSION 0x11
|
||||
#define LDAP_OPT_SERVER_CONTROLS 0x12
|
||||
#define LDAP_OPT_CLIENT_CONTROLS 0x13
|
||||
#define LDAP_OPT_HOST_NAME 0x30
|
||||
#define LDAP_OPT_ERROR_NUMBER 0x31
|
||||
#define LDAP_OPT_ERROR_STRING 0x32
|
||||
#define LDAP_OPT_API_INFO 0x0000
|
||||
#define LDAP_OPT_DESC 0x0001
|
||||
#define LDAP_OPT_DEREF 0x0002
|
||||
#define LDAP_OPT_SIZELIMIT 0x0003
|
||||
#define LDAP_OPT_TIMELIMIT 0x0004
|
||||
#define LDAP_OPT_REFERRALS 0x0008
|
||||
#define LDAP_OPT_RESTART 0x0009
|
||||
#define LDAP_OPT_PROTOCOL_VERSION 0x0011
|
||||
#define LDAP_OPT_SERVER_CONTROLS 0x0012
|
||||
#define LDAP_OPT_CLIENT_CONTROLS 0x0013
|
||||
#define LDAP_OPT_HOST_NAME 0x0030
|
||||
#define LDAP_OPT_ERROR_NUMBER 0x0031
|
||||
#define LDAP_OPT_ERROR_STRING 0x0032
|
||||
|
||||
/* for LDAPv2 compatibility */
|
||||
#define LDAP_OPT_DNS 0x40 /* use DN & DNS */
|
||||
#define LDAP_OPT_DNS 0x0101 /* use DN & DNS */
|
||||
|
||||
/* on/off values */
|
||||
#define LDAP_OPT_ON ((void *) 1)
|
||||
#define LDAP_OPT_OFF ((void *)) 0)
|
||||
#define LDAP_OPT_OFF ((void *) 0)
|
||||
|
||||
#define LDAP_OPT_SUCCESS 0
|
||||
#define LDAP_OPT_ERROR (-1)
|
||||
@ -61,7 +71,7 @@ typedef struct ldapapiinfo {
|
||||
int ldapai_api_version; /* revision of API supported */
|
||||
int ldapai_protocol_version; /* highest LDAP version supported */
|
||||
char **ldapai_extensions; /* names of API extensions */
|
||||
char *ldapi_vendor_name; /* name of supplier */
|
||||
char *ldapai_vendor_name; /* name of supplier */
|
||||
int ldapai_vendor_version; /* supplier-specific version times 100 */
|
||||
} LDAPAPIInfo;
|
||||
|
||||
@ -448,9 +458,8 @@ typedef struct ldap_url_desc {
|
||||
#define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */
|
||||
#define LDAP_URL_ERR_MEM 4 /* can't allocate memory space */
|
||||
|
||||
/* this typedef is never used, only exists to rid of declaration
|
||||
in function param list warning */
|
||||
typedef struct timeval LDAPtv;
|
||||
/* avoid pulling in headers */
|
||||
struct timeval;
|
||||
|
||||
LDAP_F int ldap_get_option LDAP_P((LDAP *ld, int option, void *outvalue));
|
||||
LDAP_F int ldap_set_option LDAP_P((LDAP *ld, int option, void *invalue));
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined( HAVE_STDARG_H ) && __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
@ -367,7 +370,7 @@ ber_next_element( BerElement *ber, unsigned long *len, char *last )
|
||||
/* VARARGS */
|
||||
unsigned long
|
||||
ber_scanf
|
||||
#ifdef STDC_HEADERS
|
||||
#if defined( HAVE_STDARG_H ) && __STDC__
|
||||
( BerElement *ber, char *fmt, ... )
|
||||
#else
|
||||
( va_alist )
|
||||
@ -375,7 +378,7 @@ va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#ifndef STDC_HEADERS
|
||||
#if !(defined( HAVE_STDARG_H ) && __STDC__)
|
||||
BerElement *ber;
|
||||
char *fmt;
|
||||
#endif
|
||||
@ -386,7 +389,7 @@ va_dcl
|
||||
long *l, rc, tag;
|
||||
unsigned long len;
|
||||
|
||||
#if STDC_HEADERS
|
||||
#if defined( HAVE_STDARG_H ) && __STDC__
|
||||
va_start( ap, fmt );
|
||||
#else
|
||||
va_start( ap );
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#if defined( HAVE_STDARG_H ) && __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
@ -509,7 +509,7 @@ ber_put_set( BerElement *ber )
|
||||
/* VARARGS */
|
||||
int
|
||||
ber_printf
|
||||
#ifdef STDC_HEADERS
|
||||
#if defined( HAVE_STDARG_H ) && __STDC__
|
||||
( BerElement *ber, char *fmt, ... )
|
||||
#else
|
||||
( va_alist )
|
||||
@ -517,7 +517,7 @@ va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#ifndef STDC_HEADERS
|
||||
#if !(defined( HAVE_STDARG_H ) && __STDC__)
|
||||
BerElement *ber;
|
||||
char *fmt;
|
||||
#endif
|
||||
@ -526,7 +526,7 @@ va_dcl
|
||||
int rc, i;
|
||||
unsigned long len;
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#if defined( HAVE_STDARG_H ) && __STDC__
|
||||
va_start( ap, fmt );
|
||||
#else
|
||||
va_start( ap );
|
||||
|
@ -13,13 +13,15 @@ SRCS = bind.c open.c result.c error.c compare.c search.c \
|
||||
getfilter.c sbind.c kbind.c unbind.c friendly.c cldap.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
|
||||
request.c getdxbyname.c os-ip.c url.c charset.c \
|
||||
init.c options.c
|
||||
OBJS = bind.o open.o result.o error.o compare.o search.o \
|
||||
modify.o add.o modrdn.o delete.o abandon.o ufn.o cache.o \
|
||||
getfilter.o sbind.o kbind.o unbind.o friendly.o cldap.o \
|
||||
free.o disptmpl.o srchpref.o dsparse.o tmplout.o sort.o \
|
||||
getdn.o getentry.o getattr.o getvalues.o addentry.o \
|
||||
request.o getdxbyname.o os-ip.o url.o charset.o
|
||||
request.o getdxbyname.o os-ip.o url.o charset.o \
|
||||
init.o options.o
|
||||
|
||||
LIBS = -L$(LDAP_LIBDIR) -lldap -llber $(AC_LIBS)
|
||||
LIBLBER = ../liblber/liblber.a
|
||||
|
23
libraries/libldap/init.c
Normal file
23
libraries/libldap/init.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
struct ldap openldap_ld_globals;
|
||||
|
||||
int openldap_ldap_initialized = 0;
|
||||
|
||||
void openldap_ldap_initialize( void )
|
||||
{
|
||||
if ( openldap_ldap_initialized ) {
|
||||
return;
|
||||
}
|
||||
|
||||
openldap_ldap_initialized = 1;
|
||||
}
|
@ -30,6 +30,17 @@ LDAP_BEGIN_DECL
|
||||
#endif /* LDAP_DNS */
|
||||
#endif /* LDAP_REFERRALS */
|
||||
|
||||
#define LDAP_BOOL_REFERRALS 0
|
||||
#define LDAP_BOOL_RESTART 1
|
||||
#define LDAP_BOOL_DNS 2
|
||||
|
||||
#define LDAP_BOOL(n) (1 << (n))
|
||||
#define LDAP_BOOL_GET(ld, bool) ((ld)->ld_booleans & LDAP_BOOL(bool) \
|
||||
? LDAP_OPT_ON : LDAP_OPT_OFF)
|
||||
#define LDAP_BOOL_SET(ld, bool) ((ld)->ld_booleans |= LDAP_BOOL(bool))
|
||||
#define LDAP_BOOL_CLR(ld, bool) ((ld)->ld_booleans &= ~LDAP_BOOL(bool))
|
||||
#define LDAP_BOOL_ZERO(ld) ((ld)->ld_booleans = 0)
|
||||
|
||||
/*
|
||||
* This structure represents both ldap messages and ldap responses.
|
||||
* These are really the same, except in the case of search responses,
|
||||
@ -82,7 +93,7 @@ struct ldap {
|
||||
int ld_cldaptries; /* connectionless search retry count */
|
||||
int ld_cldaptimeout;/* time between retries */
|
||||
int ld_refhoplimit; /* limit on referral nesting */
|
||||
unsigned long ld_options; /* boolean options */
|
||||
unsigned long ld_booleans; /* boolean options */
|
||||
|
||||
/* do not mess with the rest though */
|
||||
char *ld_defhost; /* full name of default server */
|
||||
@ -99,6 +110,14 @@ struct ldap {
|
||||
#endif /* LDAP_REFERRALS */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* in init.c
|
||||
*/
|
||||
extern int openldap_ldap_initialized;
|
||||
extern struct ldap openldap_ld_globals;
|
||||
void openldap_ldap_initialize LDAP_P((void));
|
||||
|
||||
/*
|
||||
* in cache.c
|
||||
*/
|
||||
|
@ -148,8 +148,12 @@ ldap_init( char *defhost, int defport )
|
||||
WSACleanup( );
|
||||
return( NULL );
|
||||
}
|
||||
ld->ld_options = LDAP_OPT_REFERRALS;
|
||||
#endif /* LDAP_REFERRALS */
|
||||
|
||||
LDAP_BOOL_ZERO(ld);
|
||||
LDAP_BOOL_SET(ld, LDAP_BOOL_REFERRALS);
|
||||
#else
|
||||
LDAP_BOOL_ZERO(ld);
|
||||
#endif
|
||||
|
||||
if ( defhost != NULL &&
|
||||
( ld->ld_defhost = strdup( defhost )) == NULL ) {
|
||||
@ -168,7 +172,7 @@ ldap_init( char *defhost, int defport )
|
||||
ld->ld_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT;
|
||||
|
||||
#ifdef LDAP_REFERRALS
|
||||
ld->ld_options |= LDAP_OPT_REFERRALS;
|
||||
LDAP_BOOL_SET(ld, LDAP_BOOL_REFERRALS);
|
||||
#endif /* LDAP_REFERRALS */
|
||||
|
||||
#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
|
||||
|
197
libraries/libldap/options.c
Normal file
197
libraries/libldap/options.c
Normal file
@ -0,0 +1,197 @@
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
int
|
||||
ldap_get_option(
|
||||
LDAP *ldp,
|
||||
int option,
|
||||
void *outvalue)
|
||||
{
|
||||
LDAP *ld;
|
||||
|
||||
if(!openldap_ldap_initialized) {
|
||||
openldap_ldap_initialize();
|
||||
}
|
||||
|
||||
if(outvalue == NULL) {
|
||||
/* no place to get to */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(ldp == NULL) {
|
||||
ld = &openldap_ld_globals;
|
||||
} else {
|
||||
ld = ld;
|
||||
}
|
||||
|
||||
switch(option) {
|
||||
case LDAP_OPT_API_INFO: {
|
||||
struct ldapapiinfo *info = (struct ldapapiinfo *) outvalue;
|
||||
|
||||
if(info == NULL) {
|
||||
/* outvalue must point to an apiinfo structure */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(info->ldapai_info_version != 1) {
|
||||
/* version mismatch */
|
||||
return -1;
|
||||
}
|
||||
|
||||
info->ldapai_api_version = LDAP_API_VERSION;
|
||||
info->ldapai_protocol_version = LDAP_VERSION_MAX;
|
||||
info->ldapai_extensions = NULL;
|
||||
info->ldapai_vendor_name = strdup(LDAP_VENDOR);
|
||||
info->ldapai_vendor_version = LDAP_VENDOR_VERSION;
|
||||
|
||||
return 0;
|
||||
} break;
|
||||
|
||||
case LDAP_OPT_DESC:
|
||||
if(ldp == NULL) {
|
||||
/* bad param */
|
||||
break;
|
||||
}
|
||||
|
||||
* (int *) outvalue = ld->ld_sb.sb_sd;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_DEREF:
|
||||
* (int *) outvalue = ld->ld_deref;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_SIZELIMIT:
|
||||
* (int *) outvalue = ld->ld_sizelimit;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_TIMELIMIT:
|
||||
* (int *) outvalue = ld->ld_timelimit;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_REFERRALS:
|
||||
* (int *) outvalue = (int) LDAP_BOOL_GET(ld, LDAP_BOOL_REFERRALS);
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_RESTART:
|
||||
* (int *) outvalue = (int) LDAP_BOOL_GET(ld, LDAP_BOOL_RESTART);
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_DNS: /* LDAPv2 */
|
||||
* (int *) outvalue = (int) LDAP_BOOL_GET(ld, LDAP_BOOL_DNS);
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_PROTOCOL_VERSION:
|
||||
* (int *) outvalue = ld->ld_version;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_SERVER_CONTROLS:
|
||||
case LDAP_OPT_CLIENT_CONTROLS:
|
||||
/* not yet supported */
|
||||
break;
|
||||
|
||||
case LDAP_OPT_HOST_NAME:
|
||||
* (char **) outvalue = ld->ld_host;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_ERROR_NUMBER:
|
||||
* (int *) outvalue = ld->ld_errno;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_ERROR_STRING:
|
||||
/* not yet supported */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* bad param */
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_set_option(
|
||||
LDAP *ldp,
|
||||
int option,
|
||||
void *invalue)
|
||||
{
|
||||
LDAP *ld;
|
||||
|
||||
if(!openldap_ldap_initialized) {
|
||||
openldap_ldap_initialize();
|
||||
}
|
||||
|
||||
if(invalue == NULL) {
|
||||
/* no place to set from */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(ldp == NULL) {
|
||||
ld = &openldap_ld_globals;
|
||||
} else {
|
||||
ld = ld;
|
||||
}
|
||||
|
||||
switch(option) {
|
||||
case LDAP_OPT_API_INFO:
|
||||
case LDAP_OPT_DESC:
|
||||
/* READ ONLY */
|
||||
break;
|
||||
|
||||
case LDAP_OPT_DEREF:
|
||||
ld->ld_deref = * (int *) invalue;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_SIZELIMIT:
|
||||
ld->ld_sizelimit = * (int *) invalue;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_TIMELIMIT:
|
||||
ld->ld_timelimit = * (int *) invalue;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_REFERRALS:
|
||||
if((int) invalue == (int) LDAP_OPT_ON) {
|
||||
LDAP_BOOL_SET(ld, LDAP_BOOL_REFERRALS);
|
||||
} else {
|
||||
LDAP_BOOL_CLR(ld, LDAP_BOOL_REFERRALS);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_RESTART:
|
||||
if((int) invalue == (int) LDAP_OPT_ON) {
|
||||
LDAP_BOOL_SET(ld, LDAP_BOOL_RESTART);
|
||||
} else {
|
||||
LDAP_BOOL_CLR(ld, LDAP_BOOL_RESTART);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_PROTOCOL_VERSION: {
|
||||
int vers = * (int *) invalue;
|
||||
if (vers > LDAP_VERSION_MAX) {
|
||||
/* not supported */
|
||||
break;
|
||||
}
|
||||
ld->ld_version = vers;
|
||||
} return 0;
|
||||
|
||||
case LDAP_OPT_SERVER_CONTROLS:
|
||||
case LDAP_OPT_CLIENT_CONTROLS:
|
||||
case LDAP_OPT_HOST_NAME:
|
||||
case LDAP_OPT_ERROR_NUMBER:
|
||||
case LDAP_OPT_ERROR_STRING:
|
||||
/* not yet supported */
|
||||
break;
|
||||
default:
|
||||
/* bad param */
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
@ -168,8 +168,9 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
|
||||
if ( ld->ld_sb.sb_ber.ber_ptr >= ld->ld_sb.sb_ber.ber_end ) {
|
||||
rc = ldap_select1( ld, tvp );
|
||||
|
||||
if ( rc == 0 || ( rc == -1 && (( ld->ld_options &
|
||||
LDAP_OPT_RESTART ) == 0 || errno != EINTR ))) {
|
||||
if ( rc == 0 || ( rc == -1 && (
|
||||
(LDAP_BOOL_GET(ld, LDAP_BOOL_RESTART) = LDAP_OPT_OFF)
|
||||
|| errno != EINTR ))) {
|
||||
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
|
||||
LDAP_TIMEOUT);
|
||||
return( rc );
|
||||
@ -209,8 +210,9 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( rc == 0 || ( rc == -1 && (( ld->ld_options &
|
||||
LDAP_OPT_RESTART ) == 0 || errno != EINTR ))) {
|
||||
if ( rc == 0 || ( rc == -1 && (
|
||||
(LDAP_BOOL_GET(ld, LDAP_BOOL_RESTART) == LDAP_OPT_OFF)
|
||||
|| errno != EINTR ))) {
|
||||
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
|
||||
LDAP_TIMEOUT);
|
||||
return( rc );
|
||||
@ -326,7 +328,7 @@ read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
|
||||
if ( tag != LDAP_RES_SEARCH_ENTRY ) {
|
||||
if ( ld->ld_version >= LDAP_VERSION2 &&
|
||||
( lr->lr_parent != NULL ||
|
||||
( ld->ld_options & LDAP_OPT_REFERRALS ) != 0 )) {
|
||||
(LDAP_BOOL_GET(ld, LDAP_BOOL_REFERRALS) != LDAP_OPT_OFF))) {
|
||||
tmpber = ber; /* struct copy */
|
||||
if ( ber_scanf( &tmpber, "{iaa}", &lderr,
|
||||
&lr->lr_res_matched, &lr->lr_res_error )
|
||||
|
@ -750,7 +750,7 @@ main( int argc, char **argv )
|
||||
getline( line, sizeof(line), stdin, "sizelimit?" );
|
||||
ld->ld_sizelimit = atoi( line );
|
||||
|
||||
ld->ld_options = 0;
|
||||
LDAP_BOOL_ZERO(ld);
|
||||
|
||||
#ifdef STR_TRANSLATION
|
||||
getline( line, sizeof(line), stdin,
|
||||
@ -775,7 +775,7 @@ main( int argc, char **argv )
|
||||
getline( line, sizeof(line), stdin,
|
||||
"Use DN & DNS to determine where to send requests (0=no, 1=yes)?" );
|
||||
if ( atoi( line ) != 0 ) {
|
||||
ld->ld_options |= LDAP_OPT_DNS;
|
||||
LDAP_BOOL_SET(ld, LDAP_BOOL_DNS);
|
||||
}
|
||||
#endif /* LDAP_DNS */
|
||||
|
||||
@ -783,7 +783,7 @@ main( int argc, char **argv )
|
||||
getline( line, sizeof(line), stdin,
|
||||
"Recognize and chase referrals (0=no, 1=yes)?" );
|
||||
if ( atoi( line ) != 0 ) {
|
||||
ld->ld_options |= LDAP_OPT_REFERRALS;
|
||||
LDAP_BOOL_SET(ld, LDAP_BOOL_REFERRALS);
|
||||
getline( line, sizeof(line), stdin,
|
||||
"Prompt for bind credentials when chasing referrals (0=no, 1=yes)?" );
|
||||
if ( atoi( line ) != 0 ) {
|
||||
|
@ -17,10 +17,12 @@
|
||||
#endif
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap-int.h"
|
||||
#include "ldap.h"
|
||||
|
||||
#include "ldap_log.h"
|
||||
#include "disptmpl.h"
|
||||
|
||||
#include "ldap-int.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
static int do_entry2text LDAP_P((
|
||||
|
@ -29,6 +29,10 @@
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#ifdef LDAP_PROCTITLE
|
||||
#include <ac/setproctitle.h>
|
||||
#endif
|
||||
|
||||
#include <quipu/commonarg.h>
|
||||
#include <quipu/ds_error.h>
|
||||
|
||||
@ -113,10 +117,8 @@ char **argv;
|
||||
int dsapargc;
|
||||
char **dsapargv;
|
||||
RETSIGTYPE wait4child();
|
||||
#ifndef NOSETPROCTITLE
|
||||
#ifdef LDAP_PROCTITLE
|
||||
char title[80];
|
||||
extern char **Argv;
|
||||
extern int Argc;
|
||||
#endif
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
@ -243,7 +245,7 @@ char **argv;
|
||||
}
|
||||
#endif /* FD_SETSIZE */
|
||||
|
||||
#ifndef NOSETPROCTITLE
|
||||
#if defined(LDAP_PROCTITLE) && !defined( HAVE_SETPROCTITLE )
|
||||
/* for setproctitle */
|
||||
Argv = argv;
|
||||
Argc = argc;
|
||||
@ -260,7 +262,7 @@ char **argv;
|
||||
* that have exited
|
||||
*/
|
||||
if (!RunFromInetd) {
|
||||
#ifndef NOSETPROCTITLE
|
||||
#ifdef LDAP_SETPROCTITLE
|
||||
setproctitle( "initializing" );
|
||||
#endif
|
||||
#ifndef VMS
|
||||
@ -330,7 +332,7 @@ char **argv;
|
||||
inet_ntoa( from.sin_addr ) );
|
||||
}
|
||||
|
||||
#ifndef NOSETPROCTITLE
|
||||
#ifdef LDAP_SETPROCTITLE
|
||||
sprintf( title, "%s %d\n", hp == NULL ?
|
||||
inet_ntoa( from.sin_addr ) : hp->h_name, myport );
|
||||
setproctitle( title );
|
||||
@ -355,7 +357,7 @@ char **argv;
|
||||
* if we are doing CLDAP as well, handle those requests on the fly
|
||||
*/
|
||||
|
||||
#ifndef NOSETPROCTITLE
|
||||
#ifdef LDAP_SETPROCTITLE
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
sprintf( title, "listening %s/%s %d", do_tcp ? "tcp" : "",
|
||||
do_udp ? "udp" : "", myport );
|
||||
@ -436,7 +438,7 @@ char **argv;
|
||||
#ifdef VMS
|
||||
/* This is for debug on terminal on VMS */
|
||||
close( tcps );
|
||||
#ifndef NOSETPROCTITLE
|
||||
#ifdef LDAP_SETPROCTITLE
|
||||
setproctitle( hp == NULL ? inet_ntoa( from.sin_addr ) :
|
||||
hp->h_name );
|
||||
#endif
|
||||
@ -450,7 +452,7 @@ char **argv;
|
||||
switch( pid = fork() ) {
|
||||
case 0: /* child */
|
||||
close( tcps );
|
||||
#ifndef NOSETPROCTITLE
|
||||
#ifdef LDAP_SETPROCTITLE
|
||||
sprintf( title, "%s (%d)\n", hp == NULL ?
|
||||
inet_ntoa( from.sin_addr ) : hp->h_name,
|
||||
myport );
|
||||
|
@ -1,50 +0,0 @@
|
||||
#include "portable.h"
|
||||
|
||||
#ifndef NOSETPROCTITLE
|
||||
/*
|
||||
* Copyright (c) 1990,1991 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that this notice is preserved and that due credit is given
|
||||
* to the University of Michigan at Ann Arbor. The name of the University
|
||||
* may not be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
char **Argv; /* pointer to original (main's) argv */
|
||||
int Argc; /* original argc */
|
||||
|
||||
/*
|
||||
* takes a printf-style format string (fmt) and up to three parameters (a,b,c)
|
||||
* this clobbers the original argv...
|
||||
*/
|
||||
|
||||
/* VARARGS */
|
||||
setproctitle( fmt, a, b, c )
|
||||
char *fmt;
|
||||
{
|
||||
static char *endargv = (char *)0;
|
||||
char *s;
|
||||
int i;
|
||||
char buf[ 1024 ];
|
||||
|
||||
if ( endargv == (char *)0 ) {
|
||||
/* set pointer to end of original argv */
|
||||
endargv = Argv[ Argc-1 ] + strlen( Argv[ Argc-1 ] );
|
||||
}
|
||||
sprintf( buf, fmt, a, b, c );
|
||||
/* make ps print "([prog name])" */
|
||||
s = Argv[0];
|
||||
*s++ = '-';
|
||||
i = strlen( buf );
|
||||
if ( i > endargv - s - 2 ) {
|
||||
i = endargv - s - 2;
|
||||
buf[ i ] = '\0';
|
||||
}
|
||||
strcpy( s, buf );
|
||||
s += i;
|
||||
while ( s < endargv ) *s++ = ' ';
|
||||
}
|
||||
#endif /* NOSETPROCTITLE */
|
@ -15,12 +15,10 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "avl.h"
|
||||
#include "lber.h"
|
||||
#include "../../libraries/liblber/lber-int.h"
|
||||
#include "ldap.h"
|
||||
#include "ldap_log.h"
|
||||
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
|
||||
#include "lthread.h"
|
||||
#include "lthread_rdwr.h"
|
||||
#include "ldif.h"
|
||||
|
@ -194,7 +194,9 @@ op_ldap_add(
|
||||
Debug( LDAP_DEBUG_ARGS, "replica %s:%d - add dn \"%s\"\n",
|
||||
ri->ri_hostname, ri->ri_port, re->re_dn );
|
||||
rc = ldap_add_s( ri->ri_ldp, re->re_dn, ldmarr );
|
||||
lderr = ri->ri_ldp->ld_errno;
|
||||
|
||||
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
|
||||
|
||||
} else {
|
||||
*errmsg = "No modifications to do";
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
@ -362,6 +364,7 @@ op_ldap_modrdn(
|
||||
int rc = 0;
|
||||
Mi *mi;
|
||||
int i;
|
||||
int lderr = 0;
|
||||
int state = 0;
|
||||
int drdnflag = -1;
|
||||
char *newrdn;
|
||||
@ -429,7 +432,8 @@ op_ldap_modrdn(
|
||||
/* Do the modrdn */
|
||||
rc = ldap_modrdn2_s( ri->ri_ldp, re->re_dn, mi->mi_val, drdnflag );
|
||||
|
||||
return( ri->ri_ldp->ld_errno );
|
||||
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
|
||||
return( lderr );
|
||||
}
|
||||
|
||||
|
||||
@ -622,10 +626,8 @@ do_bind(
|
||||
* Set ldap library options to (1) not follow referrals, and
|
||||
* (2) restart the select() system call.
|
||||
*/
|
||||
#ifdef LDAP_REFERRALS
|
||||
ri->ri_ldp->ld_options &= ~LDAP_OPT_REFERRALS;
|
||||
#endif /* LDAP_REFERRALS */
|
||||
ri->ri_ldp->ld_options |= LDAP_OPT_RESTART;
|
||||
ldap_set_option(ri->ri_ldp, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
|
||||
ldap_set_option(ri->ri_ldp, LDAP_OPT_RESTART, LDAP_OPT_ON);
|
||||
|
||||
switch ( ri->ri_bind_method ) {
|
||||
case AUTH_KERBEROS:
|
||||
|
@ -99,14 +99,16 @@ Ri_process(
|
||||
re->re_dn, ri->ri_hostname, ri->ri_port );
|
||||
continue;
|
||||
break;
|
||||
case DO_LDAP_ERR_FATAL:
|
||||
case DO_LDAP_ERR_FATAL: {
|
||||
/* Non-retryable error. Write rejection log. */
|
||||
write_reject( ri, re, ri->ri_ldp->ld_errno, errmsg );
|
||||
int ld_errno = 0;
|
||||
ldap_get_option(ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &ld_errno);
|
||||
write_reject( ri, re, ld_errno, errmsg );
|
||||
/* Update status ... */
|
||||
(void) sglob->st->st_update( sglob->st, ri->ri_stel, re );
|
||||
/* ... and write to disk */
|
||||
(void) sglob->st->st_write( sglob->st );
|
||||
break;
|
||||
} break;
|
||||
default:
|
||||
/* LDAP op completed ok - update status... */
|
||||
(void) sglob->st->st_update( sglob->st, ri->ri_stel, re );
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "ldap_log.h"
|
||||
#include "../libraries/libldap/ldap-int.h"
|
||||
|
||||
#include "lthread.h"
|
||||
#include "ldapconfig.h"
|
||||
#include "ldif.h"
|
||||
|
Loading…
Reference in New Issue
Block a user