]> git.saurik.com Git - apple/libinfo.git/commitdiff
Libinfo-477.50.4.tar.gz os-x-10115 os-x-10116 v477.50.4
authorApple <opensource@apple.com>
Fri, 18 Mar 2016 15:07:18 +0000 (15:07 +0000)
committerApple <opensource@apple.com>
Fri, 18 Mar 2016 15:07:18 +0000 (15:07 +0000)
lookup.subproj/libinfo.c
lookup.subproj/libinfo_muser.h
lookup.subproj/muser_module.c

index b4a2b32670a303615141945098fe9da1d278589d..8dd06afe392d87bb5a6e43f3ab04fab414ea6ecd 100644 (file)
@@ -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;
index 22f0cf231b0cdea6e1558a206dfe93e0e6a14a28..8f6a1e80161390fbe28c417f056a58a54cd0ba83 100644 (file)
@@ -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
index 5a7c75348268396006222e7de869b34b9eb5a420..8d4d5cb111ad5a2e6ced85ea42f257384f2a0f74 100644 (file)
@@ -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<count; i++) {
+                                       g.gr_mem[i] = (char *)xpc_array_get_string(value, i);
+                               }
+                       }
+               }
                return true;
        });
 
        if (reqs != 0) { return NULL; }
 
-       return (si_item_t *)LI_ils_create("L4488ss4*", (unsigned long)si, CATEGORY_GROUP, 1,
+       si_item_t *item = (si_item_t *)LI_ils_create("L4488ss4*", (unsigned long)si, CATEGORY_GROUP, 1,
                        vg, vc, g.gr_name, g.gr_passwd, g.gr_gid, g.gr_mem);
+
+       free(g.gr_mem);
+       return item;
 }
 
 static si_item_t *
@@ -411,7 +418,7 @@ muser_grouplist(struct si_mod_s *si, const char *name, uint32_t count)
        if (!payload) { return NULL; }
 
        xpc_dictionary_set_string(payload, kLIMMessageReqtype, kLIMMessageRequestGrouplist);
-       xpc_dictionary_set_int64(payload, kLIMMessageQuery, name);
+       xpc_dictionary_set_string(payload, kLIMMessageQuery, name);
 
        xpc_object_t reply = _muser_call("getgrouplist", payload);
        if (reply) {