[SCM] Samba Shared Repository - branch v4-2-test updated

Karolin Seeger kseeger at samba.org
Mon Oct 5 10:05:03 UTC 2015


The branch, v4-2-test has been updated
       via  5bc3a2f kerberos: make sure we only use prompter type when available.
       via  b6f1310 winbind: Fix 100% loop
       via  f9a820a s3: smbd: Fix NULL pointer bug introduced by previous 'raw' stream fix (bug #11522).
       via  d69db57 s3: smbd: fix a crash in unix_convert()
       via  2df7b85 net: fix a crash with net ads keytab create
       via  2e516a7 s3: tests: smbclient test to ensure we can create and see a :foobar stream on the top level directory in a share.
       via  22d55ca s3: smbd: Fix opening/creating :stream files on the root share directory.
       via  29f057c s3: smbd: Remove unused parameter from build_stream_path().
       via  eb1aa45 s3: smbclient: Move cmd_setmode out of clitar.c and back into client.c
       via  6c6b62f pam_winbind: Fix a segfault if initialization fails
       via  d2105b7 s4: torture: Test mkdir race condition.
       via  d194836 s3: smbd: Fix mkdir race condition.
       via  105f949 s3: dfs: Fix a crash when the dfs targets are disabled.
      from  68801fb nss_winbind: fix hang on Solaris on big groups

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -----------------------------------------------------------------
commit 5bc3a2f37b7bf65a386105277dc50e0430a7882c
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 2 04:23:59 2015 +0200

    kerberos: make sure we only use prompter type when available.
    
    We also verified that we cannot simply remove the prompter as several older
    versions of Heimdal would crash.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11038
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Fri Oct  2 07:29:43 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 6755376cedaf0c88230b47e04c584c7d9fce13e3)
    
    Autobuild-User(v4-2-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-2-test): Mon Oct  5 12:04:41 CEST 2015 on sn-devel-104

commit b6f1310d4506fd3ea16c75c7bce7df87ddf0de7b
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 28 12:33:13 2015 +0200

    winbind: Fix 100% loop
    
    Thanks to "L.P.H. van Belle" <belle at bazuin.nl>
    for help in reproducing the issue.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11038
    
    From the bug report:
    
    "With e551cdb37d3e re-applied the problem is gone with
    and without kerberos. Moreover, if correctly configured,
    sshd requests you to change your password at logon time,
    which then succeeds.
    
    The problem why I had this reverted was because I had not
    gone through the pain to correctly configure all the PAM
    services (in particular the "account" section), leading
    to sshd letting the user in when the password had to be
    changed."
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit e551cdb37d3e8cfb155bc33f9b162761c8d60889)
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Oct  2 00:16:29 CEST 2015 on sn-devel-104
    
    (cherry picked from commit e524ab9f7ee9f4aff50dd5bc42312f9000bf1c6e)

commit f9a820a5c6bb02c14875a4c1f9b2877c8bd6bf58
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Sep 30 17:12:11 2015 -0700

    s3: smbd: Fix NULL pointer bug introduced by previous 'raw' stream fix (bug #11522).
    
    Ensure dirpath can never be NULL.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11535
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Thu Oct  1 08:58:36 CEST 2015 on sn-devel-104
    
    (cherry picked from commit f9ceaf443991e0bb5db23eeced2841436f47359e)

commit d69db571442f170a2c2538f206590f48f2de97c2
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Sep 25 21:06:57 2015 +0200

    s3: smbd: fix a crash in unix_convert()
    
    Some error code paths may result in dirpath being NULL.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11535
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit bec685fb13e7cbe3bb98e5647183720d31f1c522)

commit 2df7b85433bddf2dd28c6b7ed3dc94970ef40e36
Author: Uri Simchoni <urisimchoni at gmail.com>
Date:   Wed Sep 23 14:45:47 2015 +0300

    net: fix a crash with net ads keytab create
    
    Fix a crash that happens when executing "net ads keytab create"
    and the machine account in AD does not have setvice principal names
    attached to it.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11528
    
    Signed-off-by: Uri Simchoni <urisimchoni at gmail.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit e224e622971853bddbe24df717ea5dcddef71b89)

commit 2e516a79adf7e60749f78dc6c95ec3abdf602872
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Sep 18 11:06:42 2015 -0700

    s3: tests: smbclient test to ensure we can create and see a :foobar stream on the top level directory in a share.
    
    Regression test for:
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11522
    
    Remember to remove the ARCHIVE attribute from the toplevel
    share when done (can only be done over SMB2+).
    
    Back-ported from master 6ce3643e45bac6660ae69123738c4b39d7bc1864
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 22d55ca52ff2ab6aea6c92eff914b6139ad71f68
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Sep 16 12:03:34 2015 -0700

    s3: smbd: Fix opening/creating :stream files on the root share directory.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11522
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 74fd4f93efe92516fc507edf71a588660782879e)

commit 29f057ccb673878e848eb2250062f1ba4c0a1e70
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Sep 16 12:42:46 2015 -0700

    s3: smbd: Remove unused parameter from build_stream_path().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 94e7e707783036b57babc73d320d2a3d8c0648d6)

commit eb1aa45f544d9ad4ed234cc8dd8f69d6c95d88b2
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Sep 18 11:01:14 2015 -0700

    s3: smbclient: Move cmd_setmode out of clitar.c and back into client.c
    
    setmode <file> attribute is a valid smbclient command even if libarchive
    isn't on the system and tarmode isn't compiled in.
    
    Back-ported from master a47012d5429044c9a3616718bac21360f281aa81.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 6c6b62ffdd9f81ec8b1c7d13fc44b26c3d04ac49
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Sep 8 16:48:08 2015 +0200

    pam_winbind: Fix a segfault if initialization fails
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11502
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Tue Sep  8 21:39:21 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 7d84cd6e40024fd361ea21635f7befed40f0e41f)

commit d2105b716f4ed0b7f7b8f2703b57895f13bb522e
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Sep 22 18:01:22 2015 -0700

    s4: torture: Test mkdir race condition.
    
    Found by Max of LoadDynamix <adx.forum at gmail.com>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11486
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Thu Sep 24 06:13:22 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 969d043596c0a382325d54d16dbd5e049f884fa9)

commit d194836903099459bc15f5ec29fa6604572e1d76
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Sep 22 18:02:53 2015 -0700

    s3: smbd: Fix mkdir race condition.
    
    Found by Max of LoadDynamix <adx.forum at gmail.com>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11486
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit b1c823dc8c2824ec89921601d8e5e95f6d18fca8)

commit 105f9499bbe2e73b2958feb6d23c4b4c2e684d41
Author: Har Gagan Sahai <SHarGagan at novell.com>
Date:   Thu Sep 10 16:04:27 2015 +0530

    s3: dfs: Fix a crash when the dfs targets are disabled.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11509
    
    Signed-off-by: Har Gagan Sahai <SHarGagan at novell.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ira Cooper <ira at wakeful.net>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Sep 11 06:39:19 CEST 2015 on sn-devel-104

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

Summary of changes:
 nsswitch/pam_winbind.c                    |  19 ++--
 selftest/knownfail                        |   1 +
 source3/client/client.c                   | 118 +++++++++++++++++++++++
 source3/client/client_proto.h             |   6 ++
 source3/client/clitar.c                   | 130 -------------------------
 source3/libads/kerberos.c                 |  26 +++++
 source3/libads/ldap.c                     |   7 ++
 source3/libsmb/clidfs.c                   |   4 +-
 source3/script/tests/test_smbclient_s3.sh |  36 +++++++
 source3/smbd/filename.c                   |  35 ++++++-
 source3/smbd/open.c                       |  19 ++++
 source4/heimdal_build/wscript_configure   |   1 +
 source4/torture/smb2/create.c             | 151 ++++++++++++++++++++++++++++++
 wscript_configure_system_mitkrb5          |   2 +
 14 files changed, 408 insertions(+), 147 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 1a21a83..7b84a39 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -2485,7 +2485,7 @@ static int _pam_delete_cred(pam_handle_t *pamh, int flags,
 
 	retval = _pam_winbind_init_context(pamh, flags, argc, argv, type, &ctx);
 	if (retval) {
-		goto out;
+		return retval;
 	}
 
 	_PAM_LOG_FUNCTION_ENTER("_pam_delete_cred", ctx);
@@ -2621,7 +2621,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
 	retval = _pam_winbind_init_context(pamh, flags, argc, argv,
 					   PAM_WINBIND_AUTHENTICATE, &ctx);
 	if (retval) {
-		goto out;
+		return retval;
 	}
 
 	_PAM_LOG_FUNCTION_ENTER("pam_sm_authenticate", ctx);
@@ -2773,7 +2773,7 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
 	ret = _pam_winbind_init_context(pamh, flags, argc, argv,
 					PAM_WINBIND_SETCRED, &ctx);
 	if (ret) {
-		goto out;
+		return ret;
 	}
 
 	_PAM_LOG_FUNCTION_ENTER("pam_sm_setcred", ctx);
@@ -2804,8 +2804,6 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
 			break;
 	}
 
- out:
-
 	_PAM_LOG_FUNCTION_LEAVE("pam_sm_setcred", ctx, ret);
 
 	TALLOC_FREE(ctx);
@@ -2829,7 +2827,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
 	ret = _pam_winbind_init_context(pamh, flags, argc, argv,
 					PAM_WINBIND_ACCT_MGMT, &ctx);
 	if (ret) {
-		goto out;
+		return ret;
 	}
 
 	_PAM_LOG_FUNCTION_ENTER("pam_sm_acct_mgmt", ctx);
@@ -2925,7 +2923,7 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags,
 	ret = _pam_winbind_init_context(pamh, flags, argc, argv,
 					PAM_WINBIND_OPEN_SESSION, &ctx);
 	if (ret) {
-		goto out;
+		return ret;
 	}
 
 	_PAM_LOG_FUNCTION_ENTER("pam_sm_open_session", ctx);
@@ -2934,7 +2932,7 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags,
 		/* check and create homedir */
 		ret = _pam_mkhomedir(ctx);
 	}
- out:
+
 	_PAM_LOG_FUNCTION_LEAVE("pam_sm_open_session", ctx, ret);
 
 	TALLOC_FREE(ctx);
@@ -2952,12 +2950,11 @@ int pam_sm_close_session(pam_handle_t *pamh, int flags,
 	ret = _pam_winbind_init_context(pamh, flags, argc, argv,
 					PAM_WINBIND_CLOSE_SESSION, &ctx);
 	if (ret) {
-		goto out;
+		return ret;
 	}
 
 	_PAM_LOG_FUNCTION_ENTER("pam_sm_close_session", ctx);
 
-out:
 	_PAM_LOG_FUNCTION_LEAVE("pam_sm_close_session", ctx, ret);
 
 	TALLOC_FREE(ctx);
@@ -3039,7 +3036,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 	ret = _pam_winbind_init_context(pamh, flags, argc, argv,
 					PAM_WINBIND_CHAUTHTOK, &ctx);
 	if (ret) {
-		goto out;
+		return ret;
 	}
 
 	_PAM_LOG_FUNCTION_ENTER("pam_sm_chauthtok", ctx);
diff --git a/selftest/knownfail b/selftest/knownfail
index 7a89fde..4068b57 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -147,6 +147,7 @@
 ^samba4.raw.acls.*.create_file
 ^samba4.smb2.create.*.acldir
 ^samba4.smb2.create.*.impersonation
+^samba4.smb2.create.*.mkdir-dup # bug 11486
 ^samba4.smb2.acls.*.generic
 ^samba4.smb2.acls.*.inheritflags
 ^samba4.smb2.acls.*.owner
diff --git a/source3/client/client.c b/source3/client/client.c
index 1458cf2..67cc359 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4523,6 +4523,124 @@ static int cmd_show_connect( void )
 	return 0;
 }
 
+/**
+ * set_remote_attr - set DOS attributes of a remote file
+ * @filename: path to the file name
+ * @new_attr: attribute bit mask to use
+ * @mode: one of ATTR_SET or ATTR_UNSET
+ *
+ * Update the file attributes with the one provided.
+ */
+int set_remote_attr(const char *filename, uint16 new_attr, int mode)
+{
+	extern struct cli_state *cli;
+	uint16 old_attr;
+	NTSTATUS status;
+
+	status = cli_getatr(cli, filename, &old_attr, NULL, NULL);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("cli_getatr failed: %s\n", nt_errstr(status));
+		return 1;
+	}
+
+	if (mode == ATTR_SET) {
+		new_attr |= old_attr;
+	} else {
+		new_attr = old_attr & ~new_attr;
+	}
+
+	status = cli_setatr(cli, filename, new_attr, 0);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("cli_setatr failed: %s\n", nt_errstr(status));
+		return 1;
+	}
+
+	return 0;
+}
+
+/**
+ * cmd_setmode - interactive command to set DOS attributes
+ *
+ * Read a filename and mode from the client command line and update
+ * the file DOS attributes.
+ */
+int cmd_setmode(void)
+{
+	const extern char *cmd_ptr;
+	char *buf;
+	char *fname = NULL;
+	uint16 attr[2] = {0};
+	int mode = ATTR_SET;
+	int err = 0;
+	bool ok;
+	TALLOC_CTX *ctx = talloc_new(NULL);
+	if (ctx == NULL) {
+		return 1;
+	}
+
+	ok = next_token_talloc(ctx, &cmd_ptr, &buf, NULL);
+	if (!ok) {
+		d_printf("setmode <filename> <[+|-]rsha>\n");
+		err = 1;
+		goto out;
+	}
+
+	fname = talloc_asprintf(ctx,
+				"%s%s",
+				client_get_cur_dir(),
+				buf);
+	if (fname == NULL) {
+		err = 1;
+		goto out;
+	}
+
+	while (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
+		const char *s = buf;
+
+		while (*s) {
+			switch (*s++) {
+			case '+':
+				mode = ATTR_SET;
+				break;
+			case '-':
+				mode = ATTR_UNSET;
+				break;
+			case 'r':
+				attr[mode] |= FILE_ATTRIBUTE_READONLY;
+				break;
+			case 'h':
+				attr[mode] |= FILE_ATTRIBUTE_HIDDEN;
+				break;
+			case 's':
+				attr[mode] |= FILE_ATTRIBUTE_SYSTEM;
+				break;
+			case 'a':
+				attr[mode] |= FILE_ATTRIBUTE_ARCHIVE;
+				break;
+			default:
+				d_printf("setmode <filename> <perm=[+|-]rsha>\n");
+				err = 1;
+				goto out;
+			}
+		}
+	}
+
+	if (attr[ATTR_SET] == 0 && attr[ATTR_UNSET] == 0) {
+		d_printf("setmode <filename> <[+|-]rsha>\n");
+		err = 1;
+		goto out;
+	}
+
+	DEBUG(2, ("perm set %d %d\n", attr[ATTR_SET], attr[ATTR_UNSET]));
+
+	/* ignore return value: server might not store DOS attributes */
+	set_remote_attr(fname, attr[ATTR_SET], ATTR_SET);
+	set_remote_attr(fname, attr[ATTR_UNSET], ATTR_UNSET);
+out:
+	talloc_free(ctx);
+	return err;
+}
+
 /****************************************************************************
  iosize command
 ***************************************************************************/
diff --git a/source3/client/client_proto.h b/source3/client/client_proto.h
index 3e91ff0..54d3deb 100644
--- a/source3/client/client_proto.h
+++ b/source3/client/client_proto.h
@@ -26,6 +26,11 @@
 struct cli_state;
 struct file_info;
 
+enum {
+	ATTR_UNSET,
+	ATTR_SET,
+};
+
 /* The following definitions come from client/client.c  */
 
 const char *client_get_cur_dir(void);
@@ -36,6 +41,7 @@ NTSTATUS do_list(const char *mask,
 				   const char *dir),
 			bool rec,
 			bool dirs);
+int set_remote_attr(const char *filename, uint16_t new_attr, int mode);
 int cmd_iosize(void);
 
 /* The following definitions come from client/dnsbrowse.c  */
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index e4d391a..2d5c566 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -121,11 +121,6 @@ enum tar_selection {
 	TAR_EXCLUDE,       /* X flag */
 };
 
-enum {
-	ATTR_UNSET,
-	ATTR_SET,
-};
-
 struct tar {
 	TALLOC_CTX *talloc_ctx;
 
@@ -216,7 +211,6 @@ static int make_remote_path(const char *full_path);
 static int max_token (const char *str);
 static NTSTATUS is_subpath(const char *sub, const char *full,
 			   bool *_subpath_match);
-static int set_remote_attr(const char *filename, uint16 new_attr, int mode);
 
 /**
  * tar_get_ctx - retrieve global tar context handle
@@ -384,89 +378,6 @@ out:
 }
 
 /**
- * cmd_setmode - interactive command to set DOS attributes
- *
- * Read a filename and mode from the client command line and update
- * the file DOS attributes.
- */
-int cmd_setmode(void)
-{
-	const extern char *cmd_ptr;
-	char *buf;
-	char *fname = NULL;
-	uint16 attr[2] = {0};
-	int mode = ATTR_SET;
-	int err = 0;
-	bool ok;
-	TALLOC_CTX *ctx = talloc_new(NULL);
-	if (ctx == NULL) {
-		return 1;
-	}
-
-	ok = next_token_talloc(ctx, &cmd_ptr, &buf, NULL);
-	if (!ok) {
-		DBG(0, ("setmode <filename> <[+|-]rsha>\n"));
-		err = 1;
-		goto out;
-	}
-
-	fname = talloc_asprintf(ctx,
-				"%s%s",
-				client_get_cur_dir(),
-				buf);
-	if (fname == NULL) {
-		err = 1;
-		goto out;
-	}
-
-	while (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
-		const char *s = buf;
-
-		while (*s) {
-			switch (*s++) {
-			case '+':
-				mode = ATTR_SET;
-				break;
-			case '-':
-				mode = ATTR_UNSET;
-				break;
-			case 'r':
-				attr[mode] |= FILE_ATTRIBUTE_READONLY;
-				break;
-			case 'h':
-				attr[mode] |= FILE_ATTRIBUTE_HIDDEN;
-				break;
-			case 's':
-				attr[mode] |= FILE_ATTRIBUTE_SYSTEM;
-				break;
-			case 'a':
-				attr[mode] |= FILE_ATTRIBUTE_ARCHIVE;
-				break;
-			default:
-				DBG(0, ("setmode <filename> <perm=[+|-]rsha>\n"));
-				err = 1;
-				goto out;
-			}
-		}
-	}
-
-	if (attr[ATTR_SET] == 0 && attr[ATTR_UNSET] == 0) {
-		DBG(0, ("setmode <filename> <[+|-]rsha>\n"));
-		err = 1;
-		goto out;
-	}
-
-	DBG(2, ("perm set %d %d\n", attr[ATTR_SET], attr[ATTR_UNSET]));
-
-	/* ignore return value: server might not store DOS attributes */
-	set_remote_attr(fname, attr[ATTR_SET], ATTR_SET);
-	set_remote_attr(fname, attr[ATTR_UNSET], ATTR_UNSET);
-out:
-	talloc_free(ctx);
-	return err;
-}
-
-/**
  * tar_parse_args - parse and set tar command line arguments
  * @flag: string pointing to tar options
  * @val: number of tar arguments
@@ -1631,41 +1542,6 @@ out:
 	return status;
 }
 
-/**
- * set_remote_attr - set DOS attributes of a remote file
- * @filename: path to the file name
- * @new_attr: attribute bit mask to use
- * @mode: one of ATTR_SET or ATTR_UNSET
- *
- * Update the file attributes with the one provided.
- */
-static int set_remote_attr(const char *filename, uint16 new_attr, int mode)
-{
-	extern struct cli_state *cli;
-	uint16 old_attr;
-	NTSTATUS status;
-
-	status = cli_getatr(cli, filename, &old_attr, NULL, NULL);
-	if (!NT_STATUS_IS_OK(status)) {
-		DBG(0, ("cli_getatr failed: %s\n", nt_errstr(status)));
-		return 1;
-	}
-
-	if (mode == ATTR_SET) {
-		new_attr |= old_attr;
-	} else {
-		new_attr = old_attr & ~new_attr;
-	}
-
-	status = cli_setatr(cli, filename, new_attr, 0);
-	if (!NT_STATUS_IS_OK(status)) {
-		DBG(1, ("cli_setatr failed: %s\n", nt_errstr(status)));
-		return 1;
-	}
-
-	return 0;
-}
-
 
 /**
  * make_remote_path - recursively make remote dirs
@@ -1932,12 +1808,6 @@ int cmd_tarmode(void)
 	return 1;
 }
 
-int cmd_setmode(void)
-{
-	NOT_IMPLEMENTED;
-	return 1;
-}
-
 int cmd_tar(void)
 {
 	NOT_IMPLEMENTED;
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index d5e0238..8811581 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -49,7 +49,33 @@ kerb_prompter(krb5_context ctx, void *data,
 	       krb5_prompt prompts[])
 {
 	if (num_prompts == 0) return 0;
+#if HAVE_KRB5_PROMPT_TYPE
 
+	/*
+	 * only heimdal has a prompt type and we need to deal with it here to
+	 * avoid loops.
+	 *
+	 * removing the prompter completely is not an option as at least these
+	 * versions would crash: heimdal-1.0.2 and heimdal-1.1. Later heimdal
+	 * version have looping detection and return with a proper error code.
+	 */
+
+	if ((num_prompts == 2) &&
+	    (prompts[0].type == KRB5_PROMPT_TYPE_NEW_PASSWORD) &&
+	    (prompts[1].type == KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN)) {
+		/*
+		 * We don't want to change passwords here. We're
+		 * called from heimal when the KDC returns
+		 * KRB5KDC_ERR_KEY_EXPIRED, but at this point we don't
+		 * have the chance to ask the user for a new
+		 * password. If we return 0 (i.e. success), we will be
+		 * spinning in the endless for-loop in
+		 * change_password() in
+		 * source4/heimdal/lib/krb5/init_creds_pw.c:526ff
+		 */
+		return KRB5KDC_ERR_KEY_EXPIRED;
+	}
+#endif /* HAVE_KRB5_PROMPT_TYPE */
 	memset(prompts[0].reply->data, '\0', prompts[0].reply->length);
 	if (prompts[0].reply->length > 0) {
 		if (data) {
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 70301de..6031b42 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -2004,6 +2004,13 @@ ADS_STATUS ads_get_service_principal_names(TALLOC_CTX *mem_ctx,
 				      res,
 				      "servicePrincipalName",
 				      num_spns);
+	if (*spn_array == NULL) {
+		DEBUG(1, ("Host account for %s does not have service principal "
+			  "names.\n",
+			  machine_name));
+		status = ADS_ERROR(LDAP_NO_SUCH_OBJECT);
+		goto done;
+	}
 
 done:
 	ads_msgfree(ads, res);
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 603a4d2..b823370 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -961,11 +961,11 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 
 	status = cli_dfs_get_referral(ctx, cli_ipc, dfs_path, &refs,
 				      &num_refs, &consumed);
-	if (!NT_STATUS_IS_OK(status) || !num_refs) {
+	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
 
-	if (!refs[0].dfspath) {
+	if (!num_refs || !refs[0].dfspath) {
 		return NT_STATUS_NOT_FOUND;
 	}
 
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index e79228f..108de87 100755


-- 
Samba Shared Repository



More information about the samba-cvs mailing list