From: Daniel Mack Date: Wed, 20 Aug 2014 20:53:48 +0000 (+0200) Subject: metadata: kdbus_meta_append_auxgroups(): actually set the group ids X-Git-Tag: upstream/0.20140911.160207utc~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3f152b823688f2a2ff697ae6de44d1f2a1942b0;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git metadata: kdbus_meta_append_auxgroups(): actually set the group ids As we need metadata in other context than queue items, we don't want to rely on the queue item logic to clean up after us and fix up the values. For now, add back the code to actually fill the payload. We might add code to make the queue patching conditional later. --- diff --git a/metadata.c b/metadata.c index dabc614..5bc2efa 100644 --- a/metadata.c +++ b/metadata.c @@ -207,14 +207,27 @@ static int kdbus_meta_append_cred(struct kdbus_meta *meta) static int kdbus_meta_append_auxgroups(struct kdbus_meta *meta) { struct group_info *info; - unsigned int ngroups; + struct kdbus_item *item; + int i, ret = 0; + u64 *gid; info = get_current_groups(); - ngroups = info->ngroups; + item = kdbus_meta_append_item(meta, KDBUS_ITEM_AUXGROUPS, + info->ngroups * sizeof(*gid)); + if (IS_ERR(item)) { + ret = PTR_ERR(item); + goto exit_put_groups; + } + + gid = (u64 *) item->data; + + for (i = 0; i < info->ngroups; i++) + gid[i] = from_kgid_munged(current_user_ns(), GROUP_AT(info, i)); + +exit_put_groups: put_group_info(info); - return kdbus_meta_append_data(meta, KDBUS_ITEM_AUXGROUPS, - NULL, ngroups * sizeof(__u64)); + return ret; } static int kdbus_meta_append_src_names(struct kdbus_meta *meta,