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

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