[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Jan 7 16:19:05 MST 2015


The branch, master has been updated
       via  a5d383c allow net ads join accept new osServicePack parameter
       via  a13e29c s3-libads: Fix a possible segfault in kerberos_fetch_pac().
      from  8d0729d vfs: Add glusterfs manpage.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a5d383cbd56fdab958334c8e6a19a824941c11c1
Author: Noel Power <noel.power at suse.com>
Date:   Thu Oct 2 16:13:18 2014 +0100

    allow net ads join accept new osServicePack parameter
    
    osServicePack paramater allows the default behaviour ( which is to use
    the samba version string as the operatingSystemServicePack attribute )
    to be overridden
    Additionally make sure if blank string is passed that it is treated
    as attribute deletion. This is necessary as values for the os attributes
    are eventually passed to ads_modlist_add if the value is "" then the
    attempt to add this attribute fails in the underlying ldap
    'ldap_modfiy_ext_s' function. In this case we need to pass NULL as the
    value to force deletion of the ldap attribute
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Jan  8 00:18:05 CET 2015 on sn-devel-104

commit a13e29cc4345d85ab6fe4482119386b87e4e8673
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 7 17:12:54 2015 +0100

    s3-libads: Fix a possible segfault in kerberos_fetch_pac().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11037
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/libads/authdata.c          | 26 +++++++++++++-------------
 source3/libnet/libnet_join.c       | 15 +++++++++++++--
 source3/librpc/idl/libnet_join.idl |  1 +
 source3/utils/net_ads.c            | 12 ++++++++++++
 4 files changed, 39 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c
index 18a2e4f..d3a0992 100644
--- a/source3/libads/authdata.c
+++ b/source3/libads/authdata.c
@@ -61,7 +61,7 @@ static NTSTATUS kerberos_fetch_pac(struct auth4_context *auth_ctx,
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	if (pac_blob) {
+	if (pac_blob != NULL) {
 		status = kerberos_decode_pac(tmp_ctx,
 					     *pac_blob,
 					     NULL,
@@ -73,22 +73,22 @@ static NTSTATUS kerberos_fetch_pac(struct auth4_context *auth_ctx,
 		if (!NT_STATUS_IS_OK(status)) {
 			goto done;
 		}
-	}
 
-	pac_data_ctr = talloc(mem_ctx, struct PAC_DATA_CTR);
-	if (pac_data_ctr == NULL) {
-		status = NT_STATUS_NO_MEMORY;
-		goto done;
-	}
+		pac_data_ctr = talloc(mem_ctx, struct PAC_DATA_CTR);
+		if (pac_data_ctr == NULL) {
+			status = NT_STATUS_NO_MEMORY;
+			goto done;
+		}
 
-	talloc_set_name_const(pac_data_ctr, "struct PAC_DATA_CTR");
+		talloc_set_name_const(pac_data_ctr, "struct PAC_DATA_CTR");
 
-	pac_data_ctr->pac_data = talloc_steal(pac_data_ctr, pac_data);
-	pac_data_ctr->pac_blob = data_blob_talloc(pac_data_ctr,
-						  pac_blob->data,
-						  pac_blob->length);
+		pac_data_ctr->pac_data = talloc_steal(pac_data_ctr, pac_data);
+		pac_data_ctr->pac_blob = data_blob_talloc(pac_data_ctr,
+							  pac_blob->data,
+							  pac_blob->length);
 
-	auth_ctx->private_data = talloc_steal(auth_ctx, pac_data_ctr);
+		auth_ctx->private_data = talloc_steal(auth_ctx, pac_data_ctr);
+	}
 
 	*session_info = talloc_zero(mem_ctx, struct auth_session_info);
 	if (!*session_info) {
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index dd87c6d..c5a61fe 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -574,8 +574,19 @@ static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx,
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 
-	os_sp = talloc_asprintf(mem_ctx, "Samba %s", samba_version_string());
-	if (!os_sp) {
+	if (r->in.os_servicepack) {
+		/*
+		 * if blank string then leave os_sp equal to NULL to force
+		 * attribute delete (LDAP_MOD_DELETE)
+		 */
+		if (!strequal(r->in.os_servicepack,"")) {
+			os_sp = talloc_strdup(mem_ctx, r->in.os_servicepack);
+		}
+	} else {
+		os_sp = talloc_asprintf(mem_ctx, "Samba %s",
+					samba_version_string());
+	}
+	if (!os_sp && !strequal(r->in.os_servicepack,"")) {
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 
diff --git a/source3/librpc/idl/libnet_join.idl b/source3/librpc/idl/libnet_join.idl
index ac0a350..cb2d9e4 100644
--- a/source3/librpc/idl/libnet_join.idl
+++ b/source3/librpc/idl/libnet_join.idl
@@ -27,6 +27,7 @@ interface libnetjoin
 		[in] wkssvc_joinflags join_flags,
 		[in] string os_version,
 		[in] string os_name,
+		[in] string os_servicepack,
 		[in] boolean8 create_upn,
 		[in] string upn,
 		[in] boolean8 modify_config,
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index ba500b5..b0e7112 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1329,6 +1329,9 @@ static int net_ads_join_usage(struct net_context *c, int argc, const char **argv
 		   "                          Also, the operatingSystemService attribute is also set when along with\n"
 		   "                          the two other attributes.\n"));
 
+	d_printf(_("   osServicePack=string Set the operatingSystemServicePack "
+		   "attribute during the join. Note: if not specified then by "
+		   "default the samba version string is used instead.\n"));
 	return -1;
 }
 
@@ -1434,6 +1437,7 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
 	int i;
 	const char *os_name = NULL;
 	const char *os_version = NULL;
+	const char *os_servicepack = NULL;
 	bool modify_config = lp_config_backend_is_registry();
 
 	if (c->display_usage)
@@ -1491,6 +1495,13 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
 				goto fail;
 			}
 		}
+		else if ( !strncasecmp_m(argv[i], "osServicePack", strlen("osServicePack")) ) {
+			if ( (os_servicepack = get_string_param(argv[i])) == NULL ) {
+				d_fprintf(stderr, _("Please supply a valid servicepack identifier.\n"));
+				werr = WERR_INVALID_PARAM;
+				goto fail;
+			}
+		}
 		else if ( !strncasecmp_m(argv[i], "machinepass", strlen("machinepass")) ) {
 			if ( (machine_password = get_string_param(argv[i])) == NULL ) {
 				d_fprintf(stderr, _("Please supply a valid password to set as trust account password.\n"));
@@ -1524,6 +1535,7 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
 	r->in.account_ou	= create_in_ou;
 	r->in.os_name		= os_name;
 	r->in.os_version	= os_version;
+	r->in.os_servicepack	= os_servicepack;
 	r->in.dc_name		= c->opt_host;
 	r->in.admin_account	= c->opt_user_name;
 	r->in.admin_password	= net_prompt_pass(c, c->opt_user_name);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list