summaryrefslogtreecommitdiff
path: root/src/responder/nss/nsssrv_cmd.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-05-17 16:28:15 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-05-20 05:49:25 -0400
commit54af51d2129d29258108a6dbf072a82c930bf399 (patch)
tree03b97d3b98b82395f5b35b6fbf0f0d67e3712262 /src/responder/nss/nsssrv_cmd.c
parent217d7e26345fb5f7e296551b62a4c1d82c9d9585 (diff)
downloadsssd-54af51d2129d29258108a6dbf072a82c930bf399.tar.gz
sssd-54af51d2129d29258108a6dbf072a82c930bf399.tar.bz2
sssd-54af51d2129d29258108a6dbf072a82c930bf399.zip
Add a new option to override primary GID number
https://fedorahosted.org/sssd/ticket/742
Diffstat (limited to 'src/responder/nss/nsssrv_cmd.c')
-rw-r--r--src/responder/nss/nsssrv_cmd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index db301b38..2f510b9b 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -170,6 +170,14 @@ struct setent_ctx {
* PASSWD db related functions
***************************************************************************/
+static gid_t get_gid_override(struct ldb_message *msg,
+ struct sss_domain_info *dom)
+{
+ return dom->override_gid ?
+ dom->override_gid :
+ ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0);
+}
+
static int fill_pwent(struct sss_packet *packet,
struct sss_domain_info *dom,
struct nss_ctx *nctx,
@@ -206,7 +214,7 @@ static int fill_pwent(struct sss_packet *packet,
name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL);
uid = ldb_msg_find_attr_as_uint64(msg, SYSDB_UIDNUM, 0);
- gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0);
+ gid = get_gid_override(msg, dom);
if (!name || !uid || !gid) {
DEBUG(2, ("Incomplete or fake user object for %s[%llu]! Skipping\n",