]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/acl/unix.c
Merge sf
[netatalk.git] / libatalk / acl / unix.c
index c08ae8d6929b5cb241a7c1b3dacf2d03abdb85e8..f72d9aaef7e3f01d96143de53cf20af517b259b4 100644 (file)
@@ -16,7 +16,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#ifdef HAVE_NFSv4_ACLS
+#ifdef HAVE_SOLARIS_ACLS
 
 #include <unistd.h>
 #include <sys/types.h>
@@ -43,13 +43,24 @@ int get_nfsv4_acl(const char *name, ace_t **retAces)
 
     *retAces = NULL;
     /* Only call acl() for regular files and directories, otherwise just return 0 */
-    if (lstat(name, &st) != 0)
+    if (lstat(name, &st) != 0) {
+        LOG(log_warning, logtype_afpd, "get_nfsv4_acl(\"%s/%s\"): %s", getcwdpath(), name, strerror(errno));
         return -1;
-    if ( ! (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode)))
+    }
+
+    if (S_ISLNK(st.st_mode))
+        /* sorry, no ACLs for symlinks */
         return 0;
 
-    if ((ace_count = acl(name, ACE_GETACLCNT, 0, NULL)) == 0)
+    if ( ! (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) {
+        LOG(log_warning, logtype_afpd, "get_nfsv4_acl(\"%s/%s\"): special", getcwdpath(), name);
         return 0;
+    }
+
+    if ((ace_count = acl(name, ACE_GETACLCNT, 0, NULL)) == 0) {
+        LOG(log_warning, logtype_afpd, "get_nfsv4_acl(\"%s/%s\"): 0 ACEs", getcwdpath(), name);
+        return 0;
+    }
 
     if (ace_count == -1) {
         LOG(log_error, logtype_afpd, "get_nfsv4_acl: acl('%s/%s', ACE_GETACLCNT): ace_count %i, error: %s",
@@ -206,7 +217,7 @@ int nfsv4_chmod(char *name, mode_t mode)
 {
     int ret = -1;
     int noaces, nnaces;
-    ace_t *oacl = NULL, *nacl = NULL, *cacl;
+    ace_t *oacl = NULL, *nacl = NULL, *cacl = NULL;
 
     LOG(log_debug, logtype_afpd, "nfsv4_chmod(\"%s/%s\", %04o)",
         getcwdpath(), name, mode);
@@ -241,10 +252,9 @@ exit:
     if (cacl) free(cacl);
 
     LOG(log_debug, logtype_afpd, "nfsv4_chmod(\"%s/%s\", %04o): result: %u",
-        ret, getcwdpath(), name, mode);
+        getcwdpath(), name, mode, ret);
 
     return ret;
 }
 
-
-#endif /* HAVE_NFSv4_ACLS */
+#endif /* HAVE_SOLARIS_ACLS */