[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu May 11 22:38:03 UTC 2017


The branch, master has been updated
       via  91852dd s4: torture: Remove use of local variables that are simply mirroring popt_get_cmdline_credentials().
       via  4039e51 s4: popt: Change from talloc_autofree_context() to NULL context.
       via  9126744 s4: popt: Make cmdline_credentials static.
       via  b2de5a8 s4: popt: Global replace of cmdline_credentials -> popt_get_cmdline_credentials().
       via  dd4a3ce s4: popt: Add set/get/free functions for cmdline_credentials.
       via  560c375 s4: Add TALLOC_CTX * to register_server_service().
       via  3429829 s4: auth: Remove a talloc_autofree_context() use.
       via  34f616f s4: auth: Add TALLOC_CTX * to auth_register()
       via  1e5797d testprogs: Add 'net rpc user' test against AD DC
      from  fc4dfd7 docs: Remove old docs.

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


- Log -----------------------------------------------------------------
commit 91852dd0816a745f501b765a556b5985521c8119
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 9 16:28:53 2017 -0700

    s4: torture: Remove use of local variables that are simply mirroring popt_get_cmdline_credentials().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri May 12 00:37:29 CEST 2017 on sn-devel-144

commit 4039e51a6fdb476d9865df74dfccf7a020ead141
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 9 16:20:07 2017 -0700

    s4: popt: Change from talloc_autofree_context() to NULL context.
    
    Call popt_free_cmdline_credentials() on successful exit from torture.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 91267449ec1acc461069a8a505e2234221531643
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 9 16:14:03 2017 -0700

    s4: popt: Make cmdline_credentials static.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit b2de5a81bf2e5a79b101859c738fc057af7308ed
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 9 16:10:03 2017 -0700

    s4: popt: Global replace of cmdline_credentials -> popt_get_cmdline_credentials().
    
    Add one use of popt_set_cmdline_credentials().
    Fix 80 column limits when cmdline_credentials changes
    to popt_get_cmdline_credentials().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit dd4a3ce92792c4687f92d4b9e88f7bbee6cad593
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 9 14:34:35 2017 -0700

    s4: popt: Add set/get/free functions for cmdline_credentials.
    
    Preparing to make this static instead of a global.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 560c37524b2b4188011e45c03b3712951476de59
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 9 13:46:45 2017 -0700

    s4: Add TALLOC_CTX * to register_server_service().
    
    Use the passed in context from callers. Remove one
    talloc_autofree_context().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 3429829a42c760e59fcf67463f72002f792cb087
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 9 13:28:49 2017 -0700

    s4: auth: Remove a talloc_autofree_context() use.
    
    Use NULL here, not the autofree context for this
    static pointer. The destructor prevents freeing this
    memory anyway.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 34f616fc6f48a4182f7e5125a080de205925c7e4
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 9 12:39:14 2017 -0700

    s4: auth: Add TALLOC_CTX * to auth_register()
    
    Use the talloc context passed into all modules.
    Remove one more talloc_autofree_context().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 1e5797d19ce9133427573289aa63337e48ea714f
Author: Andreas Schneider <asn at samba.org>
Date:   Tue May 2 12:31:48 2017 +0200

    testprogs: Add 'net rpc user' test against AD DC
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 file_server/file_server.c                   |  2 +-
 lib/ldb-samba/samba_extensions.c            |  3 +-
 nsswitch/libwbclient/tests/wbclient.c       | 60 +++++++++++++++++---------
 source4/auth/auth.h                         |  2 +-
 source4/auth/ntlm/auth.c                    |  5 ++-
 source4/auth/ntlm/auth_anonymous.c          |  2 +-
 source4/auth/ntlm/auth_developer.c          |  2 +-
 source4/auth/ntlm/auth_sam.c                |  6 +--
 source4/auth/ntlm/auth_unix.c               |  2 +-
 source4/auth/ntlm/auth_winbind.c            |  6 +--
 source4/auth/system_session.c               |  7 +++-
 source4/cldap_server/cldap_server.c         |  2 +-
 source4/client/cifsddio.c                   | 13 +++---
 source4/client/client.c                     | 14 +++++--
 source4/dns_server/dns_server.c             |  2 +-
 source4/dsdb/dns/dns_update.c               |  2 +-
 source4/dsdb/kcc/kcc_service.c              |  2 +-
 source4/dsdb/repl/drepl_service.c           |  2 +-
 source4/echo_server/echo_server.c           |  2 +-
 source4/kdc/kdc-heimdal.c                   |  2 +-
 source4/kdc/kdc-service-mit.c               |  2 +-
 source4/ldap_server/ldap_server.c           |  2 +-
 source4/lib/cmdline/popt_common.c           | 18 +++++++-
 source4/lib/cmdline/popt_common.h           |  6 ++-
 source4/lib/cmdline/popt_credentials.c      | 42 ++++++++++++-------
 source4/lib/registry/tools/regdiff.c        |  6 ++-
 source4/lib/registry/tools/regpatch.c       |  6 ++-
 source4/lib/registry/tools/regshell.c       | 11 +++--
 source4/lib/registry/tools/regtree.c        |  9 ++--
 source4/lib/wmi/tools/wmic.c                |  2 +-
 source4/lib/wmi/tools/wmis.c                |  2 +-
 source4/nbt_server/nbt_server.c             |  2 +-
 source4/ntp_signd/ntp_signd.c               |  2 +-
 source4/rpc_server/service_rpc.c            |  2 +-
 source4/selftest/tests.py                   |  1 +
 source4/smb_server/service_smb.c            |  2 +-
 source4/smbd/service.c                      |  7 ++--
 source4/torture/auth/ntlmssp.c              |  4 +-
 source4/torture/basic/misc.c                |  5 +--
 source4/torture/dns/dlz_bind9.c             | 46 +++++++++++---------
 source4/torture/drs/rpc/dssync.c            |  4 +-
 source4/torture/drs/rpc/msds_intid.c        |  2 +-
 source4/torture/krb5/kdc-canon-heimdal.c    | 19 ++++++---
 source4/torture/krb5/kdc-heimdal.c          | 18 ++++----
 source4/torture/krb5/kdc-mit.c              | 15 +++----
 source4/torture/ldap/basic.c                |  4 +-
 source4/torture/ldap/ldap_sort.c            |  2 +-
 source4/torture/ldap/nested_search.c        |  2 +-
 source4/torture/ldap/schema.c               |  2 +-
 source4/torture/ldap/uptodatevector.c       |  2 +-
 source4/torture/libnet/libnet_BecomeDC.c    |  2 +-
 source4/torture/libnet/libnet_domain.c      | 13 +++---
 source4/torture/libnet/libnet_group.c       |  4 +-
 source4/torture/libnet/libnet_lookup.c      |  8 ++--
 source4/torture/libnet/libnet_rpc.c         |  2 +-
 source4/torture/libnet/libnet_share.c       |  4 +-
 source4/torture/libnet/libnet_user.c        |  2 +-
 source4/torture/libnet/utils.c              |  4 +-
 source4/torture/libnetapi/libnetapi.c       |  4 +-
 source4/torture/libsmbclient/libsmbclient.c |  3 +-
 source4/torture/masktest.c                  |  6 ++-
 source4/torture/raw/composite.c             |  4 +-
 source4/torture/raw/context.c               | 14 +++----
 source4/torture/raw/lock.c                  |  2 +-
 source4/torture/raw/lockbench.c             |  2 +-
 source4/torture/raw/openbench.c             |  2 +-
 source4/torture/raw/oplock.c                |  3 +-
 source4/torture/raw/session.c               | 21 ++++++----
 source4/torture/raw/tconrate.c              |  3 +-
 source4/torture/rpc/async_bind.c            |  2 +-
 source4/torture/rpc/backupkey.c             | 13 ++++--
 source4/torture/rpc/backupkey_heimdal.c     | 13 ++++--
 source4/torture/rpc/bind.c                  |  2 +-
 source4/torture/rpc/dfs.c                   |  4 +-
 source4/torture/rpc/dsgetinfo.c             |  2 +-
 source4/torture/rpc/fsrvp.c                 | 12 +++---
 source4/torture/rpc/netlogon.c              | 32 +++++++-------
 source4/torture/rpc/remote_pac.c            |  7 ++--
 source4/torture/rpc/rpc.c                   | 11 ++---
 source4/torture/rpc/samba3rpc.c             | 65 +++++++++++++++++------------
 source4/torture/rpc/samlogon.c              | 40 +++++++++++-------
 source4/torture/rpc/schannel.c              | 29 +++++++------
 source4/torture/rpc/session_key.c           |  2 +-
 source4/torture/rpc/spoolss.c               |  5 +--
 source4/torture/rpc/testjoin.c              |  7 ++--
 source4/torture/rpc/witness.c               |  2 +-
 source4/torture/rpc/wkssvc.c                |  6 +--
 source4/torture/shell.c                     | 31 +++++++++-----
 source4/torture/smb2/acls.c                 |  3 +-
 source4/torture/smb2/oplock.c               |  4 +-
 source4/torture/smb2/replay.c               | 10 ++---
 source4/torture/smb2/scan.c                 |  7 ++--
 source4/torture/smb2/session.c              | 27 ++++++------
 source4/torture/smb2/util.c                 | 10 ++---
 source4/torture/smbtorture.c                |  3 ++
 source4/torture/unix/unix_info2.c           |  2 +-
 source4/torture/unix/whoami.c               |  8 ++--
 source4/torture/util_smb.c                  |  2 +-
 source4/torture/vfs/acl_xattr.c             |  3 +-
 source4/torture/winbind/winbind.c           |  3 +-
 source4/web_server/web_server.c             |  2 +-
 source4/winbind/winbindd.c                  |  4 +-
 source4/wrepl_server/wrepl_server.c         |  2 +-
 testprogs/blackbox/test_net_rpc_user.sh     | 56 +++++++++++++++++++++++++
 104 files changed, 568 insertions(+), 351 deletions(-)
 create mode 100755 testprogs/blackbox/test_net_rpc_user.sh


Changeset truncated at 500 lines:

diff --git a/file_server/file_server.c b/file_server/file_server.c
index 72d7de5..83641f8 100644
--- a/file_server/file_server.c
+++ b/file_server/file_server.c
@@ -97,5 +97,5 @@ NTSTATUS server_service_s3fs_init(TALLOC_CTX *);
 
 NTSTATUS server_service_s3fs_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("s3fs", s3fs_task_init);
+	return register_server_service(ctx, "s3fs", s3fs_task_init);
 }
diff --git a/lib/ldb-samba/samba_extensions.c b/lib/ldb-samba/samba_extensions.c
index be9f36a..28c820e 100644
--- a/lib/ldb-samba/samba_extensions.c
+++ b/lib/ldb-samba/samba_extensions.c
@@ -87,7 +87,8 @@ static int extensions_hook(struct ldb_context *ldb, enum ldb_module_hook_type t)
 		if (ldb_set_opaque(ldb, "sessionInfo", system_session(cmdline_lp_ctx))) {
 			return ldb_operr(ldb);
 		}
-		if (ldb_set_opaque(ldb, "credentials", cmdline_credentials)) {
+		if (ldb_set_opaque(ldb, "credentials",
+				popt_get_cmdline_credentials())) {
 			return ldb_operr(ldb);
 		}
 		if (ldb_set_opaque(ldb, "loadparm", cmdline_lp_ctx)) {
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index c5428af..e80afc4 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -693,13 +693,15 @@ static bool test_wbc_authenticate_user_int(struct torture_context *tctx,
 	struct wbcAuthErrorInfo *error = NULL;
 	wbcErr ret;
 
-	ret = wbcAuthenticateUser(cli_credentials_get_username(cmdline_credentials), correct_password);
+	ret = wbcAuthenticateUser(cli_credentials_get_username(
+			popt_get_cmdline_credentials()), correct_password);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
-				 "wbcAuthenticateUser of %s failed",
-				 cli_credentials_get_username(cmdline_credentials));
+		 "wbcAuthenticateUser of %s failed",
+		 cli_credentials_get_username(popt_get_cmdline_credentials()));
 
 	ZERO_STRUCT(params);
-	params.account_name		= cli_credentials_get_username(cmdline_credentials);
+	params.account_name		=
+		cli_credentials_get_username(popt_get_cmdline_credentials());
 	params.level			= WBC_AUTH_USER_LEVEL_PLAIN;
 	params.password.plaintext	= correct_password;
 
@@ -728,13 +730,15 @@ static bool test_wbc_authenticate_user_int(struct torture_context *tctx,
 
 static bool test_wbc_authenticate_user(struct torture_context *tctx)
 {
-	return test_wbc_authenticate_user_int(tctx, cli_credentials_get_password(cmdline_credentials));
+	return test_wbc_authenticate_user_int(tctx,
+		cli_credentials_get_password(popt_get_cmdline_credentials()));
 }
 
 static bool test_wbc_change_password(struct torture_context *tctx)
 {
 	wbcErr ret;
-	const char *oldpass = cli_credentials_get_password(cmdline_credentials);
+	const char *oldpass =
+		cli_credentials_get_password(popt_get_cmdline_credentials());
 	const char *newpass = "Koo8irei%$";
 
 	struct samr_CryptPassword new_nt_password;
@@ -799,8 +803,10 @@ static bool test_wbc_change_password(struct torture_context *tctx)
 	params.new_password.response.nt_data = new_nt_password.data;
 
 	params.level = WBC_CHANGE_PASSWORD_LEVEL_RESPONSE;
-	params.account_name = cli_credentials_get_username(cmdline_credentials);
-	params.domain_name = cli_credentials_get_domain(cmdline_credentials);
+	params.account_name =
+		cli_credentials_get_username(popt_get_cmdline_credentials());
+	params.domain_name =
+		cli_credentials_get_domain(popt_get_cmdline_credentials());
 
 	ret = wbcChangeUserPasswordEx(&params, NULL, NULL, NULL);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
@@ -810,12 +816,15 @@ static bool test_wbc_change_password(struct torture_context *tctx)
 		return false;
 	}
 
-	ret = wbcChangeUserPassword(cli_credentials_get_username(cmdline_credentials), newpass,
-				    cli_credentials_get_password(cmdline_credentials));
+	ret = wbcChangeUserPassword(
+		cli_credentials_get_username(popt_get_cmdline_credentials()),
+		newpass,
+		cli_credentials_get_password(popt_get_cmdline_credentials()));
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
 				 "wbcChangeUserPassword for %s failed", params.account_name);
 
-	return test_wbc_authenticate_user_int(tctx, cli_credentials_get_password(cmdline_credentials));
+	return test_wbc_authenticate_user_int(tctx,
+		cli_credentials_get_password(popt_get_cmdline_credentials()));
 }
 
 static bool test_wbc_logon_user(struct torture_context *tctx)
@@ -837,8 +846,10 @@ static bool test_wbc_logon_user(struct torture_context *tctx)
 				 "%s", "wbcLogonUser succeeded for NULL where it should "
 				 "have failed");
 
-	params.username = cli_credentials_get_username(cmdline_credentials);
-	params.password = cli_credentials_get_password(cmdline_credentials);
+	params.username =
+		cli_credentials_get_username(popt_get_cmdline_credentials());
+	params.password =
+		cli_credentials_get_password(popt_get_cmdline_credentials());
 
 	ret = wbcAddNamedBlob(&params.num_blobs, &params.blobs,
 			      "foo", 0, discard_const_p(uint8_t, "bar"), 4);
@@ -868,7 +879,8 @@ static bool test_wbc_logon_user(struct torture_context *tctx)
 			      strlen("S-1-2-3-4")+1);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
 				 "%s", "wbcAddNamedBlob failed");
-	params.password = cli_credentials_get_password(cmdline_credentials);
+	params.password =
+		cli_credentials_get_password(popt_get_cmdline_credentials());
 	ret = wbcLogonUser(&params, &info, &error, &policy);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_AUTH_ERROR,
 				 "wbcLogonUser for %s should have failed with "
@@ -883,11 +895,14 @@ static bool test_wbc_logon_user(struct torture_context *tctx)
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
 				 "%s", "wbcInterfaceDetails failed");
 
-	ret = wbcLookupName(iface->netbios_domain, cli_credentials_get_username(cmdline_credentials), &sid,
-			    &sidtype);
+	ret = wbcLookupName(iface->netbios_domain,
+		cli_credentials_get_username(popt_get_cmdline_credentials()),
+		&sid,
+		&sidtype);
 	wbcFreeMemory(iface);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
-				 "wbcLookupName for %s failed", cli_credentials_get_username(cmdline_credentials));
+		"wbcLookupName for %s failed",
+		cli_credentials_get_username(popt_get_cmdline_credentials()));
 
 	ret = wbcSidToString(&sid, &sidstr);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
@@ -899,7 +914,8 @@ static bool test_wbc_logon_user(struct torture_context *tctx)
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
 				 "%s", "wbcAddNamedBlob failed");
 	wbcFreeMemory(sidstr);
-	params.password = cli_credentials_get_password(cmdline_credentials);
+	params.password =
+		cli_credentials_get_password(popt_get_cmdline_credentials());
 	ret = wbcLogonUser(&params, &info, &error, &policy);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
 				 "wbcLogonUser for %s failed", params.username);
@@ -918,9 +934,13 @@ static bool test_wbc_getgroups(struct torture_context *tctx)
 	uint32_t num_groups;
 	gid_t *groups;
 
-	ret = wbcGetGroups(cli_credentials_get_username(cmdline_credentials), &num_groups, &groups);
+	ret = wbcGetGroups(
+		cli_credentials_get_username(popt_get_cmdline_credentials()),
+		&num_groups,
+		&groups);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
-				 "wbcGetGroups for %s failed", cli_credentials_get_username(cmdline_credentials));
+		"wbcGetGroups for %s failed",
+		cli_credentials_get_username(popt_get_cmdline_credentials()));
 	wbcFreeMemory(groups);
 	return true;
 }
diff --git a/source4/auth/auth.h b/source4/auth/auth.h
index 066703d..de3a8bd 100644
--- a/source4/auth/auth.h
+++ b/source4/auth/auth.h
@@ -156,7 +156,7 @@ NTSTATUS auth_check_password(struct auth4_context *auth_ctx,
 			     struct auth_user_info_dc **user_info_dc,
 			     uint8_t *pauthoritative);
 NTSTATUS auth4_init(void);
-NTSTATUS auth_register(const struct auth_operations *ops);
+NTSTATUS auth_register(TALLOC_CTX *mem_ctx, const struct auth_operations *ops);
 NTSTATUS server_service_auth_init(TALLOC_CTX *ctx);
 NTSTATUS authenticate_ldap_simple_bind(TALLOC_CTX *mem_ctx,
 				       struct tevent_context *ev,
diff --git a/source4/auth/ntlm/auth.c b/source4/auth/ntlm/auth.c
index 2f2cdc1..c8c3e11 100644
--- a/source4/auth/ntlm/auth.c
+++ b/source4/auth/ntlm/auth.c
@@ -764,7 +764,8 @@ static int num_backends;
   The 'name' can be later used by other backends to find the operations
   structure for this backend.
 */
-_PUBLIC_ NTSTATUS auth_register(const struct auth_operations *ops)
+_PUBLIC_ NTSTATUS auth_register(TALLOC_CTX *mem_ctx,
+			const struct auth_operations *ops)
 {
 	struct auth_operations *new_ops;
 	
@@ -775,7 +776,7 @@ _PUBLIC_ NTSTATUS auth_register(const struct auth_operations *ops)
 		return NT_STATUS_OBJECT_NAME_COLLISION;
 	}
 
-	backends = talloc_realloc(talloc_autofree_context(), backends, 
+	backends = talloc_realloc(mem_ctx, backends,
 				  struct auth_backend, num_backends+1);
 	NT_STATUS_HAVE_NO_MEMORY(backends);
 
diff --git a/source4/auth/ntlm/auth_anonymous.c b/source4/auth/ntlm/auth_anonymous.c
index 9bdcf0c..6d3d0ac 100644
--- a/source4/auth/ntlm/auth_anonymous.c
+++ b/source4/auth/ntlm/auth_anonymous.c
@@ -99,7 +99,7 @@ _PUBLIC_ NTSTATUS auth4_anonymous_init(TALLOC_CTX *ctx)
 {
 	NTSTATUS ret;
 
-	ret = auth_register(&anonymous_auth_ops);
+	ret = auth_register(ctx, &anonymous_auth_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register 'anonymous' auth backend!\n"));
 		return ret;
diff --git a/source4/auth/ntlm/auth_developer.c b/source4/auth/ntlm/auth_developer.c
index 93a073b..e7e4be9 100644
--- a/source4/auth/ntlm/auth_developer.c
+++ b/source4/auth/ntlm/auth_developer.c
@@ -141,7 +141,7 @@ _PUBLIC_ NTSTATUS auth4_developer_init(TALLOC_CTX *ctx)
 {
 	NTSTATUS ret;
 
-	ret = auth_register(&name_to_ntstatus_auth_ops);
+	ret = auth_register(ctx, &name_to_ntstatus_auth_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register 'name_to_ntstatus' auth backend!\n"));
 		return ret;
diff --git a/source4/auth/ntlm/auth_sam.c b/source4/auth/ntlm/auth_sam.c
index 305fdc5..f7da04e 100644
--- a/source4/auth/ntlm/auth_sam.c
+++ b/source4/auth/ntlm/auth_sam.c
@@ -928,19 +928,19 @@ _PUBLIC_ NTSTATUS auth4_sam_init(TALLOC_CTX *ctx)
 {
 	NTSTATUS ret;
 
-	ret = auth_register(&sam_ops);
+	ret = auth_register(ctx, &sam_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register 'sam' auth backend!\n"));
 		return ret;
 	}
 
-	ret = auth_register(&sam_ignoredomain_ops);
+	ret = auth_register(ctx, &sam_ignoredomain_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register 'sam_ignoredomain' auth backend!\n"));
 		return ret;
 	}
 
-	ret = auth_register(&sam_failtrusts_ops);
+	ret = auth_register(ctx, &sam_failtrusts_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register 'sam_failtrusts' auth backend!\n"));
 		return ret;
diff --git a/source4/auth/ntlm/auth_unix.c b/source4/auth/ntlm/auth_unix.c
index 5fb8b4f..ad780ba 100644
--- a/source4/auth/ntlm/auth_unix.c
+++ b/source4/auth/ntlm/auth_unix.c
@@ -755,7 +755,7 @@ _PUBLIC_ NTSTATUS auth4_unix_init(TALLOC_CTX *ctx)
 {
 	NTSTATUS ret;
 
-	ret = auth_register(&unix_ops);
+	ret = auth_register(ctx, &unix_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register unix auth backend!\n"));
 		return ret;
diff --git a/source4/auth/ntlm/auth_winbind.c b/source4/auth/ntlm/auth_winbind.c
index d5bf5ad..f5bd22a 100644
--- a/source4/auth/ntlm/auth_winbind.c
+++ b/source4/auth/ntlm/auth_winbind.c
@@ -317,19 +317,19 @@ _PUBLIC_ NTSTATUS auth4_winbind_init(TALLOC_CTX *ctx)
 {
 	NTSTATUS ret;
 
-	ret = auth_register(&winbind_ops);
+	ret = auth_register(ctx, &winbind_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register 'winbind' auth backend!\n"));
 		return ret;
 	}
 
-	ret = auth_register(&winbind_rodc_ops);
+	ret = auth_register(ctx, &winbind_rodc_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register 'winbind_rodc' auth backend!\n"));
 		return ret;
 	}
 
-	ret = auth_register(&winbind_wbclient_ops);
+	ret = auth_register(ctx, &winbind_wbclient_ops);
 	if (!NT_STATUS_IS_OK(ret)) {
 		DEBUG(0,("Failed to register 'winbind_wbclient' auth backend!\n"));
 		return ret;
diff --git a/source4/auth/system_session.c b/source4/auth/system_session.c
index 3b9edd7..4c5290d 100644
--- a/source4/auth/system_session.c
+++ b/source4/auth/system_session.c
@@ -51,7 +51,12 @@ _PUBLIC_ struct auth_session_info *system_session(struct loadparm_context *lp_ct
 		return static_session;
 	}
 
-	nt_status = auth_system_session_info(talloc_autofree_context(),
+	/*
+	 * Use NULL here, not the autofree context for this
+	 * static pointer. The destructor prevents freeing this
+	 * memory anyway.
+	 */
+	nt_status = auth_system_session_info(NULL,
 					     lp_ctx,
 					     &static_session);
 	if (!NT_STATUS_IS_OK(nt_status)) {
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index de8bc4e..35a2b99 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -243,5 +243,5 @@ static void cldapd_task_init(struct task_server *task)
 */
 NTSTATUS server_service_cldapd_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("cldap", cldapd_task_init);
+	return register_server_service(ctx, "cldap", cldapd_task_init);
 }
diff --git a/source4/client/cifsddio.c b/source4/client/cifsddio.c
index 0ceb69e..19d7dc8 100644
--- a/source4/client/cifsddio.c
+++ b/source4/client/cifsddio.c
@@ -236,12 +236,13 @@ static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ct
 	 * each connection, but for now, we just use the same one for both.
 	 */
 	ret = smbcli_full_connection(NULL, &cli, host, ports, share,
-				     NULL /* devtype */,
-				     socket_options,
-				     cmdline_credentials, resolve_ctx,
-				     ev, options,
-				     session_options,
-				     gensec_settings);
+				NULL /* devtype */,
+				socket_options,
+				popt_get_cmdline_credentials(),
+				resolve_ctx,
+				ev, options,
+				session_options,
+				gensec_settings);
 
 	if (!NT_STATUS_IS_OK(ret)) {
 		fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
diff --git a/source4/client/client.c b/source4/client/client.c
index 1182e5b..9b2115a 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -174,7 +174,11 @@ static void send_message(struct smbcli_state *cli, const char *desthost)
 	int total_len = 0;
 	int grp_id;
 
-	if (!smbcli_message_start(cli->tree, desthost, cli_credentials_get_username(cmdline_credentials), &grp_id)) {
+	if (!smbcli_message_start(cli->tree,
+			desthost,
+			cli_credentials_get_username(
+				popt_get_cmdline_credentials()),
+			&grp_id)) {
 		d_printf("message start: %s\n", smbcli_errstr(cli->tree));
 		return;
 	}
@@ -2702,7 +2706,7 @@ static bool browse_host(struct loadparm_context *lp_ctx,
 
 	status = dcerpc_pipe_connect(mem_ctx, &p, binding, 
 					 &ndr_table_srvsvc,
-				     cmdline_credentials, ev_ctx,
+				     popt_get_cmdline_credentials(), ev_ctx,
 				     lp_ctx);
 	if (!NT_STATUS_IS_OK(status)) {
 		d_printf("Failed to connect to %s - %s\n", 
@@ -3395,7 +3399,8 @@ static int do_message_op(const char *netbios_name, const char *desthost,
 	}
 
 	if (poptPeekArg(pc)) { 
-		cli_credentials_set_password(cmdline_credentials, poptGetArg(pc), CRED_SPECIFIED);
+		cli_credentials_set_password(popt_get_cmdline_credentials(),
+			poptGetArg(pc), CRED_SPECIFIED);
 	}
 
 	/*init_names(); */
@@ -3439,7 +3444,8 @@ static int do_message_op(const char *netbios_name, const char *desthost,
 	if (!do_connect(ctx, ev_ctx, lpcfg_resolve_context(cmdline_lp_ctx),
 			desthost, lpcfg_smb_ports(cmdline_lp_ctx), service,
 			lpcfg_socket_options(cmdline_lp_ctx),
-			cmdline_credentials, &smb_options, &smb_session_options,
+			popt_get_cmdline_credentials(),
+			&smb_options, &smb_session_options,
 			lpcfg_gensec_settings(ctx, cmdline_lp_ctx)))
 		return 1;
 
diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c
index d467cca..5e9527d 100644
--- a/source4/dns_server/dns_server.c
+++ b/source4/dns_server/dns_server.c
@@ -929,5 +929,5 @@ static void dns_task_init(struct task_server *task)
 
 NTSTATUS server_service_dns_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("dns", dns_task_init);
+	return register_server_service(ctx, "dns", dns_task_init);
 }
diff --git a/source4/dsdb/dns/dns_update.c b/source4/dsdb/dns/dns_update.c
index d2e3466..f74256d 100644
--- a/source4/dsdb/dns/dns_update.c
+++ b/source4/dsdb/dns/dns_update.c
@@ -667,5 +667,5 @@ static void dnsupdate_task_init(struct task_server *task)
 */
 NTSTATUS server_service_dnsupdate_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("dnsupdate", dnsupdate_task_init);
+	return register_server_service(ctx, "dnsupdate", dnsupdate_task_init);
 }
diff --git a/source4/dsdb/kcc/kcc_service.c b/source4/dsdb/kcc/kcc_service.c
index 000206f..946a8fe 100644
--- a/source4/dsdb/kcc/kcc_service.c
+++ b/source4/dsdb/kcc/kcc_service.c
@@ -347,5 +347,5 @@ static void kccsrv_task_init(struct task_server *task)
 */
 NTSTATUS server_service_kcc_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("kcc", kccsrv_task_init);
+	return register_server_service(ctx, "kcc", kccsrv_task_init);
 }
diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c
index 787f2d7..39791b4 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -516,5 +516,5 @@ static void dreplsrv_task_init(struct task_server *task)
 */
 NTSTATUS server_service_drepl_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("drepl", dreplsrv_task_init);
+	return register_server_service(ctx, "drepl", dreplsrv_task_init);
 }
diff --git a/source4/echo_server/echo_server.c b/source4/echo_server/echo_server.c
index a934b5b..e610232 100644
--- a/source4/echo_server/echo_server.c
+++ b/source4/echo_server/echo_server.c
@@ -343,5 +343,5 @@ static void echo_task_init(struct task_server *task)
  */
 NTSTATUS server_service_echo_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("echo", echo_task_init);
+	return register_server_service(ctx, "echo", echo_task_init);
 }
diff --git a/source4/kdc/kdc-heimdal.c b/source4/kdc/kdc-heimdal.c
index fd48114..d5c721b 100644
--- a/source4/kdc/kdc-heimdal.c
+++ b/source4/kdc/kdc-heimdal.c
@@ -468,5 +468,5 @@ static void kdc_task_init(struct task_server *task)
 /* called at smbd startup - register ourselves as a server service */
 NTSTATUS server_service_kdc_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("kdc", kdc_task_init);
+	return register_server_service(ctx, "kdc", kdc_task_init);
 }
diff --git a/source4/kdc/kdc-service-mit.c b/source4/kdc/kdc-service-mit.c
index 87c0179..13d6f1f 100644
--- a/source4/kdc/kdc-service-mit.c
+++ b/source4/kdc/kdc-service-mit.c
@@ -352,5 +352,5 @@ NTSTATUS server_service_mitkdc_init(TALLOC_CTX *mem_ctx);
 
 NTSTATUS server_service_mitkdc_init(TALLOC_CTX *mem_ctx)
 {
-	return register_server_service("kdc", mitkdc_task_init);
+	return register_server_service(mem_ctx, "kdc", mitkdc_task_init);
 }
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 747e25d..347a17d 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -1184,5 +1184,5 @@ failed:
 
 NTSTATUS server_service_ldap_init(TALLOC_CTX *ctx)
 {
-	return register_server_service("ldap", ldapsrv_task_init);
+	return register_server_service(ctx, "ldap", ldapsrv_task_init);
 }
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c
index 25b02b4..5fce312 100644
--- a/source4/lib/cmdline/popt_common.c
+++ b/source4/lib/cmdline/popt_common.c
@@ -38,7 +38,23 @@
 
 enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL,OPT_DEBUG_STDERR};
 
-struct cli_credentials *cmdline_credentials = NULL;
+static struct cli_credentials *cmdline_credentials = NULL;
+
+void popt_set_cmdline_credentials(struct cli_credentials *creds)
+{
+	cmdline_credentials = creds;
+}
+
+struct cli_credentials *popt_get_cmdline_credentials(void)
+{


-- 
Samba Shared Repository



More information about the samba-cvs mailing list