]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/acl/ldap_config.c
Fixes
[netatalk.git] / libatalk / acl / ldap_config.c
index d719cafdfc4a2c66ea32a4297c195fddc93e949b..6cf554a8fec1921c9239092e0c45f78150d041ba 100644 (file)
@@ -25,6 +25,7 @@
 #include <ctype.h>
 #include <ldap.h>
 
+#include <atalk/globals.h>
 #include <atalk/ldapconfig.h>
 #include <atalk/logger.h>
 #include <atalk/iniparser.h>
 int acl_ldap_readconfig(dictionary *iniconfig)
 {
     int i, j;
-    char *val;
+    const char *val;
 
     i = 0;
     /* now see if its a correct pref */
     for (i = 0; ldap_prefs[i].name != NULL; i++) {
-        if ((val = iniparser_getstring(ldap_prefs[i].name)) != NULL) {
-            /* ok, found a valid pref */
-
+        if ((val = iniparser_getstring(iniconfig, INISEC_GLOBAL, ldap_prefs[i].name, NULL))) {
             /* check if we have pre-defined values */
             if (ldap_prefs[i].intfromarray == 0) {
                 /* no, its just a string */
@@ -49,7 +48,7 @@ int acl_ldap_readconfig(dictionary *iniconfig)
                     *((int *)(ldap_prefs[i].pref)) = atoi(val);
                 else
                     /* store string as string */
-                    *((char **)(ldap_prefs[i].pref)) = val;
+                    *((const char **)(ldap_prefs[i].pref)) = val;
             } else {
                 /* ok, we have string to int mapping for this pref
                    eg. "none", "simple", "sasl" map to 0, 128, 129 */
@@ -71,7 +70,7 @@ int acl_ldap_readconfig(dictionary *iniconfig)
 
     while(ldap_prefs[i].pref != NULL) {
         if ( ldap_prefs[i].valid != 0) {
-            LOG(log_debug, logtype_afpd,"afp_ldap.conf: Missing option: \"%s\"", ldap_prefs[i].name);
+            LOG(log_debug, logtype_afpd,"LDAP: Missing option: \"%s\"", ldap_prefs[i].name);
             ldap_config_valid = 0;
             break;
         }
@@ -80,16 +79,15 @@ int acl_ldap_readconfig(dictionary *iniconfig)
 
     if (ldap_config_valid) {
         if (ldap_auth_method == LDAP_AUTH_NONE)
-            LOG(log_debug, logtype_afpd,"afp_ldap.conf: Using anonymous bind.");
+            LOG(log_debug, logtype_afpd,"LDAP: Using anonymous bind.");
         else if (ldap_auth_method == LDAP_AUTH_SIMPLE)
-            LOG(log_debug, logtype_afpd,"afp_ldap.conf: Using simple bind.");
+            LOG(log_debug, logtype_afpd,"LDAP: Using simple bind.");
         else {
             ldap_config_valid = 0;
-            LOG(log_error, logtype_afpd,"afp_ldap.conf: SASL not yet supported.");
+            LOG(log_error, logtype_afpd,"LDAP: SASL not yet supported.");
         }
     } else
-        LOG(log_info, logtype_afpd,"afp_ldap.conf: not used");
-    fclose(f);
+        LOG(log_info, logtype_afpd,"LDAP: not used");
     return 0;
 }
 #endif /* HAVE_LDAP */