summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/man/sss_useradd.8.xml13
-rw-r--r--src/tools/sss_useradd.c59
2 files changed, 2 insertions, 70 deletions
diff --git a/src/man/sss_useradd.8.xml b/src/man/sss_useradd.8.xml
index 4b745ab97..70998f8e6 100644
--- a/src/man/sss_useradd.8.xml
+++ b/src/man/sss_useradd.8.xml
@@ -52,19 +52,6 @@
</varlistentry>
<varlistentry>
<term>
- <option>-g</option>,<option>--gid</option>
- <replaceable>GID</replaceable>
- </term>
- <listitem>
- <para>
- Set the GID or group membership of the user to the value
- of <replaceable>GID</replaceable>. If not given, it is
- chosen automatically.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
<option>-c</option>,<option>--gecos</option>
<replaceable>COMMENT</replaceable>
</term>
diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c
index 510c0f5b8..f9b95155e 100644
--- a/src/tools/sss_useradd.c
+++ b/src/tools/sss_useradd.c
@@ -32,53 +32,9 @@
#include "tools/tools_util.h"
#include "tools/sss_sync_ops.h"
-/* Returns a gid for a given groupname. If a numerical gid
- * is given, returns that as integer (rationale: shadow-utils)
- * On error, returns -EINVAL
- */
-static int get_gid(struct tools_ctx *tctx, const char *groupname)
-{
- struct ldb_result *res;
- char *end_ptr;
- int ret;
-
- errno = 0;
- tctx->octx->gid = strtoul(groupname, &end_ptr, 10);
- if (groupname == '\0' || *end_ptr != '\0' ||
- errno != 0 || tctx->octx->gid == 0) {
- /* Does not look like a gid - find the group name */
-
- ret = sysdb_getgrnam(tctx->octx, tctx->sysdb,
- tctx->octx->domain, groupname, &res);
- if (ret != EOK) {
- DEBUG(1, ("sysdb_getgrnam failed: %d\n", ret));
- return ret;
- }
-
- switch (res->count) {
- case 0:
- return ENOENT;
-
- case 1:
- tctx->octx->gid = ldb_msg_find_attr_as_uint(res->msgs[0],
- SYSDB_GIDNUM, 0);
- if (tctx->octx->gid == 0) {
- return ERANGE;
- }
- break;
-
- default:
- return EFAULT;
- }
- }
-
- return EOK;
-}
-
int main(int argc, const char **argv)
{
uid_t pc_uid = 0;
- const char *pc_group = NULL;
const char *pc_gecos = NULL;
const char *pc_home = NULL;
char *pc_shell = NULL;
@@ -91,7 +47,6 @@ int main(int argc, const char **argv)
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 },
{ "home", 'h', POPT_ARG_STRING, &pc_home, 0, _("Home directory"), NULL },
{ "shell", 's', POPT_ARG_STRING, &pc_shell, 0, _("Login shell"), NULL },
@@ -202,16 +157,6 @@ 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(tctx, pc_group);
- if (ret != EOK) {
- ERROR("Cannot get group information for the user\n");
- ret = EXIT_FAILURE;
- goto fini;
- }
- }
-
tctx->octx->uid = pc_uid;
/*
@@ -262,9 +207,9 @@ int main(int argc, const char **argv)
/* Create user's home directory and/or mail spool */
if (tctx->octx->create_homedir) {
- /* We need to know the UID and GID of the user, if
+ /* We need to know the UID of the user, if
* sysdb did assign it automatically, do a lookup */
- if (tctx->octx->uid == 0 || tctx->octx->gid == 0) {
+ if (tctx->octx->uid == 0) {
ret = sysdb_getpwnam_sync(tctx,
tctx->sysdb,
tctx->octx->name,