#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);
#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;
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;
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;
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;
}
switch (rv) {
case 0:
disabled = !xpc_dictionary_get_bool(reply, kLIMMessageReplyAvailable);
+ xpc_release(reply);
break;
case EPIPE:
case EAGAIN:
break;
}
+ xpc_release(dict);
return disabled;
}
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 *
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) {