]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
kerberos_lap_group: several fixes
authorMarkus Moeller <huaraz@moeller.plus.com>
Tue, 12 Jul 2011 05:47:25 +0000 (23:47 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 12 Jul 2011 05:47:25 +0000 (23:47 -0600)
* detect SASL2 libraries on 64-bit RPM and BSD systems
* parse for -S command line option properly
* debug and process NULL domains better

helpers/external_acl/kerberos_ldap_group/config.test
helpers/external_acl/kerberos_ldap_group/kerberos_ldap_group.cc
helpers/external_acl/kerberos_ldap_group/support_lserver.cc
helpers/external_acl/kerberos_ldap_group/support_resolv.cc

index 62849da1bb2ae98e2792c4ade88233f8ebcb1ee8..dcf1b93ef5939bc30d5dd1b472d6aff36b27ea31 100644 (file)
@@ -12,6 +12,9 @@ if [ -f /usr/include/ldap.h -o -f /usr/local/include/ldap.h ]; then
                if [ -f /usr/lib/libsasl.so -o -f /usr/lib/libsasl2.so ]; then
                        exit 0
                fi
+               if [ -f /usr/lib64/libsasl.so -o -f /usr/lib64/libsasl2.so ]; then
+                       exit 0
+               fi
                if [ -f  /usr/local/lib/libsasl.so -o -f  /usr/local/lib/libsasl2.so ]; then
                        exit 0
                fi
index bcef9b859c8b85ff4c6aabf118eac4f66406a917..683ef4994c704b0b09e6a147a9a83bb828a17a47 100644 (file)
@@ -237,7 +237,7 @@ main(int argc, char *const argv[])
 
     init_args(&margs);
 
-    while (-1 != (opt = getopt(argc, argv, "diasg:D:N:u:U:t:T:p:l:b:m:h"))) {
+    while (-1 != (opt = getopt(argc, argv, "diasg:D:N:S:u:U:t:T:p:l:b:m:h"))) {
         switch (opt) {
         case 'd':
             debug_enabled = 1;
index 6901fdd59045039bc2c3c583544c7fc7b7d86f84..0c08275404381dc32a9759b0390b2742ff5136e2 100644 (file)
@@ -100,11 +100,7 @@ create_ls(struct main_args *margs)
             }
             lsspn = lssp;
             np = p;            /* after : starts new group name */
-            if (!lssp->domain || !strcmp(lssp->domain, "")) {
-                debug((char *) "%s| %s: DEBUG: No domain defined for ldap server %s\n", LogTime(), PROGRAM, lssp->lserver);
-                return (1);
-            }
-            debug((char *) "%s| %s: DEBUG: ldap server %s  Domain %s\n", LogTime(), PROGRAM, lssp->lserver, lssp->domain);
+            debug((char *) "%s| %s: DEBUG: ldap server %s Domain %s\n", LogTime(), PROGRAM, lssp->lserver, lssp->domain?lssp->domain:"NULL");
         } else
             p++;
     }
@@ -120,11 +116,7 @@ create_ls(struct main_args *margs)
         if (lsspn)             /* Have already an existing structure */
             lssp->next = lsspn;
     }
-    if (!lssp->domain || !strcmp(lssp->domain, "")) {
-        debug((char *) "%s| %s: DEBUG: No domain defined for ldap server %s\n", LogTime(), PROGRAM, lssp->lserver);
-        return (1);
-    }
-    debug((char *) "%s| %s: DEBUG: ldap server %s  Domain %s\n", LogTime(), PROGRAM, lssp->lserver, lssp->domain);
+    debug((char *) "%s| %s: DEBUG: ldap server %s Domain %s\n", LogTime(), PROGRAM, lssp->lserver, lssp->domain?lssp->domain:"NULL");
 
     margs->lservs = lssp;
     return (0);
index f5426a185005036671b72b6e094285c174767ef1..f07d465c57fb1e03a95a94bff2f13bda9079bcb7 100644 (file)
@@ -243,7 +243,7 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, int nh,
 
     ls = margs->lservs;
     while (ls) {
-        debug((char *) "%s| %s: DEBUG: Ldap server loop: lserver@domain %s@%s\n", LogTime(), PROGRAM, ls->lserver, ls->domain);
+        debug((char *) "%s| %s: DEBUG: Ldap server loop: lserver@domain %s@%s\n", LogTime(), PROGRAM, ls->lserver, ls->domain?ls->domain:"NULL");
         if (ls->domain && !strcasecmp(ls->domain, domain)) {
             debug((char *) "%s| %s: DEBUG: Found lserver@domain %s@%s\n", LogTime(), PROGRAM, ls->lserver, ls->domain);
             hp = (struct hstruct *) xrealloc(hp, sizeof(struct hstruct) * (nhosts + 1));
@@ -252,6 +252,15 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, int nh,
             hp[nhosts].priority = -2;
             hp[nhosts].weight = -2;
             nhosts++;
+        } else if ( !ls->domain || !strcasecmp(ls->domain, "") ) {
+            debug((char *) "%s| %s: DEBUG: Found lserver@domain %s@%s\n", LogTime(), PROGRAM, ls->lserver, ls->domain?ls->domain:"NULL");
+            hp = (struct hstruct *) xrealloc(hp, sizeof(struct hstruct) * (nhosts + 1));
+            hp[nhosts].host = strdup(ls->lserver);
+            hp[nhosts].port = -1;
+            hp[nhosts].priority = -2;
+            hp[nhosts].weight = -2;
+            nhosts++;
+
         }
         ls = ls->next;
     }
@@ -390,6 +399,8 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, int nh,
 #endif
         goto cleanup;
     }
+
+cleanup:
     nhosts = get_hostname_list(margs, &hp, nh, domain);
 
     debug("%s| %s: DEBUG: Adding %s to list\n", LogTime(), PROGRAM, domain);
@@ -438,13 +449,5 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, int nh,
         xfree(service);
     *hlist = hp;
     return (nhosts);
-
-cleanup:
-    if (buffer)
-        xfree(buffer);
-    if (service)
-        xfree(service);
-    *hlist = hp;
-    return (nhosts);
 }
 #endif