Blob Blame History Raw
From 1457b4a7623a8ae58fb8d6a652d1cc44904b8863 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Mon, 18 Mar 2019 11:02:57 +0100
Subject: [PATCH 1/2] create-user: add nis-domain option

Related to https://gitlab.freedesktop.org/realmd/adcli/issues/2
---
 doc/adcli.xml | 8 ++++++++
 tools/entry.c | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/doc/adcli.xml b/doc/adcli.xml
index 4722c3a..18620c0 100644
--- a/doc/adcli.xml
+++ b/doc/adcli.xml
@@ -531,6 +531,14 @@ $ adcli create-user Fry --domain=domain.example.com \
 			the new created user account, which should be the user's
 			numeric primary user id.</para></listitem>
 		</varlistentry>
+		<varlistentry>
+			<term><option>--nis-domain=<parameter>nis_domain</parameter></option></term>
+			<listitem><para>Set the <code>msSFU30NisDomain</code> attribute of
+			the new created user account, which should be the user's
+			NIS domain is the NIS/YP service of Active Directory's Services for Unix (SFU)
+			are used. This is needed to let the 'UNIX attributes' tab of older Active
+			Directoy versions show the set UNIX specific attributes.</para></listitem>
+		</varlistentry>
 	</variablelist>
 
 </refsect1>
diff --git a/tools/entry.c b/tools/entry.c
index 7b6a200..69ce62c 100644
--- a/tools/entry.c
+++ b/tools/entry.c
@@ -52,6 +52,7 @@ typedef enum {
 	opt_unix_uid,
 	opt_unix_gid,
 	opt_unix_shell,
+	opt_nis_domain,
 } Option;
 
 static adcli_tool_desc common_usages[] = {
@@ -62,6 +63,7 @@ static adcli_tool_desc common_usages[] = {
 	{ opt_unix_uid, "unix uid number" },
 	{ opt_unix_gid, "unix gid number" },
 	{ opt_unix_shell, "unix shell" },
+	{ opt_nis_domain, "NIS domain" },
 	{ opt_domain, "active directory domain name" },
 	{ opt_domain_realm, "kerberos realm for the domain" },
 	{ opt_domain_controller, "domain directory server to connect to" },
@@ -159,6 +161,7 @@ adcli_tool_user_create (adcli_conn *conn,
 		{ "unix-uid", required_argument, NULL, opt_unix_uid },
 		{ "unix-gid", required_argument, NULL, opt_unix_gid },
 		{ "unix-shell", required_argument, NULL, opt_unix_shell },
+		{ "nis-domain", required_argument, NULL, opt_nis_domain },
 		{ "domain-ou", required_argument, NULL, opt_domain_ou },
 		{ "domain", required_argument, NULL, opt_domain },
 		{ "domain-realm", required_argument, NULL, opt_domain_realm },
@@ -200,6 +203,9 @@ adcli_tool_user_create (adcli_conn *conn,
 		case opt_unix_shell:
 			adcli_attrs_add (attrs, "loginShell", optarg, NULL);
 			break;
+		case opt_nis_domain:
+			adcli_attrs_add (attrs, "msSFU30NisDomain", optarg, NULL);
+			break;
 		case opt_domain_ou:
 			ou = optarg;
 			break;
-- 
2.20.1