]> arthur.barton.de Git - netatalk.git/commitdiff
Ignore client local group ACEs of the from ABCDEFAB-CDEF-ABCD-EFAB-CDEFXXXXXXXX,...
authorFrank Lahm <franklahm@googlemail.com>
Wed, 20 Oct 2010 15:15:18 +0000 (17:15 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Wed, 20 Oct 2010 15:15:18 +0000 (17:15 +0200)
etc/afpd/acls.c
include/atalk/uuid.h
libatalk/acl/uuid.c

index 3cb3de4a7b67f706bff7a3d1a4deb56ddad82ee1..5c657e195d5f53dd63e9d2f4d28f532e9d04bd5f 100644 (file)
@@ -198,14 +198,21 @@ int map_aces_darwin_to_solaris(darwin_ace_t *darwin_aces, ace_t *nfsv4_aces, int
 
         /* uid/gid first */
         EC_ZERO(getnamefromuuid(darwin_aces->darwin_ace_uuid, &name, &uuidtype));
-
-        if (uuidtype == UUID_USER) {
+        switch (uuidtype) {
+        case UUID_LOCAL:
+            free(name);
+            name = NULL;
+            darwin_aces++;
+            continue;
+        case UUID_USER:
             EC_NULL_LOG(pwd = getpwnam(name));
             nfsv4_aces->a_who = pwd->pw_uid;
-        } else { /* hopefully UUID_GROUP*/
+            break;
+        case UUID_GROUP:
             EC_NULL_LOG(grp = getgrnam(name));
             nfsv4_aces->a_who = (uid_t)(grp->gr_gid);
             nfsv4_ace_flags |= ACE_IDENTIFIER_GROUP;
+            break;
         }
         free(name);
         name = NULL;
@@ -418,16 +425,23 @@ static int map_aces_darwin_to_posix(const darwin_ace_t *darwin_aces,
 
          /* uid/gid */
         EC_ZERO_LOG(getnamefromuuid(darwin_aces->darwin_ace_uuid, &name, &uuidtype));
-        if (uuidtype == UUID_USER) {
+        switch (uuidtype) {
+        case UUID_LOCAL:
+            free(name);
+            name = NULL;
+            continue;
+        case UUID_USER:
             EC_NULL_LOG(pwd = getpwnam(name));
             tag = ACL_USER;
             id = pwd->pw_uid;
             LOG(log_debug, logtype_afpd, "map_ace: name: %s, uid: %u", name, id);
-        } else { /* hopefully UUID_GROUP*/
+            break;
+        case UUID_GROUP:
             EC_NULL_LOG(grp = getgrnam(name));
             tag = ACL_GROUP;
             id = (uid_t)(grp->gr_gid);
             LOG(log_debug, logtype_afpd, "map_ace: name: %s, gid: %u", name, id);
+            break;
         }
         free(name);
         name = NULL;
index d9ae18924bc35c986e8c757fbcff2403c86281c6..f544960636f0eb50385975f1ad41ca30e6245bc2 100644 (file)
@@ -21,7 +21,7 @@
 typedef char *uuidp_t;
 typedef char atalk_uuid_t[UUID_BINSIZE];
 
-typedef enum {UUID_USER = 1, UUID_GROUP} uuidtype_t;
+typedef enum {UUID_USER = 1, UUID_GROUP, UUID_LOCAL} uuidtype_t;
 extern char *uuidtype[];
 
 /* afp_options.c needs these. defined in libatalk/ldap.c */
index b54c15f2344424b916638b64f62f67300188b876..7891031875bd7feec0ede15b7141c500c4302f0a 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #include <atalk/logger.h>
 #include <atalk/afp.h>
@@ -29,7 +30,7 @@
 #include "aclldap.h"
 #include "cache.h"
 
-char *uuidtype[] = {"NULL","USER", "GROUP"};
+char *uuidtype[] = {"NULL","USER", "GROUP", "LOCAL"};
 
 /********************************************************
  * Public helper function
@@ -144,10 +145,14 @@ cleanup:
     return ret;
 }
 
+static char local_uuid[] = {0xab, 0xcd, 0xef,
+                            0xab, 0xcd, 0xef,
+                            0xab, 0xcd, 0xef, 
+                            0xab, 0xcd, 0xef};
 /* 
  * uuidp: pointer to a uuid
  * name: returns allocated buffer from ldap_getnamefromuuid
- * type: returns USER or GROUP
+ * type: returns USER, GROUP or LOCAL
  * return 0 on success !=0 on errror
  *
  * Caller must free name appropiately.
@@ -156,6 +161,15 @@ int getnamefromuuid(const uuidp_t uuidp, char **name, uuidtype_t *type) {
     int ret;
     char *uuid_string = NULL;
 
+    /* Check if UUID is ABCDEFAB-CDEF-ABCD-EFAB-CDEFXXXXXXXX, where X is a client local uid */
+    if (memcmp(uuidp, local_uuid, 12) == 0) {
+        LOG(log_debug, logtype_afpd, "getnamefromuuid: local UUID: %" PRIu32 "",
+            ntohl(*(uint32_t *)(uuid_string+12)));
+        *type = UUID_LOCAL;
+        *name = strdup("UUID_LOCAL");
+        return 0;
+    }
+
     ret = search_cachebyuuid( uuidp, name, type);
     if (ret == 0) {     /* found in cache */
 #ifdef DEBUG