/* 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;
/* 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;
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 */
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <inttypes.h>
#include <atalk/logger.h>
#include <atalk/afp.h>
#include "aclldap.h"
#include "cache.h"
-char *uuidtype[] = {"NULL","USER", "GROUP"};
+char *uuidtype[] = {"NULL","USER", "GROUP", "LOCAL"};
/********************************************************
* Public helper function
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.
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