]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/vfs/acl.c
merge from branch 2-1
[netatalk.git] / libatalk / vfs / acl.c
index d851f706d10160112c46348556606eaf9c074a03..8bc84ba877e94fdc3e0288e02ee4448066b4542b 100644 (file)
@@ -1,6 +1,6 @@
 /*
-  $Id: acl.c,v 1.1 2009-10-02 09:32:41 franklahm Exp $
   Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
+  Copyright (c) 2010 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
 #include <errno.h>
+
+#ifdef HAVE_SOLARIS_ACLS
 #include <sys/acl.h>
+#endif
 
+#include <atalk/afp.h>
 #include <atalk/util.h>
 #include <atalk/logger.h>
 
+#ifdef HAVE_SOLARIS_ACLS
+
 /* Get ACL. Allocates storage as needed. Caller must free.
  * Returns no of ACEs or -1 on error.  */
 int get_nfsv4_acl(const char *name, ace_t **retAces)
@@ -33,20 +42,20 @@ int get_nfsv4_acl(const char *name, ace_t **retAces)
     *retAces = NULL;
     ace_count = acl(name, ACE_GETACLCNT, 0, NULL);
     if (ace_count <= 0) {
-       LOG(log_error, logtype_afpd, "get_nfsv4_acl: acl(ACE_GETACLCNT) error");
+        LOG(log_error, logtype_afpd, "get_nfsv4_acl: acl(ACE_GETACLCNT) error");
         return -1;
     }
 
     aces = malloc(ace_count * sizeof(ace_t));
     if (aces == NULL) {
-       LOG(log_error, logtype_afpd, "get_nfsv4_acl: malloc error");
-       return -1;
+        LOG(log_error, logtype_afpd, "get_nfsv4_acl: malloc error");
+        return -1;
     }
 
     if ( (acl(name, ACE_GETACL, ace_count, aces)) == -1 ) {
-       LOG(log_error, logtype_afpd, "get_nfsv4_acl: acl(ACE_GETACL) error");
-       free(aces);
-       return -1;
+        LOG(log_error, logtype_afpd, "get_nfsv4_acl: acl(ACE_GETACL) error");
+        free(aces);
+        return -1;
     }
 
     LOG(log_debug9, logtype_afpd, "get_nfsv4_acl: file: %s -> No. of ACEs: %d", name, ace_count);
@@ -56,7 +65,7 @@ int get_nfsv4_acl(const char *name, ace_t **retAces)
 }
 
 /* Removes all non-trivial ACLs from object. Returns full AFPERR code. */
-int remove_acl(const char *name)
+int remove_acl_vfs(const char *name)
 {
     int ret,i, ace_count, trivial_aces, new_aces_count;
     ace_t *old_aces = NULL;
@@ -108,3 +117,12 @@ exit:
     LOG(log_debug9, logtype_afpd, "remove_acl: END");
     return ret;
 }
+
+#endif  /* HAVE_SOLARIS_ACLS */
+
+#ifdef HAVE_POSIX_ACLS
+int remove_acl_vfs(const char *name)
+{
+    return AFP_OK;
+}
+#endif /* HAVE_POSIX_ACLS */