You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2011/05/31 19:10:12 UTC
svn commit: r1129808 [2/2] - in /httpd/httpd/trunk: ./ build/ docs/ include/
modules/aaa/ modules/ldap/
Copied: httpd/httpd/trunk/modules/ldap/ap_ldap_option.c (from r1128716, apr/apr/trunk/ldap/apr_ldap_option.c)
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/ap_ldap_option.c?p2=httpd/httpd/trunk/modules/ldap/ap_ldap_option.c&p1=apr/apr/trunk/ldap/apr_ldap_option.c&r1=1128716&r2=1129808&rev=1129808&view=diff
==============================================================================
--- apr/apr/trunk/ldap/apr_ldap_option.c (original)
+++ httpd/httpd/trunk/modules/ldap/ap_ldap_option.c Tue May 31 17:10:11 2011
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-/* apr_ldap_option.c -- LDAP options
+/* ap_ldap_option.c -- LDAP options
*
* The LDAP SDK allows the getting and setting of options on an LDAP
* connection.
@@ -23,40 +23,35 @@
#include "apr.h"
#include "apu.h"
-#include "apr_private.h"
-
-#if APR_HAVE_MODULAR_DSO
-#define APU_DSO_LDAP_BUILD
-#endif
-
-#include "apr_ldap.h"
+#include "ap_config.h"
+#include "ap_ldap.h"
#include "apr_errno.h"
#include "apr_pools.h"
#include "apr_strings.h"
#include "apr_tables.h"
-#if APR_HAS_LDAP
+#if AP_HAS_LDAP
static void option_set_cert(apr_pool_t *pool, LDAP *ldap, const void *invalue,
- apr_ldap_err_t *result);
+ ap_ldap_err_t *result);
static void option_set_tls(apr_pool_t *pool, LDAP *ldap, const void *invalue,
- apr_ldap_err_t *result);
+ ap_ldap_err_t *result);
/**
- * APR LDAP get option function
+ * MODLDAP get option function
*
* This function gets option values from a given LDAP session if
* one was specified.
*/
-APR_DECLARE_LDAP(int) apr_ldap_get_option(apr_pool_t *pool,
- LDAP *ldap,
- int option,
- void *outvalue,
- apr_ldap_err_t **result_err)
+MODLDAP_DECLARE(int) ap_ldap_get_option(apr_pool_t *pool,
+ LDAP *ldap,
+ int option,
+ void *outvalue,
+ ap_ldap_err_t **result_err)
{
- apr_ldap_err_t *result;
+ ap_ldap_err_t *result;
- result = apr_pcalloc(pool, sizeof(apr_ldap_err_t));
+ result = apr_pcalloc(pool, sizeof(ap_ldap_err_t));
*result_err = result;
if (!result) {
return APR_ENOMEM;
@@ -77,7 +72,7 @@ APR_DECLARE_LDAP(int) apr_ldap_get_optio
}
/**
- * APR LDAP set option function
+ * MODLDAP set option function
*
* This function sets option values to a given LDAP session if
* one was specified.
@@ -86,37 +81,37 @@ APR_DECLARE_LDAP(int) apr_ldap_get_optio
* will try and apply legacy functions to achieve the same effect,
* depending on the platform.
*/
-APR_DECLARE_LDAP(int) apr_ldap_set_option(apr_pool_t *pool,
- LDAP *ldap,
- int option,
- const void *invalue,
- apr_ldap_err_t **result_err)
+MODLDAP_DECLARE(int) ap_ldap_set_option(apr_pool_t *pool,
+ LDAP *ldap,
+ int option,
+ const void *invalue,
+ ap_ldap_err_t **result_err)
{
- apr_ldap_err_t *result;
+ ap_ldap_err_t *result;
- result = apr_pcalloc(pool, sizeof(apr_ldap_err_t));
+ result = apr_pcalloc(pool, sizeof(ap_ldap_err_t));
*result_err = result;
if (!result) {
return APR_ENOMEM;
}
switch (option) {
- case APR_LDAP_OPT_TLS_CERT:
+ case AP_LDAP_OPT_TLS_CERT:
option_set_cert(pool, ldap, invalue, result);
break;
- case APR_LDAP_OPT_TLS:
+ case AP_LDAP_OPT_TLS:
option_set_tls(pool, ldap, invalue, result);
break;
- case APR_LDAP_OPT_VERIFY_CERT:
-#if APR_HAS_NETSCAPE_LDAPSDK || APR_HAS_SOLARIS_LDAPSDK || APR_HAS_MOZILLA_LDAPSK
- result->reason = "LDAP: Verify certificate not yet supported by APR on the "
+ case AP_LDAP_OPT_VERIFY_CERT:
+#if AP_HAS_NETSCAPE_LDAPSDK || AP_HAS_SOLARIS_LDAPSDK || AP_HAS_MOZILLA_LDAPSK
+ result->reason = "LDAP: Verify certificate not yet supported on the "
"Netscape, Solaris or Mozilla LDAP SDKs";
result->rc = -1;
return APR_EGENERAL;
#endif
-#if APR_HAS_NOVELL_LDAPSDK
+#if AP_HAS_NOVELL_LDAPSDK
if (*((int*)invalue)) {
result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_SERVER);
}
@@ -124,7 +119,7 @@ APR_DECLARE_LDAP(int) apr_ldap_set_optio
result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_NONE);
}
#endif
-#if APR_HAS_OPENLDAP_LDAPSDK
+#if AP_HAS_OPENLDAP_LDAPSDK
#ifdef LDAP_OPT_X_TLS
/* This is not a per-connection setting so just pass NULL for the
Ldap connection handle */
@@ -137,7 +132,7 @@ APR_DECLARE_LDAP(int) apr_ldap_set_optio
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
}
#else
- result->reason = "LDAP: SSL/TLS not yet supported by APR on this "
+ result->reason = "LDAP: SSL/TLS not yet supported on this "
"version of the OpenLDAP toolkit";
result->rc = -1;
return APR_EGENERAL;
@@ -151,7 +146,7 @@ APR_DECLARE_LDAP(int) apr_ldap_set_optio
}
break;
- case APR_LDAP_OPT_REFERRALS:
+ case AP_LDAP_OPT_REFERRALS:
/* Setting this option is supported on at least TIVOLI_SDK and OpenLDAP. Folks
* who know the NOVELL, NETSCAPE, MOZILLA, and SOLARIS SDKs should note here if
* the SDK at least tolerates this option being set, or add an elif to handle
@@ -165,8 +160,8 @@ APR_DECLARE_LDAP(int) apr_ldap_set_optio
}
break;
- case APR_LDAP_OPT_REFHOPLIMIT:
-#if !defined(LDAP_OPT_REFHOPLIMIT) || APR_HAS_NOVELL_LDAPSDK
+ case AP_LDAP_OPT_REFHOPLIMIT:
+#if !defined(LDAP_OPT_REFHOPLIMIT) || AP_HAS_NOVELL_LDAPSDK
/* If the LDAP_OPT_REFHOPLIMIT symbol is missing, assume that the
* particular LDAP library has a reasonable default. So far certain
* versions of the OpenLDAP SDK miss this symbol (but default to 5),
@@ -211,26 +206,26 @@ APR_DECLARE_LDAP(int) apr_ldap_set_optio
}
/**
- * Handle APR_LDAP_OPT_TLS
+ * Handle AP_LDAP_OPT_TLS
*
* This function sets the type of TLS to be applied to this connection.
* The options are:
- * APR_LDAP_NONE: no encryption
- * APR_LDAP_SSL: SSL encryption (ldaps://)
- * APR_LDAP_STARTTLS: STARTTLS encryption
- * APR_LDAP_STOPTLS: Stop existing TLS connecttion
+ * AP_LDAP_NONE: no encryption
+ * AP_LDAP_SSL: SSL encryption (ldaps://)
+ * AP_LDAP_STARTTLS: STARTTLS encryption
+ * AP_LDAP_STOPTLS: Stop existing TLS connecttion
*/
static void option_set_tls(apr_pool_t *pool, LDAP *ldap, const void *invalue,
- apr_ldap_err_t *result)
+ ap_ldap_err_t *result)
{
-#if APR_HAS_LDAP_SSL /* compiled with ssl support */
+#if AP_HAS_LDAP_SSL /* compiled with ssl support */
int tls = * (const int *)invalue;
/* Netscape/Mozilla/Solaris SDK */
-#if APR_HAS_NETSCAPE_LDAPSDK || APR_HAS_SOLARIS_LDAPSDK || APR_HAS_MOZILLA_LDAPSK
-#if APR_HAS_LDAPSSL_INSTALL_ROUTINES
- if (tls == APR_LDAP_SSL) {
+#if AP_HAS_NETSCAPE_LDAPSDK || AP_HAS_SOLARIS_LDAPSDK || AP_HAS_MOZILLA_LDAPSK
+#if AP_HAS_LDAPSSL_INSTALL_ROUTINES
+ if (tls == AP_LDAP_SSL) {
result->rc = ldapssl_install_routines(ldap);
#ifdef LDAP_OPT_SSL
/* apparently Netscape and Mozilla need this too, Solaris doesn't */
@@ -244,18 +239,18 @@ static void option_set_tls(apr_pool_t *p
"connection.";
}
}
- else if (tls == APR_LDAP_STARTTLS) {
+ else if (tls == AP_LDAP_STARTTLS) {
result->reason = "LDAP: STARTTLS is not supported by the "
"Netscape/Mozilla/Solaris SDK";
result->rc = -1;
}
- else if (tls == APR_LDAP_STOPTLS) {
+ else if (tls == AP_LDAP_STOPTLS) {
result->reason = "LDAP: STOPTLS is not supported by the "
"Netscape/Mozilla/Solaris SDK";
result->rc = -1;
}
#else
- if (tls != APR_LDAP_NONE) {
+ if (tls != AP_LDAP_NONE) {
result->reason = "LDAP: SSL/TLS is not supported by this version "
"of the Netscape/Mozilla/Solaris SDK";
result->rc = -1;
@@ -264,7 +259,7 @@ static void option_set_tls(apr_pool_t *p
#endif
/* Novell SDK */
-#if APR_HAS_NOVELL_LDAPSDK
+#if AP_HAS_NOVELL_LDAPSDK
/* ldapssl_install_routines(ldap)
* Behavior is unpredictable when other LDAP functions are called
* between the ldap_init function and the ldapssl_install_routines
@@ -272,7 +267,7 @@ static void option_set_tls(apr_pool_t *p
*
* STARTTLS is supported by the ldap_start_tls_s() method
*/
- if (tls == APR_LDAP_SSL) {
+ if (tls == AP_LDAP_SSL) {
result->rc = ldapssl_install_routines(ldap);
if (result->rc != LDAP_SUCCESS) {
result->msg = ldap_err2string(result->rc);
@@ -280,14 +275,14 @@ static void option_set_tls(apr_pool_t *p
"connection.";
}
}
- if (tls == APR_LDAP_STARTTLS) {
+ if (tls == AP_LDAP_STARTTLS) {
result->rc = ldapssl_start_tls(ldap);
if (result->rc != LDAP_SUCCESS) {
result->msg = ldap_err2string(result->rc);
result->reason = "LDAP: Could not start TLS on this connection";
}
}
- else if (tls == APR_LDAP_STOPTLS) {
+ else if (tls == AP_LDAP_STOPTLS) {
result->rc = ldapssl_stop_tls(ldap);
if (result->rc != LDAP_SUCCESS) {
result->msg = ldap_err2string(result->rc);
@@ -297,9 +292,9 @@ static void option_set_tls(apr_pool_t *p
#endif
/* OpenLDAP SDK */
-#if APR_HAS_OPENLDAP_LDAPSDK
+#if AP_HAS_OPENLDAP_LDAPSDK
#ifdef LDAP_OPT_X_TLS
- if (tls == APR_LDAP_SSL) {
+ if (tls == AP_LDAP_SSL) {
int SSLmode = LDAP_OPT_X_TLS_HARD;
result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS, &SSLmode);
if (result->rc != LDAP_SUCCESS) {
@@ -309,21 +304,21 @@ static void option_set_tls(apr_pool_t *p
result->msg = ldap_err2string(result->rc);
}
}
- else if (tls == APR_LDAP_STARTTLS) {
+ else if (tls == AP_LDAP_STARTTLS) {
result->rc = ldap_start_tls_s(ldap, NULL, NULL);
if (result->rc != LDAP_SUCCESS) {
result->reason = "LDAP: ldap_start_tls_s() failed";
result->msg = ldap_err2string(result->rc);
}
}
- else if (tls == APR_LDAP_STOPTLS) {
+ else if (tls == AP_LDAP_STOPTLS) {
result->reason = "LDAP: STOPTLS is not supported by the "
"OpenLDAP SDK";
result->rc = -1;
}
#else
- if (tls != APR_LDAP_NONE) {
- result->reason = "LDAP: SSL/TLS not yet supported by APR on this "
+ if (tls != AP_LDAP_NONE) {
+ result->reason = "LDAP: SSL/TLS not yet supported on this "
"version of the OpenLDAP toolkit";
result->rc = -1;
}
@@ -331,8 +326,8 @@ static void option_set_tls(apr_pool_t *p
#endif
/* Microsoft SDK */
-#if APR_HAS_MICROSOFT_LDAPSDK
- if (tls == APR_LDAP_NONE) {
+#if AP_HAS_MICROSOFT_LDAPSDK
+ if (tls == AP_LDAP_NONE) {
ULONG ul = (ULONG) LDAP_OPT_OFF;
result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, &ul);
if (result->rc != LDAP_SUCCESS) {
@@ -341,7 +336,7 @@ static void option_set_tls(apr_pool_t *p
result->msg = ldap_err2string(result->rc);
}
}
- else if (tls == APR_LDAP_SSL) {
+ else if (tls == AP_LDAP_SSL) {
ULONG ul = (ULONG) LDAP_OPT_ON;
result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, &ul);
if (result->rc != LDAP_SUCCESS) {
@@ -350,15 +345,15 @@ static void option_set_tls(apr_pool_t *p
result->msg = ldap_err2string(result->rc);
}
}
-#if APR_HAS_LDAP_START_TLS_S
- else if (tls == APR_LDAP_STARTTLS) {
+#if AP_HAS_LDAP_START_TLS_S
+ else if (tls == AP_LDAP_STARTTLS) {
result->rc = ldap_start_tls_s(ldap, NULL, NULL, NULL, NULL);
if (result->rc != LDAP_SUCCESS) {
result->reason = "LDAP: ldap_start_tls_s() failed";
result->msg = ldap_err2string(result->rc);
}
}
- else if (tls == APR_LDAP_STOPTLS) {
+ else if (tls == AP_LDAP_STOPTLS) {
result->rc = ldap_stop_tls_s(ldap);
if (result->rc != LDAP_SUCCESS) {
result->reason = "LDAP: ldap_stop_tls_s() failed";
@@ -368,20 +363,20 @@ static void option_set_tls(apr_pool_t *p
#endif
#endif
-#if APR_HAS_OTHER_LDAPSDK
- if (tls != APR_LDAP_NONE) {
- result->reason = "LDAP: SSL/TLS is currently not supported by "
- "APR on this LDAP SDK";
+#if AP_HAS_OTHER_LDAPSDK
+ if (tls != AP_LDAP_NONE) {
+ result->reason = "LDAP: SSL/TLS is currently not supported "
+ "on this LDAP SDK";
result->rc = -1;
}
#endif
-#endif /* APR_HAS_LDAP_SSL */
+#endif /* AP_HAS_LDAP_SSL */
}
/**
- * Handle APR_LDAP_OPT_TLS_CACERTFILE
+ * Handle AP_LDAP_OPT_TLS_CACERTFILE
*
* This function sets the CA certificate for further SSL/TLS connections.
*
@@ -394,18 +389,18 @@ static void option_set_tls(apr_pool_t *p
* Solaris: unknown
*/
static void option_set_cert(apr_pool_t *pool, LDAP *ldap,
- const void *invalue, apr_ldap_err_t *result)
+ const void *invalue, ap_ldap_err_t *result)
{
-#if APR_HAS_LDAP_SSL
-#if APR_HAS_LDAPSSL_CLIENT_INIT || APR_HAS_OPENLDAP_LDAPSDK
+#if AP_HAS_LDAP_SSL
+#if AP_HAS_LDAPSSL_CLIENT_INIT || AP_HAS_OPENLDAP_LDAPSDK
apr_array_header_t *certs = (apr_array_header_t *)invalue;
- struct apr_ldap_opt_tls_cert_t *ents = (struct apr_ldap_opt_tls_cert_t *)certs->elts;
+ struct ap_ldap_opt_tls_cert_t *ents = (struct ap_ldap_opt_tls_cert_t *)certs->elts;
int i = 0;
#endif
/* Netscape/Mozilla/Solaris SDK */
-#if APR_HAS_NETSCAPE_LDAPSDK || APR_HAS_SOLARIS_LDAPSDK || APR_HAS_MOZILLA_LDAPSDK
-#if APR_HAS_LDAPSSL_CLIENT_INIT
+#if AP_HAS_NETSCAPE_LDAPSDK || AP_HAS_SOLARIS_LDAPSDK || AP_HAS_MOZILLA_LDAPSDK
+#if AP_HAS_LDAPSSL_CLIENT_INIT
const char *nickname = NULL;
const char *secmod = NULL;
const char *key3db = NULL;
@@ -415,16 +410,16 @@ static void option_set_cert(apr_pool_t *
/* set up cert7.db, key3.db and secmod parameters */
for (i = 0; i < certs->nelts; i++) {
switch (ents[i].type) {
- case APR_LDAP_CA_TYPE_CERT7_DB:
+ case AP_LDAP_CA_TYPE_CERT7_DB:
cert7db = ents[i].path;
break;
- case APR_LDAP_CA_TYPE_SECMOD:
+ case AP_LDAP_CA_TYPE_SECMOD:
secmod = ents[i].path;
break;
- case APR_LDAP_CERT_TYPE_KEY3_DB:
+ case AP_LDAP_CERT_TYPE_KEY3_DB:
key3db = ents[i].path;
break;
- case APR_LDAP_CERT_TYPE_NICKNAME:
+ case AP_LDAP_CERT_TYPE_NICKNAME:
nickname = ents[i].path;
password = ents[i].password;
break;
@@ -486,8 +481,8 @@ static void option_set_cert(apr_pool_t *
#endif
/* Novell SDK */
-#if APR_HAS_NOVELL_LDAPSDK
-#if APR_HAS_LDAPSSL_CLIENT_INIT && APR_HAS_LDAPSSL_ADD_TRUSTED_CERT && APR_HAS_LDAPSSL_CLIENT_DEINIT
+#if AP_HAS_NOVELL_LDAPSDK
+#if AP_HAS_LDAPSSL_CLIENT_INIT && AP_HAS_LDAPSSL_ADD_TRUSTED_CERT && AP_HAS_LDAPSSL_CLIENT_DEINIT
/* The Novell library cannot support per connection certificates. Error
* out if the ldap handle is provided.
*/
@@ -509,47 +504,47 @@ static void option_set_cert(apr_pool_t *
for (i = 0; LDAP_SUCCESS == result->rc && i < certs->nelts; i++) {
/* Novell SDK supports DER or BASE64 files. */
switch (ents[i].type) {
- case APR_LDAP_CA_TYPE_DER:
+ case AP_LDAP_CA_TYPE_DER:
result->rc = ldapssl_add_trusted_cert((void *)ents[i].path,
LDAPSSL_CERT_FILETYPE_DER);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_CA_TYPE_BASE64:
+ case AP_LDAP_CA_TYPE_BASE64:
result->rc = ldapssl_add_trusted_cert((void *)ents[i].path,
LDAPSSL_CERT_FILETYPE_B64);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_CERT_TYPE_DER:
+ case AP_LDAP_CERT_TYPE_DER:
result->rc = ldapssl_set_client_cert((void *)ents[i].path,
LDAPSSL_CERT_FILETYPE_DER,
(void*)ents[i].password);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_CERT_TYPE_BASE64:
+ case AP_LDAP_CERT_TYPE_BASE64:
result->rc = ldapssl_set_client_cert((void *)ents[i].path,
LDAPSSL_CERT_FILETYPE_B64,
(void*)ents[i].password);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_CERT_TYPE_PFX:
+ case AP_LDAP_CERT_TYPE_PFX:
result->rc = ldapssl_set_client_cert((void *)ents[i].path,
LDAPSSL_FILETYPE_P12,
(void*)ents[i].password);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_KEY_TYPE_DER:
+ case AP_LDAP_KEY_TYPE_DER:
result->rc = ldapssl_set_client_private_key((void *)ents[i].path,
LDAPSSL_CERT_FILETYPE_DER,
(void*)ents[i].password);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_KEY_TYPE_BASE64:
+ case AP_LDAP_KEY_TYPE_BASE64:
result->rc = ldapssl_set_client_private_key((void *)ents[i].path,
LDAPSSL_CERT_FILETYPE_B64,
(void*)ents[i].password);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_KEY_TYPE_PFX:
+ case AP_LDAP_KEY_TYPE_PFX:
result->rc = ldapssl_set_client_private_key((void *)ents[i].path,
LDAPSSL_FILETYPE_P12,
(void*)ents[i].password);
@@ -576,7 +571,7 @@ static void option_set_cert(apr_pool_t *
#endif
/* OpenLDAP SDK */
-#if APR_HAS_OPENLDAP_LDAPSDK
+#if AP_HAS_OPENLDAP_LDAPSDK
#ifdef LDAP_OPT_X_TLS_CACERTFILE
#ifndef LDAP_OPT_X_TLS_NEWCTX
if (ldap) {
@@ -592,23 +587,23 @@ static void option_set_cert(apr_pool_t *
for (i = 0; i < certs->nelts; i++) {
/* OpenLDAP SDK supports BASE64 files. */
switch (ents[i].type) {
- case APR_LDAP_CA_TYPE_BASE64:
+ case AP_LDAP_CA_TYPE_BASE64:
result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS_CACERTFILE,
(void *)ents[i].path);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_CERT_TYPE_BASE64:
+ case AP_LDAP_CERT_TYPE_BASE64:
result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS_CERTFILE,
(void *)ents[i].path);
result->msg = ldap_err2string(result->rc);
break;
- case APR_LDAP_KEY_TYPE_BASE64:
+ case AP_LDAP_KEY_TYPE_BASE64:
result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS_KEYFILE,
(void *)ents[i].path);
result->msg = ldap_err2string(result->rc);
break;
#ifdef LDAP_OPT_X_TLS_CACERTDIR
- case APR_LDAP_CA_TYPE_CACERTDIR_BASE64:
+ case AP_LDAP_CA_TYPE_CACERTDIR_BASE64:
result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS_CACERTDIR,
(void *)ents[i].path);
result->msg = ldap_err2string(result->rc);
@@ -644,7 +639,7 @@ static void option_set_cert(apr_pool_t *
#endif
/* Microsoft SDK */
-#if APR_HAS_MICROSOFT_LDAPSDK
+#if AP_HAS_MICROSOFT_LDAPSDK
/* Microsoft SDK use the registry certificate store - error out
* here with a message explaining this. */
result->reason = "LDAP: CA certificates cannot be set using this method, "
@@ -653,7 +648,7 @@ static void option_set_cert(apr_pool_t *
#endif
/* SDK not recognised */
-#if APR_HAS_OTHER_LDAPSDK
+#if AP_HAS_OTHER_LDAPSDK
result->reason = "LDAP: LDAP_OPT_X_TLS_CACERTFILE not "
"defined by this LDAP SDK. Certificate "
"authority file not set";
@@ -664,9 +659,9 @@ static void option_set_cert(apr_pool_t *
result->reason = "LDAP: Attempt to set certificate(s) failed. "
"Not built with SSL support";
result->rc = -1;
-#endif /* APR_HAS_LDAP_SSL */
+#endif /* AP_HAS_LDAP_SSL */
}
-#endif /* APR_HAS_LDAP */
+#endif /* AP_HAS_LDAP */
Copied: httpd/httpd/trunk/modules/ldap/ap_ldap_rebind.c (from r1128716, apr/apr/trunk/ldap/apr_ldap_rebind.c)
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/ap_ldap_rebind.c?p2=httpd/httpd/trunk/modules/ldap/ap_ldap_rebind.c&p1=apr/apr/trunk/ldap/apr_ldap_rebind.c&r1=1128716&r2=1129808&rev=1129808&view=diff
==============================================================================
--- apr/apr/trunk/ldap/apr_ldap_rebind.c (original)
+++ httpd/httpd/trunk/modules/ldap/ap_ldap_rebind.c Tue May 31 17:10:11 2011
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-/* apr_ldap_rebind.c -- LDAP rebind callbacks for referrals
+/* ap_ldap_rebind.c -- LDAP rebind callbacks for referrals
*
* The LDAP SDK allows a callback to be set to enable rebinding
* for referral processing.
@@ -22,14 +22,10 @@
*/
#include "apr.h"
-#include "apr_private.h"
-#include "apr_ldap.h"
+#include "ap_config.h"
+#include "ap_ldap.h"
-#if APR_HAS_LDAP
-
-#if APR_HAVE_MODULAR_DSO
-#define APU_DSO_LDAP_BUILD
-#endif
+#if AP_HAS_LDAP
#include "apr_errno.h"
#include "apr_strings.h"
@@ -37,32 +33,32 @@
#include "stdio.h"
/* Used to store information about connections for use in the referral rebind callback. */
-struct apr_ldap_rebind_entry {
+struct ap_ldap_rebind_entry {
apr_pool_t *pool;
LDAP *index;
const char *bindDN;
const char *bindPW;
- struct apr_ldap_rebind_entry *next;
+ struct ap_ldap_rebind_entry *next;
};
-typedef struct apr_ldap_rebind_entry apr_ldap_rebind_entry_t;
+typedef struct ap_ldap_rebind_entry ap_ldap_rebind_entry_t;
#ifdef NETWARE
#define get_apd \
APP_DATA* apd = (APP_DATA*)get_app_data(gLibId); \
- apr_ldap_xref_lock = (apr_thread_mutex_t *)apd->gs_ldap_xref_lock; \
- xref_head = (apr_ldap_rebind_entry_t *)apd->gs_xref_head;
+ ap_ldap_xref_lock = (apr_thread_mutex_t *)apd->gs_ldap_xref_lock; \
+ xref_head = (ap_ldap_rebind_entry_t *)apd->gs_xref_head;
#endif
#if APR_HAS_THREADS
-static apr_thread_mutex_t *apr_ldap_xref_lock = NULL;
+static apr_thread_mutex_t *ap_ldap_xref_lock = NULL;
#endif
-static apr_ldap_rebind_entry_t *xref_head = NULL;
+static ap_ldap_rebind_entry_t *xref_head = NULL;
-static int apr_ldap_rebind_set_callback(LDAP *ld);
-static apr_status_t apr_ldap_rebind_remove_helper(void *data);
+static int ap_ldap_rebind_set_callback(LDAP *ld);
+static apr_status_t ap_ldap_rebind_remove_helper(void *data);
-static apr_status_t apr_ldap_pool_cleanup_set_null(void *data_)
+static apr_status_t ap_ldap_pool_cleanup_set_null(void *data_)
{
void **ptr = (void **)data_;
*ptr = NULL;
@@ -70,8 +66,8 @@ static apr_status_t apr_ldap_pool_cleanu
}
-/* APR utility routine used to create the xref_lock. */
-APR_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_init(apr_pool_t *pool)
+/* AP utility routine used to create the xref_lock. */
+MODLDAP_DECLARE(apr_status_t) ap_ldap_rebind_init(apr_pool_t *pool)
{
apr_status_t retcode = APR_SUCCESS;
@@ -80,12 +76,12 @@ APR_DECLARE_LDAP(apr_status_t) apr_ldap_
#endif
/* run after apr_thread_mutex_create cleanup */
- apr_pool_cleanup_register(pool, &apr_ldap_xref_lock, apr_ldap_pool_cleanup_set_null,
+ apr_pool_cleanup_register(pool, &ap_ldap_xref_lock, ap_ldap_pool_cleanup_set_null,
apr_pool_cleanup_null);
#if APR_HAS_THREADS
- if (apr_ldap_xref_lock == NULL) {
- retcode = apr_thread_mutex_create(&apr_ldap_xref_lock, APR_THREAD_MUTEX_DEFAULT, pool);
+ if (ap_ldap_xref_lock == NULL) {
+ retcode = apr_thread_mutex_create(&ap_ldap_xref_lock, APR_THREAD_MUTEX_DEFAULT, pool);
}
#endif
@@ -93,19 +89,19 @@ APR_DECLARE_LDAP(apr_status_t) apr_ldap_
}
-APR_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_add(apr_pool_t *pool,
+MODLDAP_DECLARE(apr_status_t) ap_ldap_rebind_add(apr_pool_t *pool,
LDAP *ld,
const char *bindDN,
const char *bindPW)
{
apr_status_t retcode = APR_SUCCESS;
- apr_ldap_rebind_entry_t *new_xref;
+ ap_ldap_rebind_entry_t *new_xref;
#ifdef NETWARE
get_apd
#endif
- new_xref = (apr_ldap_rebind_entry_t *)apr_pcalloc(pool, sizeof(apr_ldap_rebind_entry_t));
+ new_xref = (ap_ldap_rebind_entry_t *)apr_pcalloc(pool, sizeof(ap_ldap_rebind_entry_t));
if (new_xref) {
new_xref->pool = pool;
new_xref->index = ld;
@@ -117,7 +113,7 @@ APR_DECLARE_LDAP(apr_status_t) apr_ldap_
}
#if APR_HAS_THREADS
- retcode = apr_thread_mutex_lock(apr_ldap_xref_lock);
+ retcode = apr_thread_mutex_lock(ap_ldap_xref_lock);
if (retcode != APR_SUCCESS) {
return retcode;
}
@@ -127,7 +123,7 @@ APR_DECLARE_LDAP(apr_status_t) apr_ldap_
xref_head = new_xref;
#if APR_HAS_THREADS
- retcode = apr_thread_mutex_unlock(apr_ldap_xref_lock);
+ retcode = apr_thread_mutex_unlock(ap_ldap_xref_lock);
if (retcode != APR_SUCCESS) {
return retcode;
}
@@ -137,23 +133,23 @@ APR_DECLARE_LDAP(apr_status_t) apr_ldap_
return(APR_ENOMEM);
}
- retcode = apr_ldap_rebind_set_callback(ld);
+ retcode = ap_ldap_rebind_set_callback(ld);
if (APR_SUCCESS != retcode) {
- apr_ldap_rebind_remove(ld);
+ ap_ldap_rebind_remove(ld);
return retcode;
}
apr_pool_cleanup_register(pool, ld,
- apr_ldap_rebind_remove_helper,
+ ap_ldap_rebind_remove_helper,
apr_pool_cleanup_null);
return(APR_SUCCESS);
}
-APR_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_remove(LDAP *ld)
+MODLDAP_DECLARE(apr_status_t) ap_ldap_rebind_remove(LDAP *ld)
{
- apr_ldap_rebind_entry_t *tmp_xref, *prev = NULL;
+ ap_ldap_rebind_entry_t *tmp_xref, *prev = NULL;
apr_status_t retcode = 0;
#ifdef NETWARE
@@ -161,7 +157,7 @@ APR_DECLARE_LDAP(apr_status_t) apr_ldap_
#endif
#if APR_HAS_THREADS
- retcode = apr_thread_mutex_lock(apr_ldap_xref_lock);
+ retcode = apr_thread_mutex_lock(ap_ldap_xref_lock);
if (retcode != APR_SUCCESS) {
return retcode;
}
@@ -185,11 +181,11 @@ APR_DECLARE_LDAP(apr_status_t) apr_ldap_
/* remove the cleanup, just in case this was done manually */
apr_pool_cleanup_kill(tmp_xref->pool, tmp_xref->index,
- apr_ldap_rebind_remove_helper);
+ ap_ldap_rebind_remove_helper);
}
#if APR_HAS_THREADS
- retcode = apr_thread_mutex_unlock(apr_ldap_xref_lock);
+ retcode = apr_thread_mutex_unlock(ap_ldap_xref_lock);
if (retcode != APR_SUCCESS) {
return retcode;
}
@@ -198,24 +194,24 @@ APR_DECLARE_LDAP(apr_status_t) apr_ldap_
}
-static apr_status_t apr_ldap_rebind_remove_helper(void *data)
+static apr_status_t ap_ldap_rebind_remove_helper(void *data)
{
LDAP *ld = (LDAP *)data;
- apr_ldap_rebind_remove(ld);
+ ap_ldap_rebind_remove(ld);
return APR_SUCCESS;
}
-#if APR_HAS_TIVOLI_LDAPSDK || APR_HAS_OPENLDAP_LDAPSDK || APR_HAS_NOVELL_LDAPSDK
-static apr_ldap_rebind_entry_t *apr_ldap_rebind_lookup(LDAP *ld)
+#if AP_HAS_TIVOLI_LDAPSDK || AP_HAS_OPENLDAP_LDAPSDK || AP_HAS_NOVELL_LDAPSDK
+static ap_ldap_rebind_entry_t *ap_ldap_rebind_lookup(LDAP *ld)
{
- apr_ldap_rebind_entry_t *tmp_xref, *match = NULL;
+ ap_ldap_rebind_entry_t *tmp_xref, *match = NULL;
#ifdef NETWARE
get_apd
#endif
#if APR_HAS_THREADS
- apr_thread_mutex_lock(apr_ldap_xref_lock);
+ apr_thread_mutex_lock(ap_ldap_xref_lock);
#endif
tmp_xref = xref_head;
@@ -230,14 +226,14 @@ static apr_ldap_rebind_entry_t *apr_ldap
}
#if APR_HAS_THREADS
- apr_thread_mutex_unlock(apr_ldap_xref_lock);
+ apr_thread_mutex_unlock(ap_ldap_xref_lock);
#endif
return (match);
}
#endif
-#if APR_HAS_TIVOLI_LDAPSDK
+#if AP_HAS_TIVOLI_LDAPSDK
/* LDAP_rebindproc() Tivoli LDAP style
* Rebind callback function. Called when chasing referrals. See API docs.
@@ -251,10 +247,10 @@ static apr_ldap_rebind_entry_t *apr_ldap
static int LDAP_rebindproc(LDAP *ld, char **binddnp, char **passwdp, int *methodp, int freeit)
{
if (!freeit) {
- apr_ldap_rebind_entry_t *my_conn;
+ ap_ldap_rebind_entry_t *my_conn;
*methodp = LDAP_AUTH_SIMPLE;
- my_conn = apr_ldap_rebind_lookup(ld);
+ my_conn = ap_ldap_rebind_lookup(ld);
if ((my_conn) && (my_conn->bindDN != NULL)) {
*binddnp = strdup(my_conn->bindDN);
@@ -275,13 +271,13 @@ static int LDAP_rebindproc(LDAP *ld, cha
return LDAP_SUCCESS;
}
-static int apr_ldap_rebind_set_callback(LDAP *ld)
+static int ap_ldap_rebind_set_callback(LDAP *ld)
{
ldap_set_rebind_proc(ld, (LDAPRebindProc)LDAP_rebindproc);
return APR_SUCCESS;
}
-#elif APR_HAS_OPENLDAP_LDAPSDK
+#elif AP_HAS_OPENLDAP_LDAPSDK
/* LDAP_rebindproc() openLDAP V3 style
* ON ENTRY:
@@ -306,11 +302,11 @@ static int LDAP_rebindproc(LDAP *ld, LDA
ber_int_t msgid)
#endif
{
- apr_ldap_rebind_entry_t *my_conn;
+ ap_ldap_rebind_entry_t *my_conn;
const char *bindDN = NULL;
const char *bindPW = NULL;
- my_conn = apr_ldap_rebind_lookup(ld);
+ my_conn = ap_ldap_rebind_lookup(ld);
if ((my_conn) && (my_conn->bindDN != NULL)) {
bindDN = my_conn->bindDN;
@@ -320,7 +316,7 @@ static int LDAP_rebindproc(LDAP *ld, LDA
return (ldap_bind_s(ld, bindDN, bindPW, LDAP_AUTH_SIMPLE));
}
-static int apr_ldap_rebind_set_callback(LDAP *ld)
+static int ap_ldap_rebind_set_callback(LDAP *ld)
{
#if defined(LDAP_SET_REBIND_PROC_THREE)
ldap_set_rebind_proc(ld, LDAP_rebindproc, NULL);
@@ -330,7 +326,7 @@ static int apr_ldap_rebind_set_callback(
return APR_SUCCESS;
}
-#elif APR_HAS_NOVELL_LDAPSDK
+#elif AP_HAS_NOVELL_LDAPSDK
/* LDAP_rebindproc() openLDAP V3 style
* ON ENTRY:
@@ -342,11 +338,11 @@ static int apr_ldap_rebind_set_callback(
static int LDAP_rebindproc(LDAP *ld, LDAP_CONST char *url, int request, ber_int_t msgid)
{
- apr_ldap_rebind_entry_t *my_conn;
+ ap_ldap_rebind_entry_t *my_conn;
const char *bindDN = NULL;
const char *bindPW = NULL;
- my_conn = apr_ldap_rebind_lookup(ld);
+ my_conn = ap_ldap_rebind_lookup(ld);
if ((my_conn) && (my_conn->bindDN != NULL)) {
bindDN = my_conn->bindDN;
@@ -356,7 +352,7 @@ static int LDAP_rebindproc(LDAP *ld, LDA
return (ldap_bind_s(ld, bindDN, bindPW, LDAP_AUTH_SIMPLE));
}
-static int apr_ldap_rebind_set_callback(LDAP *ld)
+static int ap_ldap_rebind_set_callback(LDAP *ld)
{
ldap_set_rebind_proc(ld, LDAP_rebindproc);
return APR_SUCCESS;
@@ -364,7 +360,7 @@ static int apr_ldap_rebind_set_callback(
#else /* Implementation not recognised */
-static int apr_ldap_rebind_set_callback(LDAP *ld)
+static int ap_ldap_rebind_set_callback(LDAP *ld)
{
return APR_ENOTIMPL;
}
@@ -372,4 +368,4 @@ static int apr_ldap_rebind_set_callback(
#endif
-#endif /* APR_HAS_LDAP */
+#endif /* AP_HAS_LDAP */
Copied: httpd/httpd/trunk/modules/ldap/ap_ldap_url.c (from r1128716, apr/apr/trunk/ldap/apr_ldap_url.c)
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/ap_ldap_url.c?p2=httpd/httpd/trunk/modules/ldap/ap_ldap_url.c&p1=apr/apr/trunk/ldap/apr_ldap_url.c&r1=1128716&r2=1129808&rev=1129808&view=diff
==============================================================================
--- apr/apr/trunk/ldap/apr_ldap_url.c (original)
+++ httpd/httpd/trunk/modules/ldap/ap_ldap_url.c Tue May 31 17:10:11 2011
@@ -50,7 +50,7 @@
* is provided ``as is'' without express or implied warranty.
*/
-/* apr_ldap_url.c -- LDAP URL (RFC 2255) related routines
+/* ap_ldap_url.c -- LDAP URL (RFC 2255) related routines
*
* Win32 and perhaps other non-OpenLDAP based ldap libraries may be
* missing ldap_url_* APIs. We focus here on the one significant
@@ -74,9 +74,10 @@
#include "apr_pools.h"
#include "apr_general.h"
#include "apr_strings.h"
-#include "apr_ldap.h"
+#include "ap_config.h"
+#include "ap_ldap.h"
-#if APR_HAS_LDAP
+#if AP_HAS_LDAP
#if APR_HAVE_STDLIB_H
#include <stdlib.h>
@@ -86,14 +87,14 @@
#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */
#endif
-#define APR_LDAP_URL_PREFIX "ldap://"
-#define APR_LDAP_URL_PREFIX_LEN (sizeof(APR_LDAP_URL_PREFIX)-1)
-#define APR_LDAPS_URL_PREFIX "ldaps://"
-#define APR_LDAPS_URL_PREFIX_LEN (sizeof(APR_LDAPS_URL_PREFIX)-1)
-#define APR_LDAPI_URL_PREFIX "ldapi://"
-#define APR_LDAPI_URL_PREFIX_LEN (sizeof(APR_LDAPI_URL_PREFIX)-1)
-#define APR_LDAP_URL_URLCOLON "URL:"
-#define APR_LDAP_URL_URLCOLON_LEN (sizeof(APR_LDAP_URL_URLCOLON)-1)
+#define AP_LDAP_URL_PREFIX "ldap://"
+#define AP_LDAP_URL_PREFIX_LEN (sizeof(AP_LDAP_URL_PREFIX)-1)
+#define AP_LDAPS_URL_PREFIX "ldaps://"
+#define AP_LDAPS_URL_PREFIX_LEN (sizeof(AP_LDAPS_URL_PREFIX)-1)
+#define AP_LDAPI_URL_PREFIX "ldapi://"
+#define AP_LDAPI_URL_PREFIX_LEN (sizeof(AP_LDAPI_URL_PREFIX)-1)
+#define AP_LDAP_URL_URLCOLON "URL:"
+#define AP_LDAP_URL_URLCOLON_LEN (sizeof(AP_LDAP_URL_URLCOLON)-1)
/* local functions */
@@ -101,20 +102,20 @@ static const char* skip_url_prefix(const
int *enclosedp,
const char **scheme);
-static void apr_ldap_pvt_hex_unescape(char *s);
+static void ap_ldap_pvt_hex_unescape(char *s);
-static int apr_ldap_pvt_unhex(int c);
+static int ap_ldap_pvt_unhex(int c);
-static char **apr_ldap_str2charray(apr_pool_t *pool,
- const char *str,
- const char *brkstr);
+static char **ap_ldap_str2charray(apr_pool_t *pool,
+ const char *str,
+ const char *brkstr);
/**
* Is this URL an ldap url?
*
*/
-APR_DECLARE(int) apr_ldap_is_ldap_url(const char *url)
+MODLDAP_DECLARE(int) ap_ldap_is_ldap_url(const char *url)
{
int enclosed;
const char * scheme;
@@ -134,7 +135,7 @@ APR_DECLARE(int) apr_ldap_is_ldap_url(co
* Is this URL a secure ldap url?
*
*/
-APR_DECLARE(int) apr_ldap_is_ldaps_url(const char *url)
+MODLDAP_DECLARE(int) ap_ldap_is_ldaps_url(const char *url)
{
int enclosed;
const char * scheme;
@@ -154,7 +155,7 @@ APR_DECLARE(int) apr_ldap_is_ldaps_url(c
* Is this URL an ldap socket url?
*
*/
-APR_DECLARE(int) apr_ldap_is_ldapi_url(const char *url)
+MODLDAP_DECLARE(int) ap_ldap_is_ldapi_url(const char *url)
{
int enclosed;
const char * scheme;
@@ -195,30 +196,30 @@ static const char *skip_url_prefix(const
}
/* skip leading "URL:" (if any) */
- if ( strncasecmp( p, APR_LDAP_URL_URLCOLON, APR_LDAP_URL_URLCOLON_LEN ) == 0 ) {
- p += APR_LDAP_URL_URLCOLON_LEN;
+ if ( strncasecmp( p, AP_LDAP_URL_URLCOLON, AP_LDAP_URL_URLCOLON_LEN ) == 0 ) {
+ p += AP_LDAP_URL_URLCOLON_LEN;
}
/* check for "ldap://" prefix */
- if ( strncasecmp( p, APR_LDAP_URL_PREFIX, APR_LDAP_URL_PREFIX_LEN ) == 0 ) {
+ if ( strncasecmp( p, AP_LDAP_URL_PREFIX, AP_LDAP_URL_PREFIX_LEN ) == 0 ) {
/* skip over "ldap://" prefix and return success */
- p += APR_LDAP_URL_PREFIX_LEN;
+ p += AP_LDAP_URL_PREFIX_LEN;
*scheme = "ldap";
return( p );
}
/* check for "ldaps://" prefix */
- if ( strncasecmp( p, APR_LDAPS_URL_PREFIX, APR_LDAPS_URL_PREFIX_LEN ) == 0 ) {
+ if ( strncasecmp( p, AP_LDAPS_URL_PREFIX, AP_LDAPS_URL_PREFIX_LEN ) == 0 ) {
/* skip over "ldaps://" prefix and return success */
- p += APR_LDAPS_URL_PREFIX_LEN;
+ p += AP_LDAPS_URL_PREFIX_LEN;
*scheme = "ldaps";
return( p );
}
/* check for "ldapi://" prefix */
- if ( strncasecmp( p, APR_LDAPI_URL_PREFIX, APR_LDAPI_URL_PREFIX_LEN ) == 0 ) {
+ if ( strncasecmp( p, AP_LDAPI_URL_PREFIX, AP_LDAPI_URL_PREFIX_LEN ) == 0 ) {
/* skip over "ldapi://" prefix and return success */
- p += APR_LDAPI_URL_PREFIX_LEN;
+ p += AP_LDAPI_URL_PREFIX_LEN;
*scheme = "ldapi";
return( p );
}
@@ -250,31 +251,31 @@ static int str2scope(const char *p)
/**
- * Parse the URL provided into an apr_ldap_url_desc_t object.
+ * Parse the URL provided into an ap_ldap_url_desc_t object.
*
* APR_SUCCESS is returned on success, APR_EGENERAL on failure.
* The LDAP result code and reason string is returned in the
- * apr_ldap_err_t structure.
+ * ap_ldap_err_t structure.
*/
-APR_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool,
- const char *url_in,
- apr_ldap_url_desc_t **ludpp,
- apr_ldap_err_t **result_err)
+MODLDAP_DECLARE(int) ap_ldap_url_parse_ext(apr_pool_t *pool,
+ const char *url_in,
+ ap_ldap_url_desc_t **ludpp,
+ ap_ldap_err_t **result_err)
{
- apr_ldap_url_desc_t *ludp;
+ ap_ldap_url_desc_t *ludp;
char *p, *q, *r;
int i, enclosed;
const char *scheme = NULL;
const char *url_tmp;
char *url;
- apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t));
+ ap_ldap_err_t *result = (ap_ldap_err_t *)apr_pcalloc(pool, sizeof(ap_ldap_err_t));
*result_err = result;
/* sanity check our parameters */
if( url_in == NULL || ludpp == NULL ) {
result->reason = "Either the LDAP URL, or the URL structure was NULL. Oops.";
- result->rc = APR_LDAP_URL_ERR_PARAM;
+ result->rc = AP_LDAP_URL_ERR_PARAM;
return APR_EGENERAL;
}
@@ -283,7 +284,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
url_tmp = skip_url_prefix( url_in, &enclosed, &scheme );
if ( url_tmp == NULL ) {
result->reason = "The scheme was not recognised as a valid LDAP URL scheme.";
- result->rc = APR_LDAP_URL_ERR_BADSCHEME;
+ result->rc = AP_LDAP_URL_ERR_BADSCHEME;
return APR_EGENERAL;
}
@@ -291,7 +292,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
url = (char *)apr_pstrdup(pool, url_tmp);
if ( url == NULL ) {
result->reason = "Out of memory parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_MEM;
+ result->rc = AP_LDAP_URL_ERR_MEM;
return APR_EGENERAL;
}
@@ -300,7 +301,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( *p != '>' ) {
result->reason = "Bad enclosure error while parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_BADENCLOSURE;
+ result->rc = AP_LDAP_URL_ERR_BADENCLOSURE;
return APR_EGENERAL;
}
@@ -308,10 +309,10 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
}
/* allocate return struct */
- ludp = (apr_ldap_url_desc_t *)apr_pcalloc(pool, sizeof(apr_ldap_url_desc_t));
+ ludp = (ap_ldap_url_desc_t *)apr_pcalloc(pool, sizeof(ap_ldap_url_desc_t));
if ( ludp == NULL ) {
result->reason = "Out of memory parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_MEM;
+ result->rc = AP_LDAP_URL_ERR_MEM;
return APR_EGENERAL;
}
@@ -328,7 +329,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
ludp->lud_scheme = (char *)apr_pstrdup(pool, scheme);
if ( ludp->lud_scheme == NULL ) {
result->reason = "Out of memory parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_MEM;
+ result->rc = AP_LDAP_URL_ERR_MEM;
return APR_EGENERAL;
}
@@ -349,7 +350,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
r = strchr( url, ']' );
if ( r == NULL ) {
result->reason = "Bad LDAP URL while parsing IPV6 syntax.";
- result->rc = APR_LDAP_URL_ERR_BADURL;
+ result->rc = AP_LDAP_URL_ERR_BADURL;
return APR_EGENERAL;
}
*r++ = '\0';
@@ -359,24 +360,24 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
}
if ( q != NULL ) {
- apr_ldap_pvt_hex_unescape( ++q );
+ ap_ldap_pvt_hex_unescape( ++q );
if( *q == '\0' ) {
result->reason = "Bad LDAP URL while parsing.";
- result->rc = APR_LDAP_URL_ERR_BADURL;
+ result->rc = AP_LDAP_URL_ERR_BADURL;
return APR_EGENERAL;
}
ludp->lud_port = atoi( q );
}
- apr_ldap_pvt_hex_unescape( url );
+ ap_ldap_pvt_hex_unescape( url );
/* If [ip address]:port syntax, url is [ip and we skip the [ */
ludp->lud_host = (char *)apr_pstrdup(pool, url + ( *url == '[' ));
if( ludp->lud_host == NULL ) {
result->reason = "Out of memory parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_MEM;
+ result->rc = AP_LDAP_URL_ERR_MEM;
return APR_EGENERAL;
}
@@ -396,7 +397,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
q++;
if( *q != '\0' ) {
/* parse dn part */
- apr_ldap_pvt_hex_unescape( q );
+ ap_ldap_pvt_hex_unescape( q );
ludp->lud_dn = (char *)apr_pstrdup(pool, q);
} else {
ludp->lud_dn = (char *)apr_pstrdup(pool, "");
@@ -404,7 +405,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( ludp->lud_dn == NULL ) {
result->reason = "Out of memory parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_MEM;
+ result->rc = AP_LDAP_URL_ERR_MEM;
return APR_EGENERAL;
}
}
@@ -425,7 +426,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( *p != '\0' ) {
/* parse dn part */
- apr_ldap_pvt_hex_unescape( p );
+ ap_ldap_pvt_hex_unescape( p );
ludp->lud_dn = (char *)apr_pstrdup(pool, p);
} else {
ludp->lud_dn = (char *)apr_pstrdup(pool, "");
@@ -433,7 +434,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( ludp->lud_dn == NULL ) {
result->reason = "Out of memory parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_MEM;
+ result->rc = AP_LDAP_URL_ERR_MEM;
return APR_EGENERAL;
}
@@ -454,12 +455,12 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( *p != '\0' ) {
/* parse attributes */
- apr_ldap_pvt_hex_unescape( p );
- ludp->lud_attrs = apr_ldap_str2charray(pool, p, ",");
+ ap_ldap_pvt_hex_unescape( p );
+ ludp->lud_attrs = ap_ldap_str2charray(pool, p, ",");
if( ludp->lud_attrs == NULL ) {
result->reason = "Bad attributes encountered while parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_BADATTRS;
+ result->rc = AP_LDAP_URL_ERR_BADATTRS;
return APR_EGENERAL;
}
}
@@ -481,12 +482,12 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( *p != '\0' ) {
/* parse the scope */
- apr_ldap_pvt_hex_unescape( p );
+ ap_ldap_pvt_hex_unescape( p );
ludp->lud_scope = str2scope( p );
if( ludp->lud_scope == -1 ) {
result->reason = "Bad scope encountered while parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_BADSCOPE;
+ result->rc = AP_LDAP_URL_ERR_BADSCOPE;
return APR_EGENERAL;
}
}
@@ -508,19 +509,19 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( *p != '\0' ) {
/* parse the filter */
- apr_ldap_pvt_hex_unescape( p );
+ ap_ldap_pvt_hex_unescape( p );
if( ! *p ) {
/* missing filter */
result->reason = "Bad filter encountered while parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_BADFILTER;
+ result->rc = AP_LDAP_URL_ERR_BADFILTER;
return APR_EGENERAL;
}
ludp->lud_filter = (char *)apr_pstrdup(pool, p);
if( ludp->lud_filter == NULL ) {
result->reason = "Out of memory parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_MEM;
+ result->rc = AP_LDAP_URL_ERR_MEM;
return APR_EGENERAL;
}
}
@@ -538,20 +539,20 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( q != NULL ) {
/* extra '?' */
result->reason = "Bad URL encountered while parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_BADURL;
+ result->rc = AP_LDAP_URL_ERR_BADURL;
return APR_EGENERAL;
}
/* parse the extensions */
- ludp->lud_exts = apr_ldap_str2charray(pool, p, ",");
+ ludp->lud_exts = ap_ldap_str2charray(pool, p, ",");
if( ludp->lud_exts == NULL ) {
result->reason = "Bad extensions encountered while parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_BADEXTS;
+ result->rc = AP_LDAP_URL_ERR_BADEXTS;
return APR_EGENERAL;
}
for( i=0; ludp->lud_exts[i] != NULL; i++ ) {
- apr_ldap_pvt_hex_unescape( ludp->lud_exts[i] );
+ ap_ldap_pvt_hex_unescape( ludp->lud_exts[i] );
if( *ludp->lud_exts[i] == '!' ) {
/* count the number of critical extensions */
@@ -562,7 +563,7 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
if( i == 0 ) {
/* must have 1 or more */
result->reason = "Bad extensions encountered while parsing LDAP URL.";
- result->rc = APR_LDAP_URL_ERR_BADEXTS;
+ result->rc = AP_LDAP_URL_ERR_BADEXTS;
return APR_EGENERAL;
}
@@ -573,19 +574,19 @@ APR_DECLARE(int) apr_ldap_url_parse_ext(
/**
- * Parse the URL provided into an apr_ldap_url_desc_t object.
+ * Parse the URL provided into an ap_ldap_url_desc_t object.
*
* APR_SUCCESS is returned on success, APR_EGENERAL on failure.
* The LDAP result code and reason string is returned in the
- * apr_ldap_err_t structure.
+ * ap_ldap_err_t structure.
*/
-APR_DECLARE(int) apr_ldap_url_parse(apr_pool_t *pool,
- const char *url_in,
- apr_ldap_url_desc_t **ludpp,
- apr_ldap_err_t **result_err)
+MODLDAP_DECLARE(int) ap_ldap_url_parse(apr_pool_t *pool,
+ const char *url_in,
+ ap_ldap_url_desc_t **ludpp,
+ ap_ldap_err_t **result_err)
{
- int rc = apr_ldap_url_parse_ext(pool, url_in, ludpp, result_err);
+ int rc = ap_ldap_url_parse_ext(pool, url_in, ludpp, result_err);
if( rc != APR_SUCCESS ) {
return rc;
}
@@ -603,7 +604,7 @@ APR_DECLARE(int) apr_ldap_url_parse(apr_
}
-static void apr_ldap_pvt_hex_unescape(char *s)
+static void ap_ldap_pvt_hex_unescape(char *s)
{
/*
* Remove URL hex escapes from s... done in place. The basic concept for
@@ -616,11 +617,11 @@ static void apr_ldap_pvt_hex_unescape(ch
if ( *++s == '\0' ) {
break;
}
- *p = apr_ldap_pvt_unhex( *s ) << 4;
+ *p = ap_ldap_pvt_unhex( *s ) << 4;
if ( *++s == '\0' ) {
break;
}
- *p++ += apr_ldap_pvt_unhex( *s );
+ *p++ += ap_ldap_pvt_unhex( *s );
} else {
*p++ = *s;
}
@@ -630,7 +631,7 @@ static void apr_ldap_pvt_hex_unescape(ch
}
-static int apr_ldap_pvt_unhex(int c)
+static int ap_ldap_pvt_unhex(int c)
{
return( c >= '0' && c <= '9' ? c - '0'
: c >= 'A' && c <= 'F' ? c - 'A' + 10
@@ -641,9 +642,9 @@ static int apr_ldap_pvt_unhex(int c)
/**
* Convert a string to a character array
*/
-static char **apr_ldap_str2charray(apr_pool_t *pool,
- const char *str_in,
- const char *brkstr)
+static char **ap_ldap_str2charray(apr_pool_t *pool,
+ const char *str_in,
+ const char *brkstr)
{
char **res;
char *str, *s;
@@ -691,4 +692,4 @@ static char **apr_ldap_str2charray(apr_p
}
-#endif /* APR_HAS_LDAP */
+#endif /* AP_HAS_LDAP */
Modified: httpd/httpd/trunk/modules/ldap/config.m4
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/config.m4?rev=1129808&r1=1129807&r2=1129808&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/config.m4 (original)
+++ httpd/httpd/trunk/modules/ldap/config.m4 Tue May 31 17:10:11 2011
@@ -3,12 +3,22 @@ dnl APACHE_MODULE(name, helptext[, objec
APACHE_MODPATH_INIT(ldap)
-ldap_objects="util_ldap.lo util_ldap_cache.lo util_ldap_cache_mgr.lo"
+ldap_objects="dnl
+util_ldap.lo dnl
+util_ldap_cache.lo dnl
+util_ldap_cache_mgr.lo dnl
+ap_ldap_init.lo dnl
+ap_ldap_option.lo dnl
+ap_ldap_rebind.lo dnl
+ap_ldap_url.lo dnl
+"
+
APACHE_MODULE(ldap, LDAP caching and connection pooling services, $ldap_objects, , no, [
+ AP_FIND_LDAP
if test -z "$apu_config" ; then
- MOD_LDAP_LDADD="`$apr_config --ldap-libs`"
+ MOD_LDAP_LDADD="$LDADD_ldap"
else
- MOD_LDAP_LDADD="`$apu_config --ldap-libs`"
+ MOD_LDAP_LDADD="$LDADD_ldap"
fi
AC_SUBST(MOD_LDAP_LDADD)
])
Modified: httpd/httpd/trunk/modules/ldap/util_ldap.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/util_ldap.c?rev=1129808&r1=1129807&r2=1129808&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap.c (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap.c Tue May 31 17:10:11 2011
@@ -38,17 +38,8 @@
#include <unistd.h>
#endif
-#if !APR_HAS_LDAP
-#error mod_ldap requires APR-util to have LDAP support built in
-#endif
-
-/* Default define for ldap functions that need a SIZELIMIT but
- * do not have the define
- * XXX This should be removed once a supporting #define is
- * released through APR-Util.
- */
-#ifndef APR_LDAP_SIZELIMIT
-#define APR_LDAP_SIZELIMIT -1
+#if !AP_HAS_LDAP
+#error mod_ldap requires httpd to detect LDAP support
#endif
#ifdef LDAP_OPT_DEBUG_LEVEL
@@ -181,7 +172,7 @@ static apr_status_t uldap_connection_unb
/* forget the rebind info for this conn */
if (ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
- apr_ldap_rebind_remove(ldc->ldap);
+ ap_ldap_rebind_remove(ldc->ldap);
apr_pool_clear(ldc->rebind_pool);
}
}
@@ -251,7 +242,7 @@ static int uldap_connection_init(request
{
int rc = 0, ldap_option = 0;
int version = LDAP_VERSION3;
- apr_ldap_err_t *result = NULL;
+ ap_ldap_err_t *result = NULL;
#ifdef LDAP_OPT_NETWORK_TIMEOUT
struct timeval connectionTimeout = {10,0}; /* 10 second connection timeout */
#endif
@@ -265,10 +256,10 @@ static int uldap_connection_init(request
* some hosts with ports and some without. All hosts which do not
* specify a port will use the default port.
*/
- apr_ldap_init(r->pool, &(ldc->ldap),
+ ap_ldap_init(r->pool, &(ldc->ldap),
ldc->host,
- APR_LDAP_SSL == ldc->secure ? LDAPS_PORT : LDAP_PORT,
- APR_LDAP_NONE,
+ AP_LDAP_SSL == ldc->secure ? LDAPS_PORT : LDAP_PORT,
+ AP_LDAP_NONE,
&(result));
if (NULL == result) {
@@ -300,7 +291,7 @@ static int uldap_connection_init(request
if (ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
/* Now that we have an ldap struct, add it to the referral list for rebinds. */
- rc = apr_ldap_rebind_add(ldc->rebind_pool, ldc->ldap, ldc->binddn, ldc->bindpw);
+ rc = ap_ldap_rebind_add(ldc->rebind_pool, ldc->ldap, ldc->binddn, ldc->bindpw);
if (rc != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rc, r->server,
"LDAP: Unable to add rebind cross reference entry. Out of memory?");
@@ -315,7 +306,7 @@ static int uldap_connection_init(request
/* set client certificates */
if (!apr_is_empty_array(ldc->client_certs)) {
- apr_ldap_set_option(r->pool, ldc->ldap, APR_LDAP_OPT_TLS_CERT,
+ ap_ldap_set_option(r->pool, ldc->ldap, AP_LDAP_OPT_TLS_CERT,
ldc->client_certs, &(result));
if (LDAP_SUCCESS != result->rc) {
uldap_connection_unbind( ldc );
@@ -325,9 +316,9 @@ static int uldap_connection_init(request
}
/* switch on SSL/TLS */
- if (APR_LDAP_NONE != ldc->secure) {
- apr_ldap_set_option(r->pool, ldc->ldap,
- APR_LDAP_OPT_TLS, &ldc->secure, &(result));
+ if (AP_LDAP_NONE != ldc->secure) {
+ ap_ldap_set_option(r->pool, ldc->ldap,
+ AP_LDAP_OPT_TLS, &ldc->secure, &(result));
if (LDAP_SUCCESS != result->rc) {
uldap_connection_unbind( ldc );
ldc->reason = result->reason;
@@ -344,8 +335,8 @@ static int uldap_connection_init(request
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"LDAP: Setting referrals to %s.",
((ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) ? "On" : "Off"));
- apr_ldap_set_option(r->pool, ldc->ldap,
- APR_LDAP_OPT_REFERRALS,
+ ap_ldap_set_option(r->pool, ldc->ldap,
+ AP_LDAP_OPT_REFERRALS,
(void *)((ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) ?
LDAP_OPT_ON : LDAP_OPT_OFF),
&(result));
@@ -365,8 +356,8 @@ static int uldap_connection_init(request
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"Setting referral hop limit to %d.",
ldc->ReferralHopLimit);
- apr_ldap_set_option(r->pool, ldc->ldap,
- APR_LDAP_OPT_REFHOPLIMIT,
+ ap_ldap_set_option(r->pool, ldc->ldap,
+ AP_LDAP_OPT_REFHOPLIMIT,
(void *)&ldc->ReferralHopLimit,
&(result));
if (result->rc != LDAP_SUCCESS) {
@@ -382,31 +373,8 @@ static int uldap_connection_init(request
}
}
-/*XXX All of the #ifdef's need to be removed once apr-util 1.2 is released */
-#ifdef APR_LDAP_OPT_VERIFY_CERT
- apr_ldap_set_option(r->pool, ldc->ldap, APR_LDAP_OPT_VERIFY_CERT,
+ ap_ldap_set_option(r->pool, ldc->ldap, AP_LDAP_OPT_VERIFY_CERT,
&(st->verify_svr_cert), &(result));
-#else
-#if defined(LDAPSSL_VERIFY_SERVER)
- if (st->verify_svr_cert) {
- result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_SERVER);
- }
- else {
- result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_NONE);
- }
-#elif defined(LDAP_OPT_X_TLS_REQUIRE_CERT)
- /* This is not a per-connection setting so just pass NULL for the
- Ldap connection handle */
- if (st->verify_svr_cert) {
- int i = LDAP_OPT_X_TLS_DEMAND;
- result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
- }
- else {
- int i = LDAP_OPT_X_TLS_NEVER;
- result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
- }
-#endif
-#endif
#ifdef LDAP_OPT_NETWORK_TIMEOUT
if (st->connectionTimeout > 0) {
@@ -414,7 +382,7 @@ static int uldap_connection_init(request
}
if (st->connectionTimeout >= 0) {
- rc = apr_ldap_set_option(r->pool, ldc->ldap, LDAP_OPT_NETWORK_TIMEOUT,
+ rc = ap_ldap_set_option(r->pool, ldc->ldap, LDAP_OPT_NETWORK_TIMEOUT,
(void *)&connectionTimeout, &(result));
if (APR_SUCCESS != rc) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
@@ -433,7 +401,7 @@ static int uldap_connection_init(request
* XXX: ldap_result() with a timeout.
*/
if (st->opTimeout) {
- rc = apr_ldap_set_option(r->pool, ldc->ldap, LDAP_OPT_TIMEOUT,
+ rc = ap_ldap_set_option(r->pool, ldc->ldap, LDAP_OPT_TIMEOUT,
st->opTimeout, &(result));
if (APR_SUCCESS != rc) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
@@ -588,7 +556,7 @@ static int compare_client_certs(apr_arra
apr_array_header_t *dests)
{
int i = 0;
- struct apr_ldap_opt_tls_cert_t *src, *dest;
+ struct ap_ldap_opt_tls_cert_t *src, *dest;
/* arrays both NULL? if so, then equal */
if (srcs == NULL && dests == NULL) {
@@ -601,8 +569,8 @@ static int compare_client_certs(apr_arra
}
/* run an actual comparison */
- src = (struct apr_ldap_opt_tls_cert_t *)srcs->elts;
- dest = (struct apr_ldap_opt_tls_cert_t *)dests->elts;
+ src = (struct ap_ldap_opt_tls_cert_t *)srcs->elts;
+ dest = (struct ap_ldap_opt_tls_cert_t *)dests->elts;
for (i = 0; i < srcs->nelts; i++) {
if ((strcmp(src[i].path, dest[i].path)) ||
(src[i].type != dest[i].type) ||
@@ -649,7 +617,7 @@ static util_ldap_connection_t *
apr_thread_mutex_lock(st->mutex);
#endif
- if (secure < APR_LDAP_NONE) {
+ if (secure < AP_LDAP_NONE) {
secureflag = st->secure;
}
@@ -763,7 +731,7 @@ static util_ldap_connection_t *
l->ReferralHopLimit = dc->ReferralHopLimit;
/* The security mode after parsing the URL will always be either
- * APR_LDAP_NONE (ldap://) or APR_LDAP_SSL (ldaps://).
+ * AP_LDAP_NONE (ldap://) or AP_LDAP_SSL (ldaps://).
* If the security setting is NONE, override it to the security
* setting optionally supplied by the admin using LDAPTrustedMode
*/
@@ -885,7 +853,7 @@ start_over:
/* search for reqdn */
result = ldap_search_ext_s(ldc->ldap, (char *)reqdn, LDAP_SCOPE_BASE,
"(objectclass=*)", NULL, 1,
- NULL, NULL, st->opTimeout, APR_LDAP_SIZELIMIT, &res);
+ NULL, NULL, st->opTimeout, AP_LDAP_SIZELIMIT, &res);
if (AP_LDAP_IS_SERVER_DOWN(result))
{
ldc->reason = "DN Comparison ldap_search_ext_s() "
@@ -1144,7 +1112,7 @@ start_over:
/* try to do the search */
result = ldap_search_ext_s(ldc->ldap, (char *)dn, LDAP_SCOPE_BASE,
(char *)"cn=*", subgroupAttrs, 0,
- NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &sga_res);
+ NULL, NULL, NULL, AP_LDAP_SIZELIMIT, &sga_res);
if (AP_LDAP_IS_SERVER_DOWN(result)) {
ldc->reason = "ldap_search_ext_s() for subgroups failed with server"
" down";
@@ -1615,7 +1583,7 @@ start_over:
result = ldap_search_ext_s(ldc->ldap,
(char *)basedn, scope,
(char *)filter, attrs, 0,
- NULL, NULL, st->opTimeout, APR_LDAP_SIZELIMIT, &res);
+ NULL, NULL, st->opTimeout, AP_LDAP_SIZELIMIT, &res);
if (AP_LDAP_IS_SERVER_DOWN(result))
{
ldc->reason = "ldap_search_ext_s() for user failed with server down";
@@ -1866,7 +1834,7 @@ start_over:
result = ldap_search_ext_s(ldc->ldap,
(char *)basedn, scope,
(char *)filter, attrs, 0,
- NULL, NULL, st->opTimeout, APR_LDAP_SIZELIMIT, &res);
+ NULL, NULL, st->opTimeout, AP_LDAP_SIZELIMIT, &res);
if (AP_LDAP_IS_SERVER_DOWN(result))
{
ldc->reason = "ldap_search_ext_s() for user failed with server down";
@@ -2136,72 +2104,72 @@ static const char *util_ldap_set_opcache
* CA_DER, CA_BASE64, CA_CERT7_DB, CA_SECMOD, CERT_DER, CERT_BASE64,
* CERT_KEY3_DB, CERT_NICKNAME, KEY_DER, KEY_BASE64
*
- * If no matches are found, APR_LDAP_CA_TYPE_UNKNOWN is returned.
+ * If no matches are found, AP_LDAP_CA_TYPE_UNKNOWN is returned.
*/
static int util_ldap_parse_cert_type(const char *type)
{
/* Authority file in binary DER format */
if (0 == strcasecmp("CA_DER", type)) {
- return APR_LDAP_CA_TYPE_DER;
+ return AP_LDAP_CA_TYPE_DER;
}
/* Authority file in Base64 format */
else if (0 == strcasecmp("CA_BASE64", type)) {
- return APR_LDAP_CA_TYPE_BASE64;
+ return AP_LDAP_CA_TYPE_BASE64;
}
/* Netscape certificate database file/directory */
else if (0 == strcasecmp("CA_CERT7_DB", type)) {
- return APR_LDAP_CA_TYPE_CERT7_DB;
+ return AP_LDAP_CA_TYPE_CERT7_DB;
}
/* Netscape secmod file/directory */
else if (0 == strcasecmp("CA_SECMOD", type)) {
- return APR_LDAP_CA_TYPE_SECMOD;
+ return AP_LDAP_CA_TYPE_SECMOD;
}
/* Client cert file in DER format */
else if (0 == strcasecmp("CERT_DER", type)) {
- return APR_LDAP_CERT_TYPE_DER;
+ return AP_LDAP_CERT_TYPE_DER;
}
/* Client cert file in Base64 format */
else if (0 == strcasecmp("CERT_BASE64", type)) {
- return APR_LDAP_CERT_TYPE_BASE64;
+ return AP_LDAP_CERT_TYPE_BASE64;
}
/* Client cert file in PKCS#12 format */
else if (0 == strcasecmp("CERT_PFX", type)) {
- return APR_LDAP_CERT_TYPE_PFX;
+ return AP_LDAP_CERT_TYPE_PFX;
}
/* Netscape client cert database file/directory */
else if (0 == strcasecmp("CERT_KEY3_DB", type)) {
- return APR_LDAP_CERT_TYPE_KEY3_DB;
+ return AP_LDAP_CERT_TYPE_KEY3_DB;
}
/* Netscape client cert nickname */
else if (0 == strcasecmp("CERT_NICKNAME", type)) {
- return APR_LDAP_CERT_TYPE_NICKNAME;
+ return AP_LDAP_CERT_TYPE_NICKNAME;
}
/* Client cert key file in DER format */
else if (0 == strcasecmp("KEY_DER", type)) {
- return APR_LDAP_KEY_TYPE_DER;
+ return AP_LDAP_KEY_TYPE_DER;
}
/* Client cert key file in Base64 format */
else if (0 == strcasecmp("KEY_BASE64", type)) {
- return APR_LDAP_KEY_TYPE_BASE64;
+ return AP_LDAP_KEY_TYPE_BASE64;
}
/* Client cert key file in PKCS#12 format */
else if (0 == strcasecmp("KEY_PFX", type)) {
- return APR_LDAP_KEY_TYPE_PFX;
+ return AP_LDAP_KEY_TYPE_PFX;
}
else {
- return APR_LDAP_CA_TYPE_UNKNOWN;
+ return AP_LDAP_CA_TYPE_UNKNOWN;
}
}
@@ -2230,7 +2198,7 @@ static const char *util_ldap_set_trusted
apr_finfo_t finfo;
apr_status_t rv;
int cert_type = 0;
- apr_ldap_opt_tls_cert_t *cert;
+ ap_ldap_opt_tls_cert_t *cert;
if (err != NULL) {
return err;
@@ -2239,7 +2207,7 @@ static const char *util_ldap_set_trusted
/* handle the certificate type */
if (type) {
cert_type = util_ldap_parse_cert_type(type);
- if (APR_LDAP_CA_TYPE_UNKNOWN == cert_type) {
+ if (AP_LDAP_CA_TYPE_UNKNOWN == cert_type) {
return apr_psprintf(cmd->pool, "The certificate type %s is "
"not recognised. It should be one "
"of CA_DER, CA_BASE64, CA_CERT7_DB, "
@@ -2257,14 +2225,14 @@ static const char *util_ldap_set_trusted
file, type);
/* add the certificate to the global array */
- cert = (apr_ldap_opt_tls_cert_t *)apr_array_push(st->global_certs);
+ cert = (ap_ldap_opt_tls_cert_t *)apr_array_push(st->global_certs);
cert->type = cert_type;
cert->path = file;
cert->password = password;
/* if file is a file or path, fix the path */
- if (cert_type != APR_LDAP_CA_TYPE_UNKNOWN &&
- cert_type != APR_LDAP_CERT_TYPE_NICKNAME) {
+ if (cert_type != AP_LDAP_CA_TYPE_UNKNOWN &&
+ cert_type != AP_LDAP_CERT_TYPE_NICKNAME) {
cert->path = ap_server_root_relative(cmd->pool, file);
if (cert->path &&
@@ -2301,12 +2269,12 @@ static const char *util_ldap_set_trusted
apr_finfo_t finfo;
apr_status_t rv;
int cert_type = 0;
- apr_ldap_opt_tls_cert_t *cert;
+ ap_ldap_opt_tls_cert_t *cert;
/* handle the certificate type */
if (type) {
cert_type = util_ldap_parse_cert_type(type);
- if (APR_LDAP_CA_TYPE_UNKNOWN == cert_type) {
+ if (AP_LDAP_CA_TYPE_UNKNOWN == cert_type) {
return apr_psprintf(cmd->pool, "The certificate type \"%s\" is "
"not recognised. It should be one "
"of CA_DER, CA_BASE64, "
@@ -2315,10 +2283,10 @@ static const char *util_ldap_set_trusted
"KEY_DER, KEY_BASE64, KEY_PFX",
type);
}
- else if ( APR_LDAP_CA_TYPE_CERT7_DB == cert_type ||
- APR_LDAP_CA_TYPE_SECMOD == cert_type ||
- APR_LDAP_CERT_TYPE_PFX == cert_type ||
- APR_LDAP_CERT_TYPE_KEY3_DB == cert_type) {
+ else if ( AP_LDAP_CA_TYPE_CERT7_DB == cert_type ||
+ AP_LDAP_CA_TYPE_SECMOD == cert_type ||
+ AP_LDAP_CERT_TYPE_PFX == cert_type ||
+ AP_LDAP_CERT_TYPE_KEY3_DB == cert_type) {
return apr_psprintf(cmd->pool, "The certificate type \"%s\" is "
"only valid within a "
"LDAPTrustedGlobalCert directive. "
@@ -2337,14 +2305,14 @@ static const char *util_ldap_set_trusted
file, type);
/* add the certificate to the client array */
- cert = (apr_ldap_opt_tls_cert_t *)apr_array_push(dc->client_certs);
+ cert = (ap_ldap_opt_tls_cert_t *)apr_array_push(dc->client_certs);
cert->type = cert_type;
cert->path = file;
cert->password = password;
/* if file is a file or path, fix the path */
- if (cert_type != APR_LDAP_CA_TYPE_UNKNOWN &&
- cert_type != APR_LDAP_CERT_TYPE_NICKNAME) {
+ if (cert_type != AP_LDAP_CA_TYPE_UNKNOWN &&
+ cert_type != AP_LDAP_CERT_TYPE_NICKNAME) {
cert->path = ap_server_root_relative(cmd->pool, file);
if (cert->path &&
@@ -2384,14 +2352,14 @@ static const char *util_ldap_set_trusted
mode);
if (0 == strcasecmp("NONE", mode)) {
- st->secure = APR_LDAP_NONE;
+ st->secure = AP_LDAP_NONE;
}
else if (0 == strcasecmp("SSL", mode)) {
- st->secure = APR_LDAP_SSL;
+ st->secure = AP_LDAP_SSL;
}
else if ( (0 == strcasecmp("TLS", mode))
|| (0 == strcasecmp("STARTTLS", mode))) {
- st->secure = APR_LDAP_STARTTLS;
+ st->secure = AP_LDAP_STARTTLS;
}
else {
return "Invalid LDAPTrustedMode setting: must be one of NONE, "
@@ -2515,7 +2483,7 @@ static void *util_ldap_create_dir_config
(util_ldap_config_t *) apr_pcalloc(p,sizeof(util_ldap_config_t));
/* defaults are AP_LDAP_CHASEREFERRALS_ON and AP_LDAP_DEFAULT_HOPLIMIT */
- dc->client_certs = apr_array_make(p, 10, sizeof(apr_ldap_opt_tls_cert_t));
+ dc->client_certs = apr_array_make(p, 10, sizeof(ap_ldap_opt_tls_cert_t));
dc->ChaseReferrals = AP_LDAP_CHASEREFERRALS_ON;
dc->ReferralHopLimit = AP_LDAP_HOPLIMIT_UNSET;
@@ -2614,8 +2582,8 @@ static void *util_ldap_create_config(apr
st->compare_cache_size = 1024;
st->connections = NULL;
st->ssl_supported = 0;
- st->global_certs = apr_array_make(p, 10, sizeof(apr_ldap_opt_tls_cert_t));
- st->secure = APR_LDAP_NONE;
+ st->global_certs = apr_array_make(p, 10, sizeof(ap_ldap_opt_tls_cert_t));
+ st->secure = AP_LDAP_NONE;
st->secure_set = 0;
st->connectionTimeout = 10;
st->opTimeout = apr_pcalloc(p, sizeof(struct timeval));
@@ -2687,7 +2655,7 @@ static apr_status_t util_ldap_cleanup_mo
s->module_config, &ldap_module);
if (st->ssl_supported) {
- apr_ldap_ssl_deinit();
+ ap_ldap_ssl_deinit();
}
return APR_SUCCESS;
@@ -2719,7 +2687,7 @@ static int util_ldap_post_config(apr_poo
ap_get_module_config(s->module_config,
&ldap_module);
- apr_ldap_err_t *result_err = NULL;
+ ap_ldap_err_t *result_err = NULL;
int rc;
/* util_ldap_post_config() will be called twice. Don't bother
@@ -2792,8 +2760,8 @@ static int util_ldap_post_config(apr_poo
/* log the LDAP SDK used
*/
{
- apr_ldap_err_t *result = NULL;
- apr_ldap_info(p, &(result));
+ ap_ldap_err_t *result = NULL;
+ ap_ldap_info(p, &(result));
if (result != NULL) {
ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "%s", result->reason);
}
@@ -2808,12 +2776,12 @@ static int util_ldap_post_config(apr_poo
* If SSL is not supported it is not necessarily an error, as the
* application may not want to use it.
*/
- rc = apr_ldap_ssl_init(p,
+ rc = ap_ldap_ssl_init(p,
NULL,
0,
&(result_err));
if (APR_SUCCESS == rc) {
- rc = apr_ldap_set_option(ptemp, NULL, APR_LDAP_OPT_TLS_CERT,
+ rc = ap_ldap_set_option(ptemp, NULL, AP_LDAP_OPT_TLS_CERT,
(void *)st->global_certs, &(result_err));
}
@@ -2831,7 +2799,7 @@ static int util_ldap_post_config(apr_poo
}
/* Initialize the rebind callback's cross reference list. */
- apr_ldap_rebind_init (p);
+ ap_ldap_rebind_init (p);
#ifdef AP_LDAP_OPT_DEBUG
if (st->debug_level > 0) {
Modified: httpd/httpd/trunk/modules/ldap/util_ldap_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/util_ldap_cache.c?rev=1129808&r1=1129807&r2=1129808&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap_cache.c (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap_cache.c Tue May 31 17:10:11 2011
@@ -27,7 +27,7 @@
#include "util_ldap_cache.h"
#include <apr_strings.h>
-#if APR_HAS_LDAP
+#if AP_HAS_LDAP
/* ------------------------------------------------------------------ */
@@ -461,4 +461,4 @@ apr_status_t util_ldap_cache_init(apr_po
}
-#endif /* APR_HAS_LDAP */
+#endif /* AP_HAS_LDAP */
Modified: httpd/httpd/trunk/modules/ldap/util_ldap_cache.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/util_ldap_cache.h?rev=1129808&r1=1129807&r2=1129808&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap_cache.h (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap_cache.h Tue May 31 17:10:11 2011
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef APU_LDAP_CACHE_H
-#define APU_LDAP_CACHE_H
+#ifndef AP_LDAP_CACHE_H
+#define AP_LDAP_CACHE_H
/**
* @file util_ldap_cache.h
@@ -23,7 +23,7 @@
*/
/* this whole thing disappears if LDAP is not enabled */
-#if APR_HAS_LDAP
+#if AP_HAS_LDAP
/*
@@ -200,5 +200,5 @@ void *util_ald_cache_insert(util_ald_cac
void util_ald_cache_remove(util_ald_cache_t *cache, void *payload);
char *util_ald_cache_display_stats(request_rec *r, util_ald_cache_t *cache, char *name, char *id);
-#endif /* APR_HAS_LDAP */
-#endif /* APU_LDAP_CACHE_H */
+#endif /* AP_HAS_LDAP */
+#endif /* AP_LDAP_CACHE_H */
Modified: httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c?rev=1129808&r1=1129807&r2=1129808&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c Tue May 31 17:10:11 2011
@@ -29,7 +29,7 @@
APLOG_USE_MODULE(ldap);
-#if APR_HAS_LDAP
+#if AP_HAS_LDAP
/* only here until strdup is gone */
#include <string.h>
@@ -877,4 +877,4 @@ char *util_ald_cache_display(request_rec
return buf;
}
-#endif /* APR_HAS_LDAP */
+#endif /* AP_HAS_LDAP */