Blame SOURCES/0013-tools-add-option-add-samba-data.patch

7ddab3
From d362a0799618b576918f5c5d0625565484670ba2 Mon Sep 17 00:00:00 2001
7ddab3
From: Sumit Bose <sbose@redhat.com>
7ddab3
Date: Tue, 30 Jan 2018 14:46:00 +0100
7ddab3
Subject: [PATCH 13/23] tools: add option --add-samba-data
7ddab3
7ddab3
https://bugs.freedesktop.org/show_bug.cgi?id=100118
7ddab3
7ddab3
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
7ddab3
---
7ddab3
 doc/adcli.xml      | 30 ++++++++++++++++++++++++++++++
7ddab3
 library/adenroll.h |  1 +
7ddab3
 tools/computer.c   | 12 ++++++++++++
7ddab3
 3 files changed, 43 insertions(+)
7ddab3
7ddab3
diff --git a/doc/adcli.xml b/doc/adcli.xml
7ddab3
index c54cc1b..fbc6c63 100644
7ddab3
--- a/doc/adcli.xml
7ddab3
+++ b/doc/adcli.xml
7ddab3
@@ -292,6 +292,21 @@ Password for Administrator:
7ddab3
 			machine account password. This is output in a format that should
7ddab3
 			be both human and machine readable.</para></listitem>
7ddab3
 		</varlistentry>
7ddab3
+		<varlistentry>
7ddab3
+			<term><option>--add-samba-data</option></term>
7ddab3
+			<listitem><para>After a successful join add the domain
7ddab3
+			SID and the machine account password to the Samba
7ddab3
+			specific databases by calling Samba's
7ddab3
+			<command>net</command> utility.</para>
7ddab3
+
7ddab3
+			<para>Please note that Samba's <command>net</command>
7ddab3
+			requires some settings in <filename>smb.conf</filename>
7ddab3
+			to create the database entries correctly. Most
7ddab3
+			important here is currently the
7ddab3
+			<option>workgroup</option> option, see
7ddab3
+			<citerefentry><refentrytitle>smb.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
7ddab3
+			for details.</para></listitem>
7ddab3
+		</varlistentry>
7ddab3
 	</variablelist>
7ddab3
 
7ddab3
 </refsect1>
7ddab3
@@ -382,6 +397,21 @@ $ adcli update --login-ccache=/tmp/krbcc_123
7ddab3
 			about join operation. This is output in a format that should
7ddab3
 			be both human and machine readable.</para></listitem>
7ddab3
 		</varlistentry>
7ddab3
+		<varlistentry>
7ddab3
+			<term><option>--add-samba-data</option></term>
7ddab3
+			<listitem><para>After a successful join add the domain
7ddab3
+			SID and the machine account password to the Samba
7ddab3
+			specific databases by calling Samba's
7ddab3
+			<command>net</command> utility.</para>
7ddab3
+
7ddab3
+			<para>Please note that Samba's <command>net</command>
7ddab3
+			requires some settings in <filename>smb.conf</filename>
7ddab3
+			to create the database entries correctly. Most
7ddab3
+			important here is currently the
7ddab3
+			<option>workgroup</option> option, see
7ddab3
+			<citerefentry><refentrytitle>smb.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
7ddab3
+			for details.</para></listitem>
7ddab3
+		</varlistentry>
7ddab3
 	</variablelist>
7ddab3
 
7ddab3
 </refsect1>
7ddab3
diff --git a/library/adenroll.h b/library/adenroll.h
7ddab3
index 9a107ab..32c9764 100644
7ddab3
--- a/library/adenroll.h
7ddab3
+++ b/library/adenroll.h
7ddab3
@@ -30,6 +30,7 @@ typedef enum {
7ddab3
 	ADCLI_ENROLL_NO_KEYTAB = 1 << 1,
7ddab3
 	ADCLI_ENROLL_ALLOW_OVERWRITE = 1 << 2,
7ddab3
 	ADCLI_ENROLL_PASSWORD_VALID = 1 << 3,
7ddab3
+	ADCLI_ENROLL_ADD_SAMBA_DATA = 1 << 3,
7ddab3
 } adcli_enroll_flags;
7ddab3
 
7ddab3
 typedef struct _adcli_enroll adcli_enroll;
7ddab3
diff --git a/tools/computer.c b/tools/computer.c
7ddab3
index a3d0f03..fc646f2 100644
7ddab3
--- a/tools/computer.c
7ddab3
+++ b/tools/computer.c
7ddab3
@@ -106,6 +106,7 @@ typedef enum {
7ddab3
 	opt_os_service_pack,
7ddab3
 	opt_user_principal,
7ddab3
 	opt_computer_password_lifetime,
7ddab3
+	opt_add_samba_data,
7ddab3
 } Option;
7ddab3
 
7ddab3
 static adcli_tool_desc common_usages[] = {
7ddab3
@@ -142,6 +143,8 @@ static adcli_tool_desc common_usages[] = {
7ddab3
 	                     "a successful join" },
7ddab3
 	{ opt_show_password, "show computer account password after after a\n"
7ddab3
 	                     "successful join" },
7ddab3
+	{ opt_add_samba_data, "add domain SID and computer account password\n"
7ddab3
+	                      "to the Samba specific configuration database" },
7ddab3
 	{ opt_verbose, "show verbose progress and failure messages", },
7ddab3
 	{ 0 },
7ddab3
 };
7ddab3
@@ -269,6 +272,7 @@ parse_option (Option opt,
7ddab3
 	case opt_show_details:
7ddab3
 	case opt_show_password:
7ddab3
 	case opt_one_time_password:
7ddab3
+	case opt_add_samba_data:
7ddab3
 		assert (0 && "not reached");
7ddab3
 		break;
7ddab3
 	}
7ddab3
@@ -326,6 +330,7 @@ adcli_tool_computer_join (adcli_conn *conn,
7ddab3
 		{ "user-principal", optional_argument, NULL, opt_user_principal },
7ddab3
 		{ "show-details", no_argument, NULL, opt_show_details },
7ddab3
 		{ "show-password", no_argument, NULL, opt_show_password },
7ddab3
+		{ "add-samba-data", no_argument, NULL, opt_add_samba_data },
7ddab3
 		{ "verbose", no_argument, NULL, opt_verbose },
7ddab3
 		{ "help", no_argument, NULL, 'h' },
7ddab3
 		{ 0 },
7ddab3
@@ -352,6 +357,9 @@ adcli_tool_computer_join (adcli_conn *conn,
7ddab3
 		case opt_show_password:
7ddab3
 			show_password = 1;
7ddab3
 			break;
7ddab3
+		case opt_add_samba_data:
7ddab3
+			flags |= ADCLI_ENROLL_ADD_SAMBA_DATA;
7ddab3
+			break;
7ddab3
 		case 'h':
7ddab3
 		case '?':
7ddab3
 		case ':':
7ddab3
@@ -425,6 +433,7 @@ adcli_tool_computer_update (adcli_conn *conn,
7ddab3
 		{ "computer-password-lifetime", optional_argument, NULL, opt_computer_password_lifetime },
7ddab3
 		{ "show-details", no_argument, NULL, opt_show_details },
7ddab3
 		{ "show-password", no_argument, NULL, opt_show_password },
7ddab3
+		{ "add-samba-data", no_argument, NULL, opt_add_samba_data },
7ddab3
 		{ "verbose", no_argument, NULL, opt_verbose },
7ddab3
 		{ "help", no_argument, NULL, 'h' },
7ddab3
 		{ 0 },
7ddab3
@@ -447,6 +456,9 @@ adcli_tool_computer_update (adcli_conn *conn,
7ddab3
 		case opt_show_password:
7ddab3
 			show_password = 1;
7ddab3
 			break;
7ddab3
+		case opt_add_samba_data:
7ddab3
+			flags |= ADCLI_ENROLL_ADD_SAMBA_DATA;
7ddab3
+			break;
7ddab3
 		case 'h':
7ddab3
 		case '?':
7ddab3
 		case ':':
7ddab3
-- 
7ddab3
2.14.4
7ddab3