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

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