From 68303b58587b0e82efb1c57d96e89578e5290867 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 9 Mar 2009 23:26:27 -0400 Subject: Always pass sss_domain_info to sysdb functions. --- server/tools/sss_useradd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'server/tools') diff --git a/server/tools/sss_useradd.c b/server/tools/sss_useradd.c index 7bad83786..ba89276fa 100644 --- a/server/tools/sss_useradd.c +++ b/server/tools/sss_useradd.c @@ -87,8 +87,9 @@ static void get_gid_callback(void *ptr, int error, struct ldb_result *res) * is given, returns that as integer (rationale: shadow-utils) * On error, returns -EINVAL */ -static int get_gid(struct tools_ctx *ctx, const char *groupname, gid_t *_gid) +static int get_gid(struct user_add_ctx *user_ctx, const char *groupname) { + struct tools_ctx *ctx = user_ctx->ctx; struct fetch_group *data = NULL; char *end_ptr; gid_t gid; @@ -103,7 +104,7 @@ static int get_gid(struct tools_ctx *ctx, const char *groupname, gid_t *_gid) if (!data) return ENOMEM; ret = sysdb_getgrnam(data, ctx->sysdb, - "LOCAL", groupname, false, + user_ctx->domain, groupname, get_gid_callback, data); if (ret != EOK) { DEBUG(0, ("sysdb_getgrnam failed: %d\n", ret)); @@ -125,7 +126,7 @@ static int get_gid(struct tools_ctx *ctx, const char *groupname, gid_t *_gid) if (gid == 0) { ret = ERANGE; } else { - *_gid = gid; + user_ctx->gid = gid; } done: @@ -288,7 +289,7 @@ int main(int argc, const char **argv) /* Same as shadow-utils useradd, -g can specify gid or group name */ if (pc_group != NULL) { - ret = get_gid(ctx, pc_group, &user_ctx->gid); + ret = get_gid(user_ctx, pc_group); if (ret != EOK) { ret = EXIT_FAILURE; goto fini; -- cgit