diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/nscd.c | 4 | ||||
-rw-r--r-- | src/tools/sss_groupadd.c | 2 | ||||
-rw-r--r-- | src/tools/sss_sync_ops.c | 44 | ||||
-rw-r--r-- | src/tools/sss_sync_ops.h | 5 | ||||
-rw-r--r-- | src/tools/sss_useradd.c | 4 | ||||
-rw-r--r-- | src/tools/tools_util.c | 4 | ||||
-rw-r--r-- | src/tools/tools_util.h | 6 |
7 files changed, 30 insertions, 39 deletions
diff --git a/src/tools/nscd.c b/src/tools/nscd.c index f17fd6acc..365383cb8 100644 --- a/src/tools/nscd.c +++ b/src/tools/nscd.c @@ -33,7 +33,7 @@ #endif #if defined(NSCD_PATH) && defined(HAVE_NSCD) -int flush_nscd_cache(TALLOC_CTX *mem_ctx, enum nscd_db flush_db) +int flush_nscd_cache(enum nscd_db flush_db) { const char *service; pid_t nscd_pid; @@ -90,7 +90,7 @@ done: } #else /* defined(NSCD_PATH) && defined(HAVE_NSCD) */ -int flush_nscd_cache(TALLOC_CTX *mem_ctx, enum nscd_db flush_db) +int flush_nscd_cache(enum nscd_db flush_db) { return EOK; } diff --git a/src/tools/sss_groupadd.c b/src/tools/sss_groupadd.c index 1f974cd03..f2e09a100 100644 --- a/src/tools/sss_groupadd.c +++ b/src/tools/sss_groupadd.c @@ -110,7 +110,7 @@ int main(int argc, const char **argv) } /* groupadd */ - tctx->error = groupadd(tctx, tctx->sysdb, tctx->octx); + tctx->error = groupadd(tctx->sysdb, tctx->octx); if (tctx->error) { /* cancel transaction */ sysdb_transaction_cancel(tctx->sysdb); diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c index 717227029..79de8fc8c 100644 --- a/src/tools/sss_sync_ops.c +++ b/src/tools/sss_sync_ops.c @@ -52,8 +52,7 @@ struct sync_op_res { /* * Generic modify groups member */ -static int mod_groups_member(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *sysdb, +static int mod_groups_member(struct sysdb_ctx *sysdb, char **grouplist, struct ldb_dn *member_dn, int optype) @@ -93,11 +92,11 @@ done: return ret; } -#define add_to_groups(memctx, sysdb, data, member_dn) \ - mod_groups_member(memctx, sysdb, data->addgroups, member_dn, \ +#define add_to_groups(sysdb, data, member_dn) \ + mod_groups_member(sysdb, data->addgroups, member_dn, \ LDB_FLAG_MOD_ADD) -#define remove_from_groups(memctx, sysdb, data, member_dn) \ - mod_groups_member(memctx, sysdb, data->rmgroups, member_dn, \ +#define remove_from_groups(sysdb, data, member_dn) \ + mod_groups_member(sysdb, data->rmgroups, member_dn, \ LDB_FLAG_MOD_DELETE) /* @@ -229,21 +228,21 @@ int usermod(TALLOC_CTX *mem_ctx, } if (data->rmgroups != NULL) { - ret = remove_from_groups(mem_ctx, sysdb, data, member_dn); + ret = remove_from_groups(sysdb, data, member_dn); if (ret) { return ret; } } if (data->addgroups != NULL) { - ret = add_to_groups(mem_ctx, sysdb, data, member_dn); + ret = add_to_groups(sysdb, data, member_dn); if (ret) { return ret; } } - flush_nscd_cache(mem_ctx, NSCD_DB_PASSWD); - flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); + flush_nscd_cache(NSCD_DB_PASSWD); + flush_nscd_cache(NSCD_DB_GROUP); return EOK; } @@ -284,20 +283,20 @@ int groupmod(TALLOC_CTX *mem_ctx, } if (data->rmgroups != NULL) { - ret = remove_from_groups(mem_ctx, sysdb, data, member_dn); + ret = remove_from_groups(sysdb, data, member_dn); if (ret) { return ret; } } if (data->addgroups != NULL) { - ret = add_to_groups(mem_ctx, sysdb, data, member_dn); + ret = add_to_groups(sysdb, data, member_dn); if (ret) { return ret; } } - flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); + flush_nscd_cache(NSCD_DB_GROUP); return EOK; } @@ -487,14 +486,14 @@ int useradd(TALLOC_CTX *mem_ctx, goto done; } - ret = add_to_groups(mem_ctx, sysdb, data, member_dn); + ret = add_to_groups(sysdb, data, member_dn); if (ret) { goto done; } } - flush_nscd_cache(mem_ctx, NSCD_DB_PASSWD); - flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); + flush_nscd_cache(NSCD_DB_PASSWD); + flush_nscd_cache(NSCD_DB_GROUP); done: return ret; @@ -522,8 +521,8 @@ int userdel(TALLOC_CTX *mem_ctx, DEBUG(2, ("Removing user failed: %s (%d)\n", strerror(ret), ret)); } - flush_nscd_cache(mem_ctx, NSCD_DB_PASSWD); - flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); + flush_nscd_cache(NSCD_DB_PASSWD); + flush_nscd_cache(NSCD_DB_GROUP); return ret; } @@ -531,15 +530,14 @@ int userdel(TALLOC_CTX *mem_ctx, /* * Public interface for adding groups */ -int groupadd(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *sysdb, - struct ops_ctx *data) +int groupadd(struct sysdb_ctx *sysdb, + struct ops_ctx *data) { int ret; ret = sysdb_add_group(sysdb, data->name, data->gid, NULL, 0, 0); if (ret == EOK) { - flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); + flush_nscd_cache(NSCD_DB_GROUP); } return ret; } @@ -566,7 +564,7 @@ int groupdel(TALLOC_CTX *mem_ctx, DEBUG(2, ("Removing group failed: %s (%d)\n", strerror(ret), ret)); } - flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); + flush_nscd_cache(NSCD_DB_GROUP); return ret; } diff --git a/src/tools/sss_sync_ops.h b/src/tools/sss_sync_ops.h index fcf7e223e..95722a0b6 100644 --- a/src/tools/sss_sync_ops.h +++ b/src/tools/sss_sync_ops.h @@ -82,9 +82,8 @@ int usermod(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, struct ops_ctx *data); -int groupadd(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *sysdb, - struct ops_ctx *data); +int groupadd(struct sysdb_ctx *sysdb, + struct ops_ctx *data); int groupdel(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, struct ops_ctx *data); diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c index 747ebaf59..5ca2612a3 100644 --- a/src/tools/sss_useradd.c +++ b/src/tools/sss_useradd.c @@ -220,10 +220,8 @@ int main(int argc, const char **argv) } } - ret = create_homedir(tctx, - tctx->octx->skeldir, + ret = create_homedir(tctx->octx->skeldir, tctx->octx->home, - tctx->octx->name, tctx->octx->uid, tctx->octx->gid, tctx->octx->umask); diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c index 7dfdecf8c..404aef259 100644 --- a/src/tools/tools_util.c +++ b/src/tools/tools_util.c @@ -465,10 +465,8 @@ fail: return ret; } -int create_homedir(TALLOC_CTX *mem_ctx, - const char *skeldir, +int create_homedir(const char *skeldir, const char *homedir, - const char *username, uid_t uid, gid_t gid, mode_t default_umask) diff --git a/src/tools/tools_util.h b/src/tools/tools_util.h index e8b253616..fccd9d96b 100644 --- a/src/tools/tools_util.h +++ b/src/tools/tools_util.h @@ -80,10 +80,8 @@ int check_group_names(struct tools_ctx *tctx, char **grouplist, char **badgroup); -int create_homedir(TALLOC_CTX *mem_ctx, - const char *skeldir, +int create_homedir(const char *skeldir, const char *homedir, - const char *username, uid_t uid, gid_t gid, mode_t default_umask); @@ -114,7 +112,7 @@ enum nscd_db { NSCD_DB_GROUP }; -int flush_nscd_cache(TALLOC_CTX *mem_ctx, enum nscd_db flush_db); +int flush_nscd_cache(enum nscd_db flush_db); /* from selinux.c */ int selinux_file_context(const char *dst_name); |