8fc58f6
From 1457b4a7623a8ae58fb8d6a652d1cc44904b8863 Mon Sep 17 00:00:00 2001
8fc58f6
From: Sumit Bose <sbose@redhat.com>
8fc58f6
Date: Mon, 18 Mar 2019 11:02:57 +0100
8fc58f6
Subject: [PATCH 1/2] create-user: add nis-domain option
8fc58f6
8fc58f6
Related to https://gitlab.freedesktop.org/realmd/adcli/issues/2
8fc58f6
---
8fc58f6
 doc/adcli.xml | 8 ++++++++
8fc58f6
 tools/entry.c | 6 ++++++
8fc58f6
 2 files changed, 14 insertions(+)
8fc58f6
8fc58f6
diff --git a/doc/adcli.xml b/doc/adcli.xml
8fc58f6
index 4722c3a..18620c0 100644
8fc58f6
--- a/doc/adcli.xml
8fc58f6
+++ b/doc/adcli.xml
8fc58f6
@@ -531,6 +531,14 @@ $ adcli create-user Fry --domain=domain.example.com \
8fc58f6
 			the new created user account, which should be the user's
8fc58f6
 			numeric primary user id.</para></listitem>
8fc58f6
 		</varlistentry>
8fc58f6
+		<varlistentry>
8fc58f6
+			<term><option>--nis-domain=<parameter>nis_domain</parameter></option></term>
8fc58f6
+			<listitem><para>Set the msSFU30NisDomain attribute of
8fc58f6
+			the new created user account, which should be the user's
8fc58f6
+			NIS domain is the NIS/YP service of Active Directory's Services for Unix (SFU)
8fc58f6
+			are used. This is needed to let the 'UNIX attributes' tab of older Active
8fc58f6
+			Directoy versions show the set UNIX specific attributes.</para></listitem>
8fc58f6
+		</varlistentry>
8fc58f6
 	</variablelist>
8fc58f6
 
8fc58f6
 </refsect1>
8fc58f6
diff --git a/tools/entry.c b/tools/entry.c
8fc58f6
index 7b6a200..69ce62c 100644
8fc58f6
--- a/tools/entry.c
8fc58f6
+++ b/tools/entry.c
8fc58f6
@@ -52,6 +52,7 @@ typedef enum {
8fc58f6
 	opt_unix_uid,
8fc58f6
 	opt_unix_gid,
8fc58f6
 	opt_unix_shell,
8fc58f6
+	opt_nis_domain,
8fc58f6
 } Option;
8fc58f6
 
8fc58f6
 static adcli_tool_desc common_usages[] = {
8fc58f6
@@ -62,6 +63,7 @@ static adcli_tool_desc common_usages[] = {
8fc58f6
 	{ opt_unix_uid, "unix uid number" },
8fc58f6
 	{ opt_unix_gid, "unix gid number" },
8fc58f6
 	{ opt_unix_shell, "unix shell" },
8fc58f6
+	{ opt_nis_domain, "NIS domain" },
8fc58f6
 	{ opt_domain, "active directory domain name" },
8fc58f6
 	{ opt_domain_realm, "kerberos realm for the domain" },
8fc58f6
 	{ opt_domain_controller, "domain directory server to connect to" },
8fc58f6
@@ -159,6 +161,7 @@ adcli_tool_user_create (adcli_conn *conn,
8fc58f6
 		{ "unix-uid", required_argument, NULL, opt_unix_uid },
8fc58f6
 		{ "unix-gid", required_argument, NULL, opt_unix_gid },
8fc58f6
 		{ "unix-shell", required_argument, NULL, opt_unix_shell },
8fc58f6
+		{ "nis-domain", required_argument, NULL, opt_nis_domain },
8fc58f6
 		{ "domain-ou", required_argument, NULL, opt_domain_ou },
8fc58f6
 		{ "domain", required_argument, NULL, opt_domain },
8fc58f6
 		{ "domain-realm", required_argument, NULL, opt_domain_realm },
8fc58f6
@@ -200,6 +203,9 @@ adcli_tool_user_create (adcli_conn *conn,
8fc58f6
 		case opt_unix_shell:
8fc58f6
 			adcli_attrs_add (attrs, "loginShell", optarg, NULL);
8fc58f6
 			break;
8fc58f6
+		case opt_nis_domain:
8fc58f6
+			adcli_attrs_add (attrs, "msSFU30NisDomain", optarg, NULL);
8fc58f6
+			break;
8fc58f6
 		case opt_domain_ou:
8fc58f6
 			ou = optarg;
8fc58f6
 			break;
8fc58f6
-- 
8fc58f6
2.20.1
8fc58f6