From 71fe13a241da37f6d1eb3e43ba9ef25e2f1bae99 Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 18 Mar 2016 15:07:18 +0000 Subject: [PATCH] Libinfo-477.50.4.tar.gz --- lookup.subproj/libinfo.c | 47 ---------------------------------- lookup.subproj/libinfo_muser.h | 1 + lookup.subproj/muser_module.c | 37 +++++++++++++++----------- 3 files changed, 23 insertions(+), 62 deletions(-) diff --git a/lookup.subproj/libinfo.c b/lookup.subproj/libinfo.c index b4a2b32..8dd06af 100644 --- a/lookup.subproj/libinfo.c +++ b/lookup.subproj/libinfo.c @@ -192,18 +192,6 @@ getpwnam(const char *name) #ifdef CALL_TRACE fprintf(stderr, "-> %s %s\n", __func__, name); #endif -#if TARGET_OS_EMBEDDED - if (strcmp(name,"mobile") == 0) { - struct stat buf; - struct passwd * pw = NULL; - - if (lstat("/private/var/mobile",&buf) == 0) { - if ((pw = getpwuid(buf.st_uid)) != NULL) { - return(pw); - } - } - } -#endif /* TARGET_OS_EMBEDDED */ item = si_user_byname(si_search(), name); LI_set_thread_item(CATEGORY_USER + 100, item); @@ -251,20 +239,7 @@ getpwuid(uid_t uid) #endif -#if TARGET_OS_EMBEDDED - uid_t localuid = uid; - - if (uid == 501) { - struct stat buf; - - if (lstat("/private/var/mobile",&buf) == 0) { - localuid = buf.st_uid; - } - } - item = si_user_byuid(si_search(), localuid); -#else /* TARGET_OS_EMBEDDED */ item = si_user_byuid(si_search(), uid); -#endif /* TARGET_OS_EMBEDDED */ LI_set_thread_item(CATEGORY_USER + 200, item); if (item == NULL) return NULL; @@ -3165,18 +3140,6 @@ getpwnam_r(const char *name, struct passwd *pw, char *buffer, size_t bufsize, st if (result != NULL) *result = NULL; if ((pw == NULL) || (buffer == NULL) || (result == NULL) || (bufsize == 0)) return ERANGE; - -#if TARGET_OS_EMBEDDED - if (strcmp(name,"mobile") == 0) { - struct stat buf; - - if (lstat("/private/var/mobile",&buf) == 0) { - if ((getpwuid_r(buf.st_uid, pw,buffer, bufsize, result)) == 0) { - return(0); - } - } - } -#endif /* TARGET_OS_EMBEDDED */ item = si_user_byname(si_search(), name); if (item == NULL) return 0; @@ -3207,16 +3170,6 @@ getpwuid_r(uid_t uid, struct passwd *pw, char *buffer, size_t bufsize, struct pa if (result != NULL) *result = NULL; if ((pw == NULL) || (buffer == NULL) || (result == NULL) || (bufsize == 0)) return ERANGE; - -#if TARGET_OS_EMBEDDED - if (uid == 501) { - struct stat buf; - - if (lstat("/private/var/mobile", &buf) == 0) { - localuid = buf.st_uid; - } - } -#endif /* TARGET_OS_EMBEDDED*/ item = si_user_byuid(si_search(), localuid); if (item == NULL) return 0; diff --git a/lookup.subproj/libinfo_muser.h b/lookup.subproj/libinfo_muser.h index 22f0cf2..8f6a1e8 100644 --- a/lookup.subproj/libinfo_muser.h +++ b/lookup.subproj/libinfo_muser.h @@ -66,6 +66,7 @@ /* Reply keys from group queries. */ #define kLIMMessageReplyGroupname "gr_name" // string #define kLIMMessageReplyGroupID "gr_gid" // int64 +#define kLIMMessageReplyGroupMembers "gr_members" // array of strings /* Reply keys from grouplist queries. */ #define kLIMMessageReplyGrouplist "grouplist" // array of int64 diff --git a/lookup.subproj/muser_module.c b/lookup.subproj/muser_module.c index 5a7c753..8d4d5cb 100644 --- a/lookup.subproj/muser_module.c +++ b/lookup.subproj/muser_module.c @@ -58,25 +58,16 @@ _muser_call(const char *procname, xpc_object_t payload) int rv = xpc_pipe_routine(pipe, payload, &reply); switch (rv) { - case EPIPE: - xpc_release(pipe); - break; - case EAGAIN: - /* try again? */ - break; case 0: result = reply; - /* fallthrough */ + break; + case EAGAIN: + case EPIPE: default: - xpc_release(pipe); - pipe = NULL; break; } - if (pipe != NULL) { - xpc_release(pipe); - } - + xpc_release(pipe); return result; } @@ -96,6 +87,7 @@ _muser_xpc_pipe_disabled(xpc_pipe_t pipe) switch (rv) { case 0: disabled = !xpc_dictionary_get_bool(reply, kLIMMessageReplyAvailable); + xpc_release(reply); break; case EPIPE: case EAGAIN: @@ -104,6 +96,7 @@ _muser_xpc_pipe_disabled(xpc_pipe_t pipe) break; } + xpc_release(dict); return disabled; } @@ -254,13 +247,27 @@ _muser_extract_group(si_mod_t *si, xpc_object_t reply, uint64_t vg, uint64_t vc) reqs--; } } + else if (!strcmp(key, kLIMMessageReplyGroupMembers)) { + if (xpc_get_type(value) == XPC_TYPE_ARRAY) { + size_t count = xpc_array_get_count(value); + g.gr_mem = (char **)malloc(sizeof(char *) * (count + 1)); + g.gr_mem[count] = NULL; + + for (size_t i=0; i