From 6af959b2b42638a5c5e2930f941dc4ed5feae51a Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Wed, 18 May 2011 14:32:46 +0200 Subject: [PATCH] Fixes --- etc/afpd/acls.c | 12 ++++++++---- libatalk/acl/uuid.c | 31 ++++++++++++++++--------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/etc/afpd/acls.c b/etc/afpd/acls.c index 43b307a0..bc32881a 100644 --- a/etc/afpd/acls.c +++ b/etc/afpd/acls.c @@ -280,8 +280,8 @@ static int map_aces_darwin_to_solaris(darwin_ace_t *darwin_aces, nfsv4_ace_flags |= ACE_IDENTIFIER_GROUP; break; default: - darwin_aces++; - continue; + LOG(log_error, logtype_afpd, "map_aces_darwin_to_solaris: unkown uuidtype"); + EC_FAIL; } free(name); name = NULL; @@ -309,8 +309,12 @@ static int map_aces_darwin_to_solaris(darwin_ace_t *darwin_aces, nfsv4_ace_rights |= darwin_to_nfsv4_rights[i].to; } - LOG(log_debug9, logtype_afpd, "map_aces_darwin_to_solaris: ACE flags: Darwin:%08x -> NFSv4:%04x", darwin_ace_flags, nfsv4_ace_flags); - LOG(log_debug9, logtype_afpd, "map_aces_darwin_to_solaris: ACE rights: Darwin:%08x -> NFSv4:%08x", darwin_ace_rights, nfsv4_ace_rights); + LOG(log_debug9, logtype_afpd, + "map_aces_darwin_to_solaris: ACE flags: Darwin:%08x -> NFSv4:%04x", + darwin_ace_flags, nfsv4_ace_flags); + LOG(log_debug9, logtype_afpd, + "map_aces_darwin_to_solaris: ACE rights: Darwin:%08x -> NFSv4:%08x", + darwin_ace_rights, nfsv4_ace_rights); nfsv4_aces->a_flags = nfsv4_ace_flags; nfsv4_aces->a_access_mask = nfsv4_ace_rights; diff --git a/libatalk/acl/uuid.c b/libatalk/acl/uuid.c index e275a4d1..fc64c045 100644 --- a/libatalk/acl/uuid.c +++ b/libatalk/acl/uuid.c @@ -242,27 +242,30 @@ int getnamefromuuid(const uuidp_t uuidp, char **name, uuidtype_t *type) { uid = ntohl(*(uint32_t *)(uuidp + 12)); if ((pwd = getpwuid(uid)) == NULL) { /* not found, add negative entry to cache */ - *type |= UUID_ENOENT; - *name = "UUID_ENOENT"; + add_cachebyuuid(uuidp, "UUID_ENOENT", UUID_ENOENT, 0); + ret = -1; + } else { + *name = strdup(pwd->pw_name); add_cachebyuuid(uuidp, *name, *type, 0); - return -1; + ret = 0; } - *name = pwd->pw_name; - add_cachebyuuid(uuidp, *name, *type, 0); - return 0; + LOG(log_debug, logtype_afpd, + "getnamefromuuid{local}: UUID: %s -> name: %s, type:%s", + uuid_bin2string(uuidp), *name, uuidtype[(*type) & UUIDTYPESTR_MASK]); + return ret; } else if (memcmp(uuidp, local_group_uuid, 12) == 0) { *type = UUID_GROUP; gid = ntohl(*(uint32_t *)(uuidp + 12)); if ((grp = getgrgid(gid)) == NULL) { /* not found, add negative entry to cache */ - *type |= UUID_ENOENT; - *name = "UUID_ENOENT"; + add_cachebyuuid(uuidp, "UUID_ENOENT", UUID_ENOENT, 0); + ret = -1; + } else { + *name = strdup(grp->gr_name); add_cachebyuuid(uuidp, *name, *type, 0); - return -1; + ret = 0; } - *name = grp->gr_name; - add_cachebyuuid(uuidp, *name, *type, 0); - return 0; + return ret; } #ifdef HAVE_LDAP @@ -270,9 +273,7 @@ int getnamefromuuid(const uuidp_t uuidp, char **name, uuidtype_t *type) { if (ret != 0) { LOG(log_warning, logtype_afpd, "getnamefromuuid(%s): no result from ldap_getnamefromuuid", uuid_bin2string(uuidp)); - *type |= UUID_ENOENT; - *name = "UUID_ENOENT"; - add_cachebyuuid(uuidp, *name, *type, 0); + add_cachebyuuid(uuidp, "UUID_ENOENT", UUID_ENOENT, 0); return -1; } #endif -- 2.39.2