]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/acl/ldap_config.c
Remove CVS keywords
[netatalk.git] / libatalk / acl / ldap_config.c
index 88cc44a6157b8aa6223ca6d748fdb0e97980a56d..26a63fa9c76dab72f94af1fb812943d50f2ba804 100644 (file)
 #include <atalk/logger.h>
 #include <atalk/iniparser.h>
 
+void acl_ldap_freeconfig(void)
+{
+    for (int i = 0; ldap_prefs[i].name != NULL; i++) {
+        if (ldap_prefs[i].intfromarray == 0 && ldap_prefs[i].strorint == 0) {
+            free(*((char **)(ldap_prefs[i].pref)));
+            *((char **)(ldap_prefs[i].pref)) = NULL;
+        }
+        ldap_prefs[i].valid = ldap_prefs[i].valid_save;
+    }
+}
+
 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(iniconfig, INISEC_AFP, ldap_prefs[i].name, NULL))) {
+        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 */
@@ -48,7 +59,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)) = strdup(val);
             } else {
                 /* ok, we have string to int mapping for this pref
                    eg. "none", "simple", "sasl" map to 0, 128, 129 */