summaryrefslogtreecommitdiffstats
path: root/server/tools
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-03-09 23:26:27 -0400
committerSimo Sorce <ssorce@redhat.com>2009-03-09 23:26:27 -0400
commit68303b58587b0e82efb1c57d96e89578e5290867 (patch)
tree549cf24553ff4be1ebc49e9a9f9bdc2cf2427fa4 /server/tools
parent92bb11b3570c0ce1de84824d9697fa45422feb0b (diff)
downloadsssd-68303b58587b0e82efb1c57d96e89578e5290867.tar.gz
sssd-68303b58587b0e82efb1c57d96e89578e5290867.tar.xz
sssd-68303b58587b0e82efb1c57d96e89578e5290867.zip
Always pass sss_domain_info to sysdb functions.
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/sss_useradd.c9
1 files changed, 5 insertions, 4 deletions
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;