* 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.
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 );
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 );
* 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 $
*
*/
LDAP *ld;
char tstring[100];
+#if OL_LDAPV > 0
+ int ldap_opt;
+#endif
+
/* get time for performance log */
gettimeofday(×tore[2], NULL);
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 */
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
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
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 ))
* 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 $
*
*/
#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;
* 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 $
*
*/
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
-
-extern LDAPFriendlyMap *fm;
-
-# else
+#if OL_LDAPV >= 2
extern LDAPFriendlyMap *fm;
-# endif
#else
extern FriendlyMap *fm;
* 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 $
*
*/
#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
-
-LDAPFriendlyMap *fm = NULL;
-
-# else
+#if OL_LDAPV >= 2
LDAPFriendlyMap *fm = NULL;
-# endif
#else
FriendlyMap *fm = NULL;
* 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 $
*
*/
int count;
char *ufn;
+#if OL_LDAPV > 0
+ int ldap_opt;
+#endif
+
if(!attrs)
attrs = (char**) charray_dup(sattrs);
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
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
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
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);
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;
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));
}
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
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;
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