[SCM] Samba Shared Repository - branch v4-15-test updated
Jule Anger
janger at samba.org
Fri Feb 4 08:10:01 UTC 2022
The branch, v4-15-test has been updated
via bbb7aacf490 lib: libsmbclient: Ensure cli_rename() always sets cli->raw_status.
via 641271eaa07 s4: test: Add samba4.libsmbclient.rename test. Currently fails for SMB3.
via 9d00a59761b pam_winbind: add new pwd_change_prompt option (defaults to off).
from 9cd1099bbea VERSION: Bump version up to Samba 4.15.6...
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-test
- Log -----------------------------------------------------------------
commit bbb7aacf4909d6cffb08b461e094cb8641ff9d39
Author: Jeremy Allison <jra at samba.org>
Date: Wed Feb 2 10:52:09 2022 -0800
lib: libsmbclient: Ensure cli_rename() always sets cli->raw_status.
Identical change as used in cli_unlink(), cli_mkdir(), cli_rmdir()
cli_chkpath() to ensure SMB2 calls correctly set raw_status for
libsmbclient uses.
Remove knownfail.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14938
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Feb 2 21:50:31 UTC 2022 on sn-devel-184
(cherry picked from commit ca60f6350d566b7ecc822bcbb44fb65a1d150bbe)
Autobuild-User(v4-15-test): Jule Anger <janger at samba.org>
Autobuild-Date(v4-15-test): Fri Feb 4 08:09:02 UTC 2022 on sn-devel-184
commit 641271eaa076cfbebdc22e472e57a088ef88a298
Author: Jeremy Allison <jra at samba.org>
Date: Wed Feb 2 10:49:17 2022 -0800
s4: test: Add samba4.libsmbclient.rename test. Currently fails for SMB3.
Add knownfail.d/libsmbclient_rename
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14938
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 0ecc58858360bcc0181a02e52ada3e8327f97c5b)
commit 9d00a59761b6c209cb66dc79762a8e8f4fc979b5
Author: Günther Deschner <gd at samba.org>
Date: Wed Nov 17 09:56:09 2021 +0100
pam_winbind: add new pwd_change_prompt option (defaults to off).
This change disables the prompt for the change of an expired password by
default (using the PAM_RADIO_TYPE mechanism if present).
BUG: https://bugzilla.samba.org/show_bug.cgi?id=8691
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 20c85cc1da8d8c7f1932fbdd92128bb6dafad472)
-----------------------------------------------------------------------
Summary of changes:
docs-xml/manpages/pam_winbind.conf.5.xml | 7 ++
nsswitch/pam_winbind.c | 12 ++-
nsswitch/pam_winbind.h | 1 +
source3/libsmb/clifile.c | 1 +
source4/torture/libsmbclient/libsmbclient.c | 112 ++++++++++++++++++++++++++++
5 files changed, 131 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/docs-xml/manpages/pam_winbind.conf.5.xml b/docs-xml/manpages/pam_winbind.conf.5.xml
index 0bc288f91a1..bae9298fc32 100644
--- a/docs-xml/manpages/pam_winbind.conf.5.xml
+++ b/docs-xml/manpages/pam_winbind.conf.5.xml
@@ -194,6 +194,13 @@
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term>pwd_change_prompt = yes|no</term>
+ <listitem><para>
+ Generate prompt for changing an expired password. Defaults to "no".
+ </para></listitem>
+ </varlistentry>
+
</variablelist>
</para>
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 720a4b90d85..06098dd07d8 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -479,6 +479,10 @@ static int _pam_parse(const pam_handle_t *pamh,
ctrl |= WINBIND_MKHOMEDIR;
}
+ if (tiniparser_getboolean(d, "global:pwd_change_prompt", false)) {
+ ctrl |= WINBIND_PWD_CHANGE_PROMPT;
+ }
+
config_from_pam:
/* step through arguments */
for (i=argc,v=argv; i-- > 0; ++v) {
@@ -522,6 +526,8 @@ config_from_pam:
else if (!strncasecmp(*v, "warn_pwd_expire",
strlen("warn_pwd_expire")))
ctrl |= WINBIND_WARN_PWD_EXPIRE;
+ else if (!strcasecmp(*v, "pwd_change_prompt"))
+ ctrl |= WINBIND_PWD_CHANGE_PROMPT;
else if (type != PAM_WINBIND_CLEANUP) {
__pam_log(pamh, ctrl, LOG_ERR,
"pam_parse: unknown option: %s", *v);
@@ -976,7 +982,8 @@ static bool _pam_send_password_expiry_message(struct pwb_context *ctx,
* successfully sent the warning message.
* Give the user a chance to change pwd.
*/
- if (ret == PAM_SUCCESS) {
+ if (ret == PAM_SUCCESS &&
+ (ctx->ctrl & WINBIND_PWD_CHANGE_PROMPT)) {
if (change_pwd) {
retval = _pam_winbind_change_pwd(ctx);
if (retval) {
@@ -1006,7 +1013,8 @@ static bool _pam_send_password_expiry_message(struct pwb_context *ctx,
* successfully sent the warning message.
* Give the user a chance to change pwd.
*/
- if (ret == PAM_SUCCESS) {
+ if (ret == PAM_SUCCESS &&
+ (ctx->ctrl & WINBIND_PWD_CHANGE_PROMPT)) {
if (change_pwd) {
retval = _pam_winbind_change_pwd(ctx);
if (retval) {
diff --git a/nsswitch/pam_winbind.h b/nsswitch/pam_winbind.h
index c6786d65a4d..2f4a25729bd 100644
--- a/nsswitch/pam_winbind.h
+++ b/nsswitch/pam_winbind.h
@@ -157,6 +157,7 @@ do { \
#define WINBIND_WARN_PWD_EXPIRE 0x00002000
#define WINBIND_MKHOMEDIR 0x00004000
#define WINBIND_TRY_AUTHTOK_ARG 0x00008000
+#define WINBIND_PWD_CHANGE_PROMPT 0x00010000
#if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
#define _(string) dgettext(MODULE_NAME, string)
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index c619b009ec4..1028514da08 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -1489,6 +1489,7 @@ NTSTATUS cli_rename(struct cli_state *cli,
}
status = cli_rename_recv(req);
+ cli->raw_status = status; /* cli_smb2_rename_recv doesn't set this */
fail:
TALLOC_FREE(frame);
diff --git a/source4/torture/libsmbclient/libsmbclient.c b/source4/torture/libsmbclient/libsmbclient.c
index fd770e5002f..b04dbde04ac 100644
--- a/source4/torture/libsmbclient/libsmbclient.c
+++ b/source4/torture/libsmbclient/libsmbclient.c
@@ -1303,6 +1303,115 @@ out:
return ok;
}
+static bool torture_libsmbclient_rename(struct torture_context *tctx)
+{
+ SMBCCTX *ctx = NULL;
+ int fhandle = -1;
+ bool success = false;
+ const char *filename_src = NULL;
+ const char *filename_dst = NULL;
+ int ret;
+ const char *smburl = torture_setting_string(tctx, "smburl", NULL);
+
+ if (smburl == NULL) {
+ torture_fail(tctx,
+ "option --option=torture:smburl="
+ "smb://user:password@server/share missing\n");
+ }
+
+ torture_assert_goto(tctx,
+ torture_libsmbclient_init_context(tctx, &ctx),
+ success,
+ done,
+ "");
+
+ smbc_set_context(ctx);
+
+ filename_src = talloc_asprintf(tctx,
+ "%s/src",
+ smburl);
+ if (filename_src == NULL) {
+ torture_fail_goto(tctx, done, "talloc fail\n");
+ }
+
+ filename_dst = talloc_asprintf(tctx,
+ "%s/dst",
+ smburl);
+ if (filename_dst == NULL) {
+ torture_fail_goto(tctx, done, "talloc fail\n");
+ }
+
+ /* Ensure the files don't exist. */
+ smbc_unlink(filename_src);
+ smbc_unlink(filename_dst);
+
+ /* Create them. */
+ fhandle = smbc_creat(filename_src, 0666);
+ if (fhandle < 0) {
+ torture_fail_goto(tctx,
+ done,
+ talloc_asprintf(tctx,
+ "failed to create file '%s': %s",
+ filename_src,
+ strerror(errno)));
+ }
+ ret = smbc_close(fhandle);
+ torture_assert_int_equal_goto(tctx,
+ ret,
+ 0,
+ success,
+ done,
+ talloc_asprintf(tctx,
+ "failed to close handle for '%s'",
+ filename_src));
+
+ fhandle = smbc_creat(filename_dst, 0666);
+ if (fhandle < 0) {
+ torture_fail_goto(tctx,
+ done,
+ talloc_asprintf(tctx,
+ "failed to create file '%s': %s",
+ filename_dst,
+ strerror(errno)));
+ }
+ ret = smbc_close(fhandle);
+ torture_assert_int_equal_goto(tctx,
+ ret,
+ 0,
+ success,
+ done,
+ talloc_asprintf(tctx,
+ "failed to close handle for '%s'",
+ filename_dst));
+
+ ret = smbc_rename(filename_src, filename_dst);
+
+ /*
+ * BUG: https://bugzilla.samba.org/show_bug.cgi?id=14938
+ * gives ret == -1, but errno = 0 for overwrite renames
+ * over SMB2.
+ */
+ torture_assert_int_equal_goto(tctx,
+ ret,
+ 0,
+ success,
+ done,
+ talloc_asprintf(tctx,
+ "smbc_rename '%s' -> '%s' failed with %s\n",
+ filename_src,
+ filename_dst,
+ strerror(errno)));
+
+ /* Remove them again. */
+ smbc_unlink(filename_src);
+ smbc_unlink(filename_dst);
+ success = true;
+
+ done:
+ smbc_free_context(ctx, 1);
+ return success;
+}
+
NTSTATUS torture_libsmbclient_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite;
@@ -1326,6 +1435,9 @@ NTSTATUS torture_libsmbclient_init(TALLOC_CTX *ctx)
suite, "utimes", torture_libsmbclient_utimes);
torture_suite_add_simple_test(
suite, "noanon_list", torture_libsmbclient_noanon_list);
+ torture_suite_add_simple_test(suite,
+ "rename",
+ torture_libsmbclient_rename);
suite->description = talloc_strdup(suite, "libsmbclient interface tests");
--
Samba Shared Repository
More information about the samba-cvs
mailing list