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

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