Adopt TWEB to LDAP_API_VERSION >= 2003.

This commit is contained in:
Kurt Spanier 1999-09-13 16:28:30 +00:00
parent ae88439eab
commit 681a146fe8
6 changed files with 99 additions and 82 deletions

View file

@ -16,21 +16,27 @@
* Creation date: Z D D V V *
* April 24 1996 Z D D V V *
* Last modification: Z D D V V *
* December 14 1996 ZZZZ DDD V *
* September 13 1999 ZZZZ DDD V *
* *
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
/*
* $Id: dn.c,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
* $Id: dn.c,v 1.8 1999/09/13 13:47:44 zrnsk01 Exp $
*
*/
/* dn.c - routines for dealing with distinguished names */
#include "tgeneral.h"
#include "tglobal.h"
#include "strng_exp.h"
#include "dn.h"
#if OL_LDAPV == 2
#define LDAP_DEBUG_ANY 0xffff
#endif
/*
* dn_normalize - put dn into a canonical format. the dn is
* normalized in place, as well as returned.
@ -119,10 +125,7 @@ char *dn;
break;
default:
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
# define LDAP_DEBUG_ANY 0xffff
#if OL_LDAPV >= 2
if ( ldap_debug & LDAP_DEBUG_ANY )
fprintf( stderr, "dn_normalize - unknown state %d\n", state );
@ -131,7 +134,6 @@ char *dn;
syslog( ldap_syslog_level,
"dn_normalize - unknown state %d\n", state );
# endif
#else
Debug( LDAP_DEBUG_ANY,
"dn_normalize - unknown state %d\n", state, 0, 0 );

View file

@ -15,12 +15,12 @@
* Creation date: Z D D V V *
* August 16 1995 Z D D V V *
* Last modification: Z D D V V *
* May 11 1999 ZZZZ DDD V *
* September 13 1999 ZZZZ DDD V *
* *
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
/*
* $Id: queries.c,v 1.6 1999/09/10 15:01:18 zrnsk01 Exp $
* $Id: queries.c,v 1.8 1999/09/13 13:47:47 zrnsk01 Exp $
*
*/
@ -43,6 +43,10 @@ struct hostent *hp;
LDAP *ld;
char tstring[100];
#if OL_LDAPV > 0
int ldap_opt;
#endif
/* get time for performance log */
gettimeofday(&timestore[2], NULL);
@ -85,7 +89,13 @@ struct hostent *hp;
len = strlen( buf );
if ( debug ) {
fprintf( stderr, "got %d bytes\n", len );
#if OL_LDAPV > 2
ber_bprint( buf, len );
#else
lber_bprint( buf, len );
#endif
}
/* strip of white spaces */
@ -309,23 +319,21 @@ struct hostent *hp;
rewind(fp);
/* follow aliases while searching */
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS );
ldap_opt = LDAP_DEREF_ALWAYS;
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = LDAP_DEREF_ALWAYS;
#endif
if ( !searchaliases )
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_FINDING );
ldap_opt = LDAP_DEREF_FINDING;
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = LDAP_DEREF_FINDING;
#endif
@ -376,32 +384,29 @@ struct hostent *hp;
glob->svc_cnt);
/* accesses with resolvation of alias-entries */
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS );
ldap_opt = LDAP_DEREF_ALWAYS;
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = LDAP_DEREF_ALWAYS;
#endif
if ( !searchaliases )
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_FINDING );
ldap_opt = LDAP_DEREF_FINDING;
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = LDAP_DEREF_FINDING;
#endif
/* bind to DSA by order of the user as Web-DN
(if with DN1 or DN2 was decided at check4access) */
(DN1 or DN2 was decided at check4access) */
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
/* a dummy call as long as socket connections are not settled
* with OpenLDAP
@ -409,12 +414,6 @@ struct hostent *hp;
if ( dosyslog )
syslog( LOG_INFO, "do_queries(): calling ldap_simple_bind_s()...\n" );
# else
if ( dosyslog )
syslog( LOG_INFO, "do_queries(): calling ldap_simple_bind_s()...\n" );
# endif
#endif
if ( (rc=ldap_simple_bind_s( ld, glob->webdn, glob->webpw ))

View file

@ -14,12 +14,12 @@
* Creation date: Z D D V V *
* August 16 1995 Z D D V V *
* Last modification: Z D D V V *
* May 14 1999 ZZZZ DDD V *
* September 13 1999 ZZZZ DDD V *
* *
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
/*
* $Id: tgeneral.h,v 1.6 1999/09/10 15:01:20 zrnsk01 Exp $
* $Id: tgeneral.h,v 1.8 1999/09/13 13:47:47 zrnsk01 Exp $
*
*/
@ -68,6 +68,24 @@ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
#include <stdlib.h>
#include <unistd.h>
/* Support of LDAP API versions */
#if LDAP_API_VERSION >= 2003 && LDAP_API_VERSION <= 2010
#define OL_LDAPV 3
#else
# if LDAP_API_VERSION >= 2001 && LDAP_API_VERSION <= 2010
# define OL_LDAPV 2
# else
# define OL_LDAPV 0
# endif
#endif
# define ldap_debug debug
#if OL_LDAPV > 2
# include "portable.h"
# include "ldap_log.h"
#endif
extern int errno;

View file

@ -13,12 +13,12 @@
* Creation date: Z D D V V *
* August 16 1996 Z D D V V *
* Last modification: Z D D V V *
* December 29 1998 ZZZZ DDD V *
* September 13 1999 ZZZZ DDD V *
* *
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
/*
* $Id: tglobal.h,v 1.6 1999/09/10 15:01:20 zrnsk01 Exp $
* $Id: tglobal.h,v 1.8 1999/09/13 13:47:47 zrnsk01 Exp $
*
*/
@ -32,21 +32,18 @@ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
extern int debug;
extern int dosyslog;
extern int ldap_syslog;
extern int ldap_syslog_level;
extern struct timeval timestore[];
extern int items_displayed;
extern int searchaliases;
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV >= 2
extern LDAPFriendlyMap *fm;
# else
extern LDAPFriendlyMap *fm;
# endif
#else
extern FriendlyMap *fm;

View file

@ -14,12 +14,12 @@
* Creation date: Z D D V V *
* August 16 1995 Z D D V V *
* Last modification: Z D D V V *
* December 31 1998 ZZZZ DDD V *
* September 13 1999 ZZZZ DDD V *
* *
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
/*
* $Id: tweb.h,v 1.6 1999/09/10 15:01:20 zrnsk01 Exp $
* $Id: tweb.h,v 1.8 1999/09/13 13:47:47 zrnsk01 Exp $
*
*/
@ -34,23 +34,20 @@ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
#include "support_exp.h"
PRIVATE void do_child();
int debug;
int debug = 0;
int ldap_syslog = 0;
int ldap_syslog_level = 0;
int dosyslog = 0;
GLOB_STRUCT *globP;
int searchaliases = 1;
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV >= 2
LDAPFriendlyMap *fm = NULL;
# else
LDAPFriendlyMap *fm = NULL;
# endif
#else
FriendlyMap *fm = NULL;

View file

@ -15,12 +15,12 @@
* Creation date: Z D D V V *
* August 16 1995 Z D D V V *
* Last modification: Z D D V V *
* September 10 1999 ZZZZZ DDD V *
* September 13 1999 ZZZZZ DDD V *
* *
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
/*
* $Id: x500.c,v 1.8 1999/09/10 15:01:20 zrnsk01 Exp $
* $Id: x500.c,v 1.10 1999/09/13 13:47:48 zrnsk01 Exp $
*
*/
@ -143,6 +143,10 @@ GLOB_STRUCT *glob;
int count;
char *ufn;
#if OL_LDAPV > 0
int ldap_opt;
#endif
if(!attrs)
attrs = (char**) charray_dup(sattrs);
@ -162,12 +166,11 @@ GLOB_STRUCT *glob;
timeout.tv_sec = glob->timeout;
timeout.tv_usec = 0;
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS );
ldap_opt = LDAP_DEREF_FINDING;
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = LDAP_DEREF_FINDING;
#endif
@ -182,12 +185,11 @@ GLOB_STRUCT *glob;
if (rc == LDAP_SIZELIMIT_EXCEEDED) glob->persRestricted = TRUE;
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS );
ldap_opt = LDAP_DEREF_ALWAYS;
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = LDAP_DEREF_ALWAYS;
#endif
@ -348,6 +350,10 @@ GLOB_STRUCT *glob;
char *ufn;
char title[BUFSIZ], title2[BUFSIZ];
#if OL_LDAPV > 0
int ldap_opt;
#endif
glob->no_browse = FALSE;
/* query string: base-DN?[OS]=filter
@ -384,14 +390,12 @@ GLOB_STRUCT *glob;
filtertype = (scope == LDAP_SCOPE_ONELEVEL ? "web500gw onelevel" :
"web500gw subtree");
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF,
scope == LDAP_SCOPE_ONELEVEL ? LDAP_DEREF_FINDING :
LDAP_DEREF_ALWAYS );
ldap_opt = ( scope == LDAP_SCOPE_ONELEVEL ? LDAP_DEREF_FINDING :
LDAP_DEREF_ALWAYS );
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = (scope == LDAP_SCOPE_ONELEVEL ? LDAP_DEREF_FINDING :
LDAP_DEREF_ALWAYS);
@ -408,8 +412,7 @@ GLOB_STRUCT *glob;
if (dosyslog) {
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
int ld_errno;
@ -417,7 +420,6 @@ GLOB_STRUCT *glob;
syslog (LOG_INFO, "ldap_search_st(): %s",
ldap_err2string ( ld_errno ));
# endif
#else
syslog (LOG_INFO, "ldap_search_st(): %s",
ldap_err2string (ld->ld_errno));
@ -437,12 +439,11 @@ GLOB_STRUCT *glob;
}
items_displayed = count;
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS );
ldap_opt = LDAP_DEREF_ALWAYS;
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = LDAP_DEREF_ALWAYS;
#endif
@ -1660,6 +1661,10 @@ GLOB_STRUCT *glob;
char *url = NULL;
char **uri = NULL, *urlnola, raw_string[BUFSIZ];
#if OL_LDAPV > 0
int ldap_opt;
#endif
oc = ldap_get_values( ld, e, "objectClass" );
if(!(aoc = make_oc_to_string(oc))) return;
@ -1816,12 +1821,11 @@ GLOB_STRUCT *glob;
timeout.tv_sec = glob->timeout;
timeout.tv_usec = 0;
#if defined LDAP_VENDOR_NAME && defined LDAP_API_VERSION
# if LDAP_API_VERSION > 2001 && LDAP_API_VERSION < 2010
#if OL_LDAPV > 0
ldap_set_option( ld, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS );
ldap_opt = LDAP_DEREF_ALWAYS;
ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
# endif
#else
ld->ld_deref = LDAP_DEREF_ALWAYS;
#endif