You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2005/01/05 18:18:40 UTC

Re: svn commit: r124187 - /httpd/httpd/trunk/CHANGES /httpd/httpd/trunk/modules/ldap/util_ldap.c

At 01:07 AM 1/5/2005, minfrin@apache.org wrote:
>Author: minfrin
>Date: Tue Jan  4 23:07:46 2005
>New Revision: 124187
>
>URL: http://svn.apache.org/viewcvs?view=rev&rev=124187
>Log:
>Fix some compiler warnings inside the LDAP modules
>--- httpd/httpd/trunk/modules/ldap/util_ldap.c  (original)
>+++ httpd/httpd/trunk/modules/ldap/util_ldap.c  Tue Jan  4 23:07:46 2005
>@@ -264,7 +264,8 @@
>           a host string that contains multiple hosts the ability to mix 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), ldc->host, ldc->secure?LDAPS_PORT:LDAP_PORT,
>+        apr_ldap_init(r->pool, &(ldc->ldap),
>+                      ldc->host, ldc->secure?LDAPS_PORT:LDAP_PORT,
>                       ldc->secure, &(result));

Based on your new schema, don't you mean
+        apr_ldap_init(r->pool, &(ldc->ldap),
+                      ldc->host, (ldc->secure==1)?LDAPS_PORT:LDAP_PORT,
                       ldc->secure, &(result));

>@@ -298,7 +299,9 @@
>       */
>     for (failures=0; failures<10; failures++)
>     {
>-        result = ldap_simple_bind_s(ldc->ldap, ldc->binddn, ldc->bindpw);
>+        result = ldap_simple_bind_s(ldc->ldap,
>+                                    (char *)ldc->binddn,
>+                                    (char *)ldc->bindpw);

Casts?!?  Outch.  Is this purely for const'ness?

>+    if ((result = ldap_search_ext_s(ldc->ldap, (char *)reqdn, LDAP_SCOPE_BASE, 
>                                    "(objectclass=*)", NULL, 1, 
>                                    NULL, NULL, NULL, -1, &res)) == LDAP_SERVER_DOWN) {
>+    if ((result = ldap_compare_s(ldc->ldap,
>+                                 (char *)dn,
>+                                 (char *)attrib,
>+                                 (char *)value))
>+                                               == LDAP_SERVER_DOWN) { 
>     if ((result = ldap_search_ext_s(ldc->ldap,
>-                                   basedn, scope, 
>-                                   filter, attrs, 0, 
>+                                   (char *)basedn, scope, 
>+                                   (char *)filter, attrs, 0, 
>                                    NULL, NULL, NULL, -1, &res)) == LDAP_SERVER_DOWN) {
>+    if ((result = ldap_simple_bind_s(ldc->ldap,
>+                                     (char *)*binddn,
>+                                     (char *)bindpw)) == LDAP_SERVER_DOWN) {
>     if ((result = ldap_search_ext_s(ldc->ldap,
>-                                   basedn, scope, filter, attrs, 0, 
>-                                   NULL, NULL, NULL, -1, &res)) == LDAP_SERVER_DOWN) {
>+                                   (char *)basedn, scope,
>+                                    (char *)filter, attrs, 0, 
>+                                   NULL, NULL,
>+                                    NULL, -1, &res)) == LDAP_SERVER_DOWN) {

dittos.

Bill



Re: svn commit: r124187 - /httpd/httpd/trunk/CHANGES /httpd/httpd/trunk/modules/ldap/util_ldap.c

Posted by Graham Leggett <mi...@sharp.fm>.
William A. Rowe, Jr. wrote:

> Based on your new schema, don't you mean
> +        apr_ldap_init(r->pool, &(ldc->ldap),
> +                      ldc->host, (ldc->secure==1)?LDAPS_PORT:LDAP_PORT,
>                        ldc->secure, &(result));

This has ended up becoming ldc->secure == APR_LDAP_OPT_TLS_HARD (which 
equates to 1) after the STARTTLS patch was applied.

>>+        result = ldap_simple_bind_s(ldc->ldap,
>>+                                    (char *)ldc->binddn,
>>+                                    (char *)ldc->bindpw);
> 
> 
> Casts?!?  Outch.  Is this purely for const'ness?

It is - is there a better way to do this?

The openldap SDK originally threw no warnings on my MacOS X machine, 
however building it under the Solaris SDK shipped with Solaris v2.8 
threw warnings about const'ness all over the show :(

It seems the two SDKs require different const'ness, unless the MacOS 
machine is supressing warnings and the Solaris machine is not.

Regards,
Graham
--