summaryrefslogtreecommitdiff
path: root/server/tools
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-04-27 12:17:08 +0200
committerSimo Sorce <ssorce@redhat.com>2009-04-28 11:57:20 -0400
commit38c0b3bda24f89b0559a3f53e31ec722c186171f (patch)
tree4f7a0f57f83e1a320bfed199ade41bf45270ae53 /server/tools
parentc1a1b0464b5fad4daa9868b846182ad391f716a2 (diff)
downloadsssd-38c0b3bda24f89b0559a3f53e31ec722c186171f.tar.gz
sssd-38c0b3bda24f89b0559a3f53e31ec722c186171f.tar.bz2
sssd-38c0b3bda24f89b0559a3f53e31ec722c186171f.zip
Add debug param to the tools, fix lock/unlock in sss_usermod
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/sss_groupadd.c4
-rw-r--r--server/tools/sss_groupdel.c4
-rw-r--r--server/tools/sss_groupmod.c4
-rw-r--r--server/tools/sss_useradd.c4
-rw-r--r--server/tools/sss_userdel.c4
-rw-r--r--server/tools/sss_usermod.c14
6 files changed, 31 insertions, 3 deletions
diff --git a/server/tools/sss_groupadd.c b/server/tools/sss_groupadd.c
index 09bc89d6..431e34b6 100644
--- a/server/tools/sss_groupadd.c
+++ b/server/tools/sss_groupadd.c
@@ -119,8 +119,10 @@ static int groupadd_legacy(struct group_add_ctx *ctx)
int main(int argc, const char **argv)
{
gid_t pc_gid = 0;
+ int pc_debug = 0;
struct poptOption long_options[] = {
POPT_AUTOHELP
+ { "debug",'\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug, 0, "The debug level to run with", NULL },
{ "gid", 'g', POPT_ARG_INT, &pc_gid, 0, "The GID of the group", NULL },
POPT_TABLEEND
};
@@ -155,6 +157,8 @@ int main(int argc, const char **argv)
goto fini;
}
+ debug_level = pc_debug;
+
/* groupname is an argument, not option */
group_ctx->groupname = poptGetArg(pc);
if(group_ctx->groupname == NULL) {
diff --git a/server/tools/sss_groupdel.c b/server/tools/sss_groupdel.c
index 5d405b64..8e07febf 100644
--- a/server/tools/sss_groupdel.c
+++ b/server/tools/sss_groupdel.c
@@ -112,6 +112,7 @@ static int groupdel_legacy(struct group_del_ctx *ctx)
int main(int argc, const char **argv)
{
int ret = EXIT_SUCCESS;
+ int pc_debug = 0;
struct group_del_ctx *group_ctx = NULL;
struct tools_ctx *ctx = NULL;
struct sss_domain_info *dom;
@@ -120,6 +121,7 @@ int main(int argc, const char **argv)
poptContext pc = NULL;
struct poptOption long_options[] = {
POPT_AUTOHELP
+ { "debug", '\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug, 0, "The debug level to run with", NULL },
POPT_TABLEEND
};
@@ -148,6 +150,8 @@ int main(int argc, const char **argv)
goto fini;
}
+ debug_level = pc_debug;
+
group_ctx->groupname = poptGetArg(pc);
if(group_ctx->groupname == NULL) {
usage(pc, "Specify group to delete\n");
diff --git a/server/tools/sss_groupmod.c b/server/tools/sss_groupmod.c
index 5665c25e..e2c59cba 100644
--- a/server/tools/sss_groupmod.c
+++ b/server/tools/sss_groupmod.c
@@ -234,8 +234,10 @@ static int groupmod_legacy(struct tools_ctx *tools_ctx, struct group_mod_ctx *ct
int main(int argc, const char **argv)
{
gid_t pc_gid = 0;
+ int pc_debug = 0;
struct poptOption long_options[] = {
POPT_AUTOHELP
+ { "debug", '\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug, 0, "The debug level to run with", NULL },
{ "append-group", 'a', POPT_ARG_STRING, NULL, 'a', "Groups to add this group to", NULL },
{ "remove-group", 'r', POPT_ARG_STRING, NULL, 'r', "Groups to remove this group from", NULL },
{ "gid", 'g', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_gid, 0, "The GID of the group", NULL },
@@ -288,6 +290,8 @@ int main(int argc, const char **argv)
}
}
+ debug_level = pc_debug;
+
if(ret != -1) {
usage(pc, poptStrerror(ret));
ret = EXIT_FAILURE;
diff --git a/server/tools/sss_useradd.c b/server/tools/sss_useradd.c
index e0c6feac..78ded2ee 100644
--- a/server/tools/sss_useradd.c
+++ b/server/tools/sss_useradd.c
@@ -305,8 +305,10 @@ int main(int argc, const char **argv)
const char *pc_gecos = NULL;
const char *pc_home = NULL;
const char *pc_shell = NULL;
+ int pc_debug = 0;
struct poptOption long_options[] = {
POPT_AUTOHELP
+ { "debug", '\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug, 0, "The debug level to run with", NULL },
{ "uid", 'u', POPT_ARG_INT, &pc_uid, 0, "The UID of the user", NULL },
{ "gid", 'g', POPT_ARG_STRING, &pc_group, 0, "The GID or group name of the user", NULL },
{ "gecos", 'c', POPT_ARG_STRING, &pc_gecos, 0, "The comment string", NULL },
@@ -356,6 +358,8 @@ int main(int argc, const char **argv)
}
}
+ debug_level = pc_debug;
+
if(ret != -1) {
usage(pc, poptStrerror(ret));
ret = EXIT_FAILURE;
diff --git a/server/tools/sss_userdel.c b/server/tools/sss_userdel.c
index 642e02ba..713c9383 100644
--- a/server/tools/sss_userdel.c
+++ b/server/tools/sss_userdel.c
@@ -116,9 +116,11 @@ int main(int argc, const char **argv)
struct sss_domain_info *dom;
struct passwd *pwd_info;
+ int pc_debug = 0;
poptContext pc = NULL;
struct poptOption long_options[] = {
POPT_AUTOHELP
+ { "debug", '\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug, 0, "The debug level to run with", NULL },
POPT_TABLEEND
};
@@ -147,6 +149,8 @@ int main(int argc, const char **argv)
goto fini;
}
+ debug_level = pc_debug;
+
user_ctx->username = poptGetArg(pc);
if(user_ctx->username == NULL) {
usage(pc, "Specify user to delete\n");
diff --git a/server/tools/sss_usermod.c b/server/tools/sss_usermod.c
index f71350e0..113879fb 100644
--- a/server/tools/sss_usermod.c
+++ b/server/tools/sss_usermod.c
@@ -291,14 +291,16 @@ static int usermod_legacy(struct tools_ctx *tools_ctx, struct user_mod_ctx *ctx,
int main(int argc, const char **argv)
{
- int pc_lock;
+ int pc_lock = 0;
uid_t pc_uid = 0;
gid_t pc_gid = 0;
const char *pc_gecos = NULL;
const char *pc_home = NULL;
const char *pc_shell = NULL;
+ int pc_debug = 0;
struct poptOption long_options[] = {
POPT_AUTOHELP
+ { "debug", '\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug, 0, "The debug level to run with", NULL },
{ "uid", 'u', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_uid, 0, "The UID of the user", NULL },
{ "gid", 'g', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_gid, 0, "The GID of the user", NULL },
{ "gecos", 'c', POPT_ARG_STRING, &pc_gecos, 0, "The comment string", NULL },
@@ -306,8 +308,8 @@ int main(int argc, const char **argv)
{ "shell", 's', POPT_ARG_STRING, &pc_shell, 0, "Login shell", NULL },
{ "append-group", 'a', POPT_ARG_STRING, NULL, 'a', "Groups to add this user to", NULL },
{ "remove-group", 'r', POPT_ARG_STRING, NULL, 'r', "Groups to remove this user from", NULL },
- { "lock", 'L', POPT_ARG_INT, &pc_lock, DO_LOCK, "Lock the account", NULL },
- { "unlock", 'U', POPT_ARG_INT, &pc_lock, DO_UNLOCK, "Unlock the account", NULL },
+ { "lock", 'L', POPT_ARG_NONE, NULL, 'L', "Lock the account", NULL },
+ { "unlock", 'U', POPT_ARG_NONE, NULL, 'U', "Unlock the account", NULL },
POPT_TABLEEND
};
poptContext pc = NULL;
@@ -360,9 +362,15 @@ int main(int argc, const char **argv)
if (ret != EOK) {
break;
}
+ } else if (ret == 'L') {
+ pc_lock = DO_LOCK;
+ } else if (ret == 'U') {
+ pc_lock = DO_UNLOCK;
}
}
+ debug_level = pc_debug;
+
if(ret != -1) {
usage(pc, poptStrerror(ret));
ret = EXIT_FAILURE;