]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/acl/ldap_config.c
Fixes, from Riccardo Magliocchetti
[netatalk.git] / libatalk / acl / ldap_config.c
index b7c160c169712249818ae65b3eb4c3d200cdb712..e0440a6b770514d72543fb0edfffcc1192c02bb2 100644 (file)
@@ -1,5 +1,4 @@
 /*
-  $Id: ldap_config.c,v 1.4 2009-11-28 11:10:37 franklahm Exp $
   Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#ifdef HAVE_ACLS
+#ifdef HAVE_LDAP
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <errno.h>
 #include <string.h>
 #include <ctype.h>
@@ -48,10 +48,10 @@ static int getpref(char *buf, char **R_pref, char **R_val)
         val++;
     if ((val = strtok(val, " \n")) == NULL)
         return -1;
-    if ((val = strdup(val)) == NULL)
-        return -1;
     if ((pref = strtok(p, " =")) == NULL)
         return -1;
+    if ((val = strdup(val)) == NULL)
+        return -1;
 
     *R_pref = pref;
     *R_val = val;
@@ -124,7 +124,7 @@ int acl_ldap_readconfig(char *name)
 
     while(ldap_prefs[i].pref != NULL) {
         if ( ldap_prefs[i].valid != 0) {
-            LOG(log_error, logtype_afpd,"afp_ldap.conf: Missing option: \"%s\"", ldap_prefs[i].name);
+            LOG(log_debug, logtype_afpd,"afp_ldap.conf: Missing option: \"%s\"", ldap_prefs[i].name);
             ldap_config_valid = 0;
             break;
         }
@@ -133,16 +133,16 @@ int acl_ldap_readconfig(char *name)
 
     if (ldap_config_valid) {
         if (ldap_auth_method == LDAP_AUTH_NONE)
-            LOG(log_debug, logtype_afpd,"ldappref: Pref is ok. Using anonymous bind.");
+            LOG(log_debug, logtype_afpd,"afp_ldap.conf: Using anonymous bind.");
         else if (ldap_auth_method == LDAP_AUTH_SIMPLE)
-            LOG(log_debug, logtype_afpd,"ldappref: Pref is ok. Using simple bind.");
+            LOG(log_debug, logtype_afpd,"afp_ldap.conf: Using simple bind.");
         else {
             ldap_config_valid = 0;
-            LOG(log_error, logtype_afpd,"ldappref: Pref not ok. SASL not yet supported.");
+            LOG(log_error, logtype_afpd,"afp_ldap.conf: SASL not yet supported.");
         }
     } else
-        LOG(log_error, logtype_afpd,"ldappref: Pref is not ok.");
+        LOG(log_info, logtype_afpd,"afp_ldap.conf: not used");
     fclose(f);
     return 0;
 }
-#endif /* HAVE_ACLS */
+#endif /* HAVE_LDAP */