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

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