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

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