Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/tools/ldclt
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25697
Modified Files:
ldapfct.c ldclt.c ldclt.h scalab01.c utils.c
Log Message:
Resolves: 294301
Summary: Don't try to dlopen ldap SSL libs in ldclt.
Index: ldapfct.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/tools/ldclt/ldapfct.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ldapfct.c 7 Sep 2007 19:49:51 -0000 1.5
+++ ldapfct.c 19 Sep 2007 18:08:12 -0000 1.6
@@ -256,6 +256,7 @@
#include <sasl.h>
#include "ldaptool-sasl.h"
+#include <ldap_ssl.h> /* ldapssl_init(), etc... */
@@ -668,8 +669,7 @@
* LDAP session initialization in SSL mode
* added by: B Kolics (11/10/00)
*/
- tttctx->ldapCtx = (LDAP *)(*(mctx.sslctx.ldapssl_init)) /*JLS 07-11-00*/
- (mctx.hostname, mctx.port, 1);
+ tttctx->ldapCtx = ldapssl_init(mctx.hostname, mctx.port, 1);
if (mctx.mode & VERY_VERBOSE)
printf ("ldclt[%d]: T%03d: After ldapssl_init (%s, %d), ldapCtx=0x%08x\n",
mctx.pid, tttctx->thrdNum, mctx.hostname, mctx.port,
@@ -686,8 +686,7 @@
*/
if (mctx.mode & CLTAUTH)
{
- ret = (int)(*(mctx.sslctx.ldapssl_enable_clientauth))
- (tttctx->ldapCtx, "", mctx.keydbpin, mctx.cltcertname);
+ ret = ldapssl_enable_clientauth(tttctx->ldapCtx, "", mctx.keydbpin,
mctx.cltcertname);
if (mctx.mode & VERY_VERBOSE)
printf
("ldclt[%d]: T%03d: After ldapssl_enable_clientauth (ldapCtx=0x%08x, %s,
%s)",
@@ -1835,8 +1834,7 @@
* LDAP session initialization in SSL mode
* added by: B Kolics (11/10/00)
*/
- tttctx->ldapCtx = (LDAP *)(*(mctx.sslctx.ldapssl_init)) /*JLS 07-11-00*/
- (mctx.hostname, mctx.port, 1);
+ tttctx->ldapCtx = ldapssl_init(mctx.hostname, mctx.port, 1);
if (mctx.mode & VERY_VERBOSE)
printf ("ldclt[%d]: T%03d: After ldapssl_init (%s, %d), ldapCtx=0x%08x\n",
mctx.pid, tttctx->thrdNum, mctx.hostname, mctx.port,
@@ -1853,8 +1851,7 @@
*/
if (mctx.mode & CLTAUTH)
{
- ret = (int)(*(mctx.sslctx.ldapssl_enable_clientauth))
- (tttctx->ldapCtx, "", mctx.keydbpin, mctx.cltcertname);
+ ret = ldapssl_enable_clientauth(tttctx->ldapCtx, "", mctx.keydbpin,
mctx.cltcertname);
if (mctx.mode & VERY_VERBOSE)
printf
("ldclt[%d]: T%03d: After ldapssl_enable_clientauth (ldapCtx=0x%08x, %s,
%s)",
Index: ldclt.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/tools/ldclt/ldclt.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ldclt.c 5 Jul 2007 23:53:41 -0000 1.5
+++ ldclt.c 19 Sep 2007 18:08:12 -0000 1.6
@@ -281,21 +281,17 @@
#include <time.h> /* ctime(), etc... */ /*JLS 18-08-00*/
#include <lber.h> /* ldap C-API BER decl. */
#include <ldap.h> /* ldap C-API decl. */
+#include <ldap_ssl.h> /* ldapssl_init(), etc... */
#ifdef LDAP_H_FROM_QA_WKA
#include <proto-ldap.h> /* ldap C-API prototypes */
#endif
-#ifdef _WIN32 /*JLS 29-11-00*/
-#include <ldap_ssl.h> /* ldapssl_init(), etc... */ /*JLS 29-11-00*/
-#else
+#ifndef _WIN32 /*JLS 29-11-00*/
#include <pthread.h> /* pthreads(), etc... */
#include <unistd.h> /* close(), etc... */
#include <dlfcn.h> /* dlopen(), etc... */ /*JLS 07-11-00*/
#include <sys/resource.h> /* setrlimit(), etc... */
#include <sys/time.h> /* struct rlimit, etc... */
#endif
-#ifdef HPUX /*JLS 19-06-01*/
-#include <ldap_ssl.h> /* ldapssl_init(), etc... */ /*JLS 19-06-01*/
-#endif /*JLS 19-06-01*/
#include "port.h" /* Portability definitions */ /*JLS 29-11-00*/
#include "ldclt.h" /* This tool's include file */
@@ -372,112 +368,6 @@
}
-
-
-
-
-#ifdef LDCLT_NO_DLOPEN /*JLS 01-12-00*/
-int /*JLS 29-11-00*/
-sslDynLoadInit (void) /*JLS 29-11-00*/
-{ /*JLS 29-11-00*/
- mctx.sslctx.ldapssl_init = ldapssl_init;
- mctx.sslctx.ldapssl_client_init = ldapssl_client_init;
- mctx.sslctx.ldapssl_clientauth_init = ldapssl_clientauth_init;
- mctx.sslctx.ldapssl_enable_clientauth = ldapssl_enable_clientauth;
- return (0); /*JLS 29-11-00*/
-} /*JLS 29-11-00*/
-#else /*JLS 29-11-00*/
- /* New function */ /*JLS 07-11-00*/
-/* ****************************************************************************
- FUNCTION : sslDynLoadInit
- PURPOSE : Initiates the dynamic load of ssl library.
- INPUT : None.
- OUTPUT : None.
- RETURN : -1 if error, 0 else.
- DESCRIPTION :
- *****************************************************************************/
-int
-sslDynLoadInit (void)
-{
- char *buf; /*JLS 22-11-00*/
-
- /*
- * Open the shared library...
- * Will try to load the hard-coded PATH if not in the PATH.
- */
- mctx.sslctx.libssl = dlopen (SSL_LIB, RTLD_LAZY);
- if (mctx.sslctx.libssl == NULL)
- {
- buf = (char *) malloc (strlen (SSL_LIB) + strlen (SSL_LIB_PATH) + 2);
- strcat (buf, SSL_LIB_PATH);
- strcat (buf, "/");
- strcat (buf, SSL_LIB);
-
- mctx.sslctx.libssl = dlopen (buf, RTLD_LAZY);
- if (mctx.sslctx.libssl == NULL)
- {
- printf ("Cannot dlopen (%s) : %s\n", SSL_LIB, dlerror());
- return (-1);
- }
- }
-
- /*
- * Find the address of function and data objects
- */
- mctx.sslctx.ldapssl_init = (LDAP *(*)(const char *, int, int))
- dlsym (mctx.sslctx.libssl, "ldapssl_init");
- if (mctx.sslctx.ldapssl_init == NULL)
- {
- printf ("Cannot dlsym (ldapssl_init) : %s\n", dlerror());
- return (-1);
- }
-
- /*
- * Next function...
- */
- mctx.sslctx.ldapssl_client_init = (int (*)(const char*, void*))
- dlsym (mctx.sslctx.libssl, "ldapssl_client_init");
- if (mctx.sslctx.ldapssl_client_init == NULL)
- {
- printf ("Cannot dlsym (ldapssl_client_init) : %s\n", dlerror());
- return (-1);
- }
-
- /*
- * Next function...
- */
- mctx.sslctx.ldapssl_clientauth_init =
- (int (*)(char *, void *, int, char *, void *))
- dlsym (mctx.sslctx.libssl, "ldapssl_clientauth_init");
- if (mctx.sslctx.ldapssl_clientauth_init == NULL)
- {
- printf ("Cannot dlsym (ldapssl_enable_clientauth): %s\n", dlerror());
- return (-1);
- }
-
- /*
- * Next function...
- */
- mctx.sslctx.ldapssl_enable_clientauth =
- (int (*)(LDAP *, char *, char *, char *))
- dlsym (mctx.sslctx.libssl, "ldapssl_enable_clientauth");
- if (mctx.sslctx.ldapssl_enable_clientauth == NULL)
- {
- printf ("Cannot dlsym (ldapssl_enable_clientauth): %s\n", dlerror());
- return (-1);
- }
-
- return (0);
-}
-#endif /* LDCLT_NO_DLOPEN */ /*JLS 29-11-00*/
-
-
-
-
-
-
-
-
/* New */ /*JLS 23-03-01*/
/* ****************************************************************************
FUNCTION : copyVersAttribute
@@ -1668,8 +1558,7 @@
*/
if (mctx.mode & CLTAUTH)
{
- if ((*(mctx.sslctx.ldapssl_clientauth_init))
- (mctx.certfile, NULL, 1, mctx.keydbfile, NULL) < 0)
+ if (ldapssl_clientauth_init(mctx.certfile, NULL, 1, mctx.keydbfile, NULL) < 0)
{
fprintf (stderr, "ldclt: %s\n", strerror (errno));
fprintf (stderr, "Cannot ldapssl_clientauth_init (%s,%s)\n",
@@ -1678,8 +1567,7 @@
return (-1);
}
} else {
- if ((*(mctx.sslctx.ldapssl_client_init)) /*JLS 07-11-00*/
- (mctx.certfile, NULL) < 0)
+ if (ldapssl_client_init(mctx.certfile, NULL) < 0)
{
fprintf (stderr, "ldclt: %s\n", strerror (errno));
fprintf (stderr, "Cannot ldapssl_client_init (%s)\n", /*JLS 08-11-00*/
@@ -3073,13 +2961,6 @@
} /*JLS 23-03-01*/
/*
- * Maybe we should load ssl library ?
- */
- if (mctx.mode & SSL) /*JLS 07-11-00*/
- if (sslDynLoadInit() < 0) /*JLS 07-11-00*/
- ldcltExit (EXIT_LOADSSL); /*JLS 07-11-00*/
-
- /*
* Basic initialization from the user's parameters/options
*/
if (basicInit() < 0)
Index: ldclt.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/tools/ldclt/ldclt.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ldclt.h 5 Jul 2007 23:53:41 -0000 1.4
+++ ldclt.h 19 Sep 2007 18:08:12 -0000 1.5
@@ -222,13 +222,6 @@
#define DEF_REFERRAL REFERRAL_ON /*JLS 08-03-01*/
#define DEF_SCOPE LDAP_SCOPE_SUBTREE /* Default for -s */
-#ifndef SSL_LIB
-#define SSL_LIB "libldapssl41.so"
-#endif
-#ifndef SSL_LIB_PATH
-#define SSL_LIB_PATH "/qa/ldap/tools/ldclt/src/lib-sparc/ldapcsdk"
-#endif
-
/*
* Referral choices...
*/
@@ -409,27 +402,6 @@
} thoper;
/*
- * This structure will allow to manage the handlers for ssl-related
- * dynamic loaded functions.
- */
-typedef struct ssl_context { /*JLS 07-11-00*/
-#ifndef _WIN32
- void *libssl; /* lib ssl handler */ /*JLS 07-11-00*/
- LDAP *(*ldapssl_init)(const char *, int, int); /*JLS 07-11-00*/
- int (*ldapssl_client_init)(const char*, void*); /*JLS 07-11-00*/
- int (*ldapssl_clientauth_init)(char *, void *, int, char *, void*);
- /* BK 23-11-00*/
- int (*ldapssl_enable_clientauth)(LDAP *, char *, char *, char *);
- /* BK 22-11-00*/
-#else /* _WIN32 */
- LDAP * (LDAP_CALL *ldapssl_init)(const char *, int, int);
- int (LDAP_CALL *ldapssl_client_init)(const char*, void*);
- int (LDAP_CALL *ldapssl_clientauth_init)(char *, void *, int, char *, void*);
- int (LDAP_CALL *ldapssl_enable_clientauth)(LDAP *, char *, char *, char
*);
-#endif /* _WIN32 */
-} ssl_context; /*JLS 07-11-00*/
-
-/*
* Versatile object attribute's field
* - If ldclt should use a common counter, then this counter will
* be in the mctx structure and will be found by the commonField
@@ -578,7 +550,6 @@
int slaveConn; /* Slave has connected */
char *slaves[MAX_SLAVES]; /* Slaves list */
int slavesNb; /* Number of slaves */
- ssl_context sslctx; /* SSL dyn. load ctx */ /*JSL 07-11-00*/
int timeout; /* LDAP op. t.o. */
struct timeval timeval; /* Timeval structure */
struct timeval timevalZero; /* Timeout of zero */
Index: scalab01.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/tools/ldclt/scalab01.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- scalab01.c 8 Jun 2007 23:19:20 -0000 1.3
+++ scalab01.c 19 Sep 2007 18:08:12 -0000 1.4
@@ -91,6 +91,7 @@
#include <lber.h> /* ldap C-API BER declarations */
#include <ldap.h> /* ldap C-API declarations */
+#include <ldap_ssl.h> /* ldapssl_init(), etc... */
#include "port.h" /* Portability definitions */
#include "ldclt.h" /* This tool's include file */
@@ -521,8 +522,7 @@
/*
* LDAP session initialization in SSL mode
*/
- s1ctx.ldapCtx = (LDAP *)(*(mctx.sslctx.ldapssl_init))
- (mctx.hostname, mctx.port, 1);
+ s1ctx.ldapCtx = ldapssl_init(mctx.hostname, mctx.port, 1);
if (mctx.mode & VERY_VERBOSE)
printf ("ldclt[%d]: ctrl: ldapssl_init (%s, %d), ldapCtx=0x%08x\n",
mctx.pid, mctx.hostname, mctx.port, (unsigned int)s1ctx.ldapCtx);
@@ -538,8 +538,7 @@
*/
if (mctx.mode & CLTAUTH)
{
- ret = (int)(*(mctx.sslctx.ldapssl_enable_clientauth))
- (s1ctx.ldapCtx, "", mctx.keydbpin, mctx.cltcertname);
+ ret = ldapssl_enable_clientauth(s1ctx.ldapCtx, "", mctx.keydbpin,
mctx.cltcertname);
if (mctx.mode & VERY_VERBOSE)
printf
("ldclt[%d]: ctrl: After ldapssl_enable_clientauth (ldapCtx=0x%08x, %s,
%s)",
Index: utils.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/tools/ldclt/utils.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- utils.c 10 Nov 2006 23:45:50 -0000 1.2
+++ utils.c 19 Sep 2007 18:08:12 -0000 1.3
@@ -305,19 +305,10 @@
else
{
/*
- * Maybe strict ascii required ?
+ * strict ascii required
*/
- if (1)
- {
- if (isascii (newChar) && !iscntrl(newChar))
- buf[charNum++] = newChar;
- }
- else
- {
- if (((newChar >= 0x30) && (newChar <= 0x7a)) ||
- ((newChar >= 0xc0) && (newChar <= 0xf6)))
- buf[charNum++] = newChar;
- }
+ if (isascii (newChar) && !iscntrl(newChar))
+ buf[charNum++] = newChar;
}
}