The branch, v4-19-test has been updated
       via  1b6096a1dff s3:utils: Fix auth callback with smburl
       via  37e24c60d82 s3:tests: Add interactive smbget test for password entry
       via  88c297575b6 auth:creds: Add 
cli_credentials_get_domain_and_obtained()
       via  ec913897169 auth:creds: Fix 
cli_credentials_get_password_and_obtained() with callback
       via  259cc2b51d5 auth:creds:tests: Add test for password callback
       via  8dc5d522774 s3:tests: Fix smbget test
       via  b2e427b48c4 s3:tests: Remove the non-working 
test_kerberos_upn_denied of smbget
       via  9fe9f02cb3b s3:tests: Fix the test_kerberos_trust in smbget 
testsuite
       via  fd20e3223df s3:tests: Fix test_kerberos in smbget tests
       via  e6d14a8560a s3:tests: Pass down a normal domain user for 
test_smbget.sh
       via  4fca26641b1 selftest: Add DOMAIN_ADMIN and DOMAIN_USER variables
       via  3738e0a904a selftest: Remove trailing tabs/white spaces in Samba4.pm
       via  7998197398a s3:tests: Fix authentication with smbget_user in smbget 
tests
       via  63969fe9ade s3:utils: Fix setting the debug level
       via  402042b5483 s3:tests: Add smbget test for 
smb://DOAMIN;user%password@server/share/file
      from  b2d450cc697 smbd: Fix read_symlink_reparse()

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


- Log -----------------------------------------------------------------
commit 1b6096a1dff7e9ba67fa0e5a0932959f0f3ae0b6
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Dec 6 13:16:53 2023 +0100

    s3:utils: Fix auth callback with smburl
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit f2f7ed419e03e5ae8cc85f42af5b2bcf91abefe2)
    
    Autobuild-User(v4-19-test): Jule Anger <jan...@samba.org>
    Autobuild-Date(v4-19-test): Tue Dec 12 10:01:36 UTC 2023 on atb-devel-224

commit 37e24c60d82a5e20faf919a504b9cf9cd54764bc
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Dec 6 15:58:08 2023 +0100

    s3:tests: Add interactive smbget test for password entry
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 5b38f3be8cb986aa2db3aab5c3c3d2e8739893ce)

commit 88c297575b6a4307d1f825fe2628c653411ebbb6
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Dec 6 13:26:43 2023 +0100

    auth:creds: Add cli_credentials_get_domain_and_obtained()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit a7622bc7db093558c6f6e3da4d2a899a764dec09)

commit ec913897169c168097af7b7d840e3f013498cdb9
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Dec 6 13:06:42 2023 +0100

    auth:creds: Fix cli_credentials_get_password_and_obtained() with callback
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 1041dae03f0f7e9e2b6b4a649eb1d298a34ce699)

commit 259cc2b51d51351e1d6b1116cbd91999577c7b5c
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Dec 6 13:16:26 2023 +0100

    auth:creds:tests: Add test for password callback
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit ab4b25964a43a1ef550f10580ad395e178fe647e)

commit 8dc5d52277497e5582136c267b3fde850c9bb8e7
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 7 09:47:14 2023 +0100

    s3:tests: Fix smbget test
    
    Time to fix the smget share to not have `guest ok = yes` set. A new
    [smbget_guest] will be used for guest only tests. This way we can
    correctly test different authentication mechanisms.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit c46769f3f10d21ed802e17aa79ae17e345168e63)

commit b2e427b48c46e589b2f14da3bb0fc8032d482858
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 7 13:11:46 2023 +0100

    s3:tests: Remove the non-working test_kerberos_upn_denied of smbget
    
    See TODO code comment for details.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 1a04fd255c2c94e01bda9840bfd6b372007bb3c7)

commit 9fe9f02cb3bc7d6215d66fcb1800d6b904f41d4a
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 7 11:43:33 2023 +0100

    s3:tests: Fix the test_kerberos_trust in smbget testsuite
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 468fb05d6357779228e411076e286abcdb70cf96)

commit fd20e3223dfade64125b59da0c0613c0f58335ce
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 7 10:51:32 2023 +0100

    s3:tests: Fix test_kerberos in smbget tests
    
    We switched to a temporary directory, so $PREFIX doesn't exist.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 62b0b79ce065246417996dec61afa6a10f6ab99b)

commit e6d14a8560a9d94fa4bf958d079261e332a964a9
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 7 09:45:54 2023 +0100

    s3:tests: Pass down a normal domain user for test_smbget.sh
    
    It is better to test with a normal user than administrator.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 337034e675aaeb366d360a791ec0d003426230af)

commit 4fca26641b1165c10f34effe35fafb3f3b2b7539
Author: Andreas Schneider <a...@samba.org>
Date:   Fri Dec 8 13:07:19 2023 +0100

    selftest: Add DOMAIN_ADMIN and DOMAIN_USER variables
    
    We should start using those in future. So we can distinguish which
    privileges we want. Currently DC_USERNAME is the Administrator. Whatever
    possible should use DOMIAN_USER instead.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 56d0c3a0263ed166452c129219e7a391ba4d014c)

commit 3738e0a904ad165c4962b9b180b51a886acdedc6
Author: Andreas Schneider <a...@samba.org>
Date:   Fri Dec 8 13:06:27 2023 +0100

    selftest: Remove trailing tabs/white spaces in Samba4.pm
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit a2af6946f5e53b7d954aa54d3d115dbe4975b1c4)

commit 7998197398ab7e07485217a9e3895f6da4262c01
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 7 09:18:26 2023 +0100

    s3:tests: Fix authentication with smbget_user in smbget tests
    
    Currently the smget share is broken. We set `guest ok = yes` so if you
    specify invalid names, the authentication will still succeed as we
    are mapped to guest.
    
    The smbget_user is a local ad_member user. We need to set the
    workstation as the "domain" for the user.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit c14c5dec09fe1c86b29b3091ad521e73a2e1c3e9)

commit 63969fe9ade06d0cd878a6e01fc1a41d0c88f988
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Dec 6 08:48:34 2023 +0100

    s3:utils: Fix setting the debug level
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15525
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit 763b2efe69dc74e1c0cd954607031012f832486d)

commit 402042b54838b7abdbb45cef3b52191206f20f55
Author: Andreas Schneider <a...@samba.org>
Date:   Tue Dec 5 15:46:48 2023 +0100

    s3:tests: Add smbget test for smb://DOAMIN;user%password@server/share/file
    
    This is supported according to the smbget manpage!
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15525
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    (cherry picked from commit e5fe856e76eba26e3b85a391bcea02dfe045c26e)

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

Summary of changes:
 auth/credentials/credentials.c      |  26 +++++-
 auth/credentials/credentials.h      |   3 +
 auth/credentials/tests/test_creds.c |  38 +++++++++
 selftest/target/Samba.pm            |   4 +
 selftest/target/Samba3.pm           |  28 ++++++
 selftest/target/Samba4.pm           |  16 +++-
 source3/script/tests/test_smbget.sh | 164 +++++++++++++++++++++++++-----------
 source3/selftest/tests.py           |   2 +
 source3/utils/smbget.c              |  46 ++++++++--
 9 files changed, 266 insertions(+), 61 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
index 0485cc4e64e..7a00279b8b4 100644
--- a/auth/credentials/credentials.c
+++ b/auth/credentials/credentials.c
@@ -465,11 +465,13 @@ _PUBLIC_ const char *
 cli_credentials_get_password_and_obtained(struct cli_credentials *cred,
                                          enum credentials_obtained *obtained)
 {
+       const char *password = cli_credentials_get_password(cred);
+
        if (obtained != NULL) {
                *obtained = cred->password_obtained;
        }
 
-       return cli_credentials_get_password(cred);
+       return password;
 }
 
 /* Set a password on the credentials context, including an indication
@@ -736,6 +738,28 @@ _PUBLIC_ const char *cli_credentials_get_domain(struct 
cli_credentials *cred)
        return cred->domain;
 }
 
+/**
+ * @brief Obtain the domain for this credential context.
+ *
+ * @param[in] cred  The credential context.
+ *
+ * @param[out] obtained A pointer to store the obtained information.
+ *
+ * @return The domain name or NULL if an error occurred.
+ */
+_PUBLIC_ const char *cli_credentials_get_domain_and_obtained(
+       struct cli_credentials *cred,
+       enum credentials_obtained *obtained)
+{
+       const char *domain = cli_credentials_get_domain(cred);
+
+       if (obtained != NULL) {
+               *obtained = cred->domain_obtained;
+       }
+
+       return domain;
+}
+
 
 _PUBLIC_ bool cli_credentials_set_domain(struct cli_credentials *cred,
                                const char *val,
diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h
index c3a048ecc8d..c5ffe536e07 100644
--- a/auth/credentials/credentials.h
+++ b/auth/credentials/credentials.h
@@ -127,6 +127,9 @@ int cli_credentials_get_keytab(struct cli_credentials *cred,
                               struct loadparm_context *lp_ctx,
                               struct keytab_container **_ktc);
 const char *cli_credentials_get_domain(struct cli_credentials *cred);
+const char *cli_credentials_get_domain_and_obtained(
+       struct cli_credentials *cred,
+       enum credentials_obtained *obtained);
 struct netlogon_creds_CredentialState 
*cli_credentials_get_netlogon_creds(struct cli_credentials *cred);
 void cli_credentials_set_machine_account_pending(struct cli_credentials *cred,
                                                 struct loadparm_context 
*lp_ctx);
diff --git a/auth/credentials/tests/test_creds.c 
b/auth/credentials/tests/test_creds.c
index a2f9642bfe0..2cb2e6d0e34 100644
--- a/auth/credentials/tests/test_creds.c
+++ b/auth/credentials/tests/test_creds.c
@@ -48,6 +48,7 @@ static void torture_creds_init(void **state)
        const char *username = NULL;
        const char *domain = NULL;
        const char *password = NULL;
+       enum credentials_obtained dom_obtained = CRED_UNINITIALISED;
        enum credentials_obtained usr_obtained = CRED_UNINITIALISED;
        enum credentials_obtained pwd_obtained = CRED_UNINITIALISED;
        bool ok;
@@ -65,6 +66,11 @@ static void torture_creds_init(void **state)
        domain = cli_credentials_get_domain(creds);
        assert_string_equal(domain, "WURST");
 
+       domain = cli_credentials_get_domain_and_obtained(creds,
+                                                        &dom_obtained);
+       assert_int_equal(dom_obtained, CRED_SPECIFIED);
+       assert_string_equal(domain, "WURST");
+
        username = cli_credentials_get_username(creds);
        assert_null(username);
        ok = cli_credentials_set_username(creds, "brot", CRED_SPECIFIED);
@@ -285,6 +291,37 @@ static void torture_creds_gensec_feature(void **state)
        assert_int_equal(creds->gensec_features, GENSEC_FEATURE_SIGN);
 }
 
+static const char *torture_get_password(struct cli_credentials *creds)
+{
+       return talloc_strdup(creds, "SECRET");
+}
+
+static void torture_creds_password_callback(void **state)
+{
+       TALLOC_CTX *mem_ctx = *state;
+       struct cli_credentials *creds = NULL;
+       const char *password = NULL;
+       enum credentials_obtained pwd_obtained = CRED_UNINITIALISED;
+       bool ok;
+
+       creds = cli_credentials_init(mem_ctx);
+       assert_non_null(creds);
+
+       ok = cli_credentials_set_domain(creds, "WURST", CRED_SPECIFIED);
+       assert_true(ok);
+       ok = cli_credentials_set_username(creds, "brot", CRED_SPECIFIED);
+       assert_true(ok);
+
+       ok = cli_credentials_set_password_callback(creds, torture_get_password);
+       assert_true(ok);
+       assert_int_equal(creds->password_obtained, CRED_CALLBACK);
+
+       password = cli_credentials_get_password_and_obtained(creds,
+                                                            &pwd_obtained);
+       assert_int_equal(pwd_obtained, CRED_CALLBACK_RESULT);
+       assert_string_equal(password, "SECRET");
+}
+
 int main(int argc, char *argv[])
 {
        int rc;
@@ -296,6 +333,7 @@ int main(int argc, char *argv[])
                cmocka_unit_test(torture_creds_parse_string),
                cmocka_unit_test(torture_creds_krb5_state),
                cmocka_unit_test(torture_creds_gensec_feature),
+               cmocka_unit_test(torture_creds_password_callback)
        };
 
        if (argc == 2) {
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm
index b959db493ca..e4bd6a0d5d2 100644
--- a/selftest/target/Samba.pm
+++ b/selftest/target/Samba.pm
@@ -947,6 +947,10 @@ my @exported_envvars = (
        "PASSWORD",
        "DC_USERNAME",
        "DC_PASSWORD",
+       "DOMAIN_ADMIN",
+       "DOMAIN_ADMIN_PASSWORD",
+       "DOMAIN_USER",
+       "DOMAIN_USER_PASSWORD",
 
        # UID/GID for rfc2307 mapping tests
        "UID_RFC2307TEST",
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 85e69e4b72d..2c69993c56a 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1006,6 +1006,10 @@ sub provision_ad_member
        $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
+       $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
+       $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
+       $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
+       $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
 
        # forest trust
        $ret->{TRUST_F_BOTH_SERVER} = $trustvars_f->{SERVER};
@@ -1171,6 +1175,10 @@ sub setup_ad_member_rfc2307
        $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
+       $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
+       $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
+       $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
+       $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
 
        return $ret;
 }
@@ -1267,6 +1275,10 @@ sub setup_admem_idmap_autorid
        $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
+       $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
+       $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
+       $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
+       $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
 
        return $ret;
 }
@@ -1366,6 +1378,10 @@ sub setup_ad_member_idmap_rid
        $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
+       $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
+       $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
+       $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
+       $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
 
        return $ret;
 }
@@ -1466,6 +1482,10 @@ sub setup_ad_member_idmap_ad
        $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
+       $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
+       $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
+       $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
+       $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
 
        $ret->{TRUST_SERVER} = $dcvars->{TRUST_SERVER};
        $ret->{TRUST_USERNAME} = $dcvars->{TRUST_USERNAME};
@@ -1558,6 +1578,10 @@ sub setup_ad_member_oneway
        $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{PASSWORD};
+       $ret->{DOMAIN_ADMIN} = $dcvars->{DOMAIN_ADMIN};
+       $ret->{DOMAIN_ADMIN_PASSWORD} = $dcvars->{DOMAIN_ADMIN_PASSWORD};
+       $ret->{DOMAIN_USER} = $dcvars->{DOMAIN_USER};
+       $ret->{DOMAIN_USER_PASSWORD} = $dcvars->{DOMAIN_USER_PASSWORD};
 
        $ret->{TRUST_SERVER} = $dcvars->{TRUST_SERVER};
        $ret->{TRUST_USERNAME} = $dcvars->{TRUST_USERNAME};
@@ -3563,6 +3587,10 @@ sub provision($$)
 [smbget]
        path = $smbget_sharedir
        comment = smb username is [%U]
+
+[smbget_guest]
+       path = $smbget_sharedir
+       comment = smb username is [%U]
        guest ok = yes
 
 include = $aliceconfdir/%U.conf
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index a10c1313322..cbaacce48da 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -559,7 +559,7 @@ sub provision_raw_prepare($$$$$$$$$$$$$$)
                warn("Unable to clean up");
        }
 
-       
+
        my $swiface = Samba::get_interface($hostname);
 
        $ctx->{prefix} = $prefix;
@@ -587,6 +587,10 @@ sub provision_raw_prepare($$$$$$$$$$$$$$)
        $ctx->{realm} = uc($realm);
        $ctx->{dnsname} = lc($realm);
        $ctx->{samsid} = $samsid;
+       $ctx->{domain_admin} = "Administrator";
+       $ctx->{domain_admin_password} = $password;
+       $ctx->{domain_user} = "alice";
+       $ctx->{domain_user_password} = "Secret007";
 
        $ctx->{functional_level} = $functional_level;
 
@@ -906,6 +910,10 @@ nogroup:x:65534:nobody
                DOMAIN => $ctx->{domain},
                USERNAME => $ctx->{username},
                DC_USERNAME => $ctx->{username},
+               DOMAIN_ADMIN => $ctx->{domain_admin},
+               DOMAIN_ADMIN_PASSWORD => $ctx->{domain_admin_password},
+               DOMAIN_USER => $ctx->{domain_user},
+               DOMAIN_USER_PASSWORD => $ctx->{domain_user_password},
                REALM => $ctx->{realm},
                DNSNAME => $ctx->{dnsname},
                SAMSID => $ctx->{samsid},
@@ -1034,7 +1042,7 @@ replace: userPrincipalName
 userPrincipalName: testallowed upn\@$ctx->{realm}
 replace: servicePrincipalName
 servicePrincipalName: host/testallowed
--          
+-
 ";
        close($ldif);
        unless ($? == 0) {
@@ -1057,7 +1065,7 @@ servicePrincipalName: host/testallowed
 changetype: modify
 replace: userPrincipalName
 userPrincipalName: testdenied_upn\@$ctx->{realm}.upn
--          
+-
 ";
        close($ldif);
        unless ($? == 0) {
@@ -2225,7 +2233,7 @@ sub provision_chgdcpass($$)
                warn("Unable to add wins configuration");
                return undef;
        }
-       
+
        # Remove secrets.tdb from this environment to test that we
        # still start up on systems without the new matching
        # secrets.tdb records.
diff --git a/source3/script/tests/test_smbget.sh 
b/source3/script/tests/test_smbget.sh
index 46c1f4a68a5..74050f6951a 100755
--- a/source3/script/tests/test_smbget.sh
+++ b/source3/script/tests/test_smbget.sh
@@ -16,9 +16,11 @@ DOMAIN=${3}
 REALM=${4}
 USERNAME=${5}
 PASSWORD=${6}
-WORKDIR=${7}
-SMBGET="$VALGRIND ${8}"
-shift 8
+DOMAIN_USER=${7}
+DOMAIN_USER_PASSWORD=${8}
+WORKDIR=${9}
+SMBGET="$VALGRIND ${10}"
+shift 10
 
 TMPDIR="$SELFTEST_TMPDIR"
 
@@ -27,6 +29,7 @@ incdir=$(dirname $0)/../../../testprogs/blackbox
 . "${incdir}/common_test_fns.inc"
 
 samba_kinit=$(system_or_builddir_binary kinit "${BINDIR}" samba4kinit)
+samba_texpect="${BINDIR}/texpect"
 
 create_test_data()
 {
@@ -55,8 +58,8 @@ clear_download_area()
 test_singlefile_guest()
 {
        clear_download_area
-       echo "$SMBGET --verbose --guest smb://$SERVER_IP/smbget/testfile"
-       $SMBGET --verbose --guest smb://$SERVER_IP/smbget/testfile
+       echo "$SMBGET --verbose --guest smb://$SERVER_IP/smbget_guest/testfile"
+       $SMBGET --verbose --guest smb://$SERVER_IP/smbget_guest/testfile
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
@@ -72,7 +75,7 @@ test_singlefile_guest()
 test_singlefile_U()
 {
        clear_download_area
-       $SMBGET --verbose -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile
+       $SMBGET --verbose -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
@@ -89,7 +92,7 @@ test_singlefile_U_UPN()
 {
        clear_download_area
 
-       ${SMBGET} --verbose -U"${DC_USERNAME}@${REALM}%${DC_PASSWORD}" \
+       ${SMBGET} --verbose -U"${DOMAIN_USER}@${REALM}%${DOMAIN_USER_PASSWORD}" 
\
                "smb://${SERVER_IP}/smbget/testfile"
        ret=${?}
        if [ ${ret} -ne 0 ]; then
@@ -111,7 +114,7 @@ test_singlefile_U_domain()
 {
        clear_download_area
 
-       ${SMBGET} --verbose -U"${DOMAIN}/${DC_USERNAME}%${DC_PASSWORD}" \
+       ${SMBGET} --verbose 
-U"${DOMAIN}/${DOMAIN_USER}%${DOMAIN_USER_PASSWORD}" \
                "smb://${SERVER_IP}/smbget/testfile"
        ret=${?}
        if [ ${ret} -ne 0 ]; then
@@ -132,7 +135,7 @@ test_singlefile_U_domain()
 test_singlefile_smburl()
 {
        clear_download_area
-       $SMBGET --workgroup $DOMAIN 
smb://$USERNAME:$PASSWORD@$SERVER_IP/smbget/testfile
+       $SMBGET --workgroup $DOMAIN 
smb://${DOMAIN_USER}:$DOMAIN_USER_PASSWORD@$SERVER_IP/smbget/testfile
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
@@ -145,11 +148,54 @@ test_singlefile_smburl()
        return 0
 }
 
+test_singlefile_smburl2()
+{
+       clear_download_area
+       $SMBGET 
"smb://$DOMAIN;${DOMAIN_USER}:$DOMAIN_USER_PASSWORD@$SERVER_IP/smbget/testfile"
+       if [ $? -ne 0 ]; then
+               echo 'ERROR: RC does not match, expected: 0'
+               return 1
+       fi
+       cmp --silent $WORKDIR/testfile ./testfile
+       if [ $? -ne 0 ]; then
+               echo 'ERROR: file content does not match'
+               return 1
+       fi
+       return 0
+}
+
+test_singlefile_smburl_interactive()
+{
+       clear_download_area
+
+       tmpfile="$(mktemp --tmpdir="${TMPDIR}" expect_XXXXXXXXXX)"
+
+       cat >"${tmpfile}" <<EOF
+expect Password for
+send ${DOMAIN_USER_PASSWORD}\n
+EOF
+
+       USER="hanswurst" ${samba_texpect} "${tmpfile}" ${SMBGET} 
"smb://${DOMAIN};${DOMAIN_USER}@${SERVER_IP}/smbget/testfile"
+       ret=$?
+       rm -f "${tmpfile}"
+       if [ ${ret} -ne 0 ]; then
+               echo 'ERROR: RC does not match, expected: 0'
+               return 1
+       fi
+       cmp --silent $WORKDIR/testfile ./testfile
+       ret=$?
+       if [ ${ret} -ne 0 ]; then
+               echo 'ERROR: file content does not match'
+               return 1
+       fi
+       return 0
+}
+
 test_singlefile_authfile()
 {
        clear_download_area
        cat >"${TMPDIR}/authfile" << EOF
-username = $USERNAME
+username = ${SERVER}/${USERNAME}
 password = $PASSWORD
 EOF
        $SMBGET --verbose --authentication-file="${TMPDIR}/authfile" 
smb://$SERVER_IP/smbget/testfile
@@ -170,7 +216,7 @@ EOF
 test_recursive_U()
 {
        clear_download_area
-       $SMBGET --verbose --recursive -U$USERNAME%$PASSWORD 
smb://$SERVER_IP/smbget/
+       $SMBGET --verbose --recursive -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
@@ -191,7 +237,7 @@ test_recursive_existing_dir()
 {
        clear_download_area
        mkdir dir1
-       $SMBGET --verbose --recursive -U$USERNAME%$PASSWORD 
smb://$SERVER_IP/smbget/
+       $SMBGET --verbose --recursive -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
@@ -214,7 +260,7 @@ test_recursive_with_empty()
        # create some additional empty directories
        mkdir -p $WORKDIR/dir001/dir002/dir003
        mkdir -p $WORKDIR/dir004/dir005/dir006
-       $SMBGET --verbose --recursive -U$USERNAME%$PASSWORD 
smb://$SERVER_IP/smbget/
+       $SMBGET --verbose --recursive -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/
        rc=$?
        rm -rf $WORKDIR/dir001
        rm -rf $WORKDIR/dir004
@@ -244,7 +290,7 @@ test_resume()
        clear_download_area
        cp $WORKDIR/testfile .
        truncate -s 1024 testfile
-       $SMBGET --verbose --resume -U$USERNAME%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
+       $SMBGET --verbose --resume -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
@@ -263,7 +309,7 @@ test_resume_modified()
 {
        clear_download_area
        dd if=/dev/urandom bs=1024 count=2 of=testfile
-       $SMBGET --verbose --resume -U$USERNAME%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
+       $SMBGET --verbose --resume -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
        if [ $? -ne 1 ]; then
                echo 'ERROR: RC does not match, expected: 1'
                return 1
@@ -275,14 +321,14 @@ test_resume_modified()
 test_update()
 {
        clear_download_area
-       $SMBGET --verbose -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile
+       $SMBGET --verbose -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
        fi
 
        # secondary download should pass
-       $SMBGET --verbose --update -U$USERNAME%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
+       $SMBGET --verbose --update -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
@@ -292,7 +338,7 @@ test_update()
        # touch source to trigger new download
        sleep 2
        touch -m $WORKDIR/testfile
-       $SMBGET --verbose --update -U$USERNAME%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
+       $SMBGET --verbose --update -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
        if [ $? -ne 0 ]; then
                echo 'ERROR: RC does not match, expected: 0'
                return 1
@@ -327,7 +373,7 @@ test_msdfs_link_domain()
 {
        clear_download_area
 
-       ${SMBGET} --verbose "-U${DOMAIN}/${DC_USERNAME}%${DC_PASSWORD}" \
+       ${SMBGET} --verbose 
"-U${DOMAIN}/${DOMAIN_USER}%${DOMAIN_USER_PASSWORD}" \
                "smb://${SERVER}/msdfs-share/deeppath/msdfs-src2/readable_file"
        ret=$?
        if [ ${ret} -ne 0 ]; then


-- 
Samba Shared Repository

Reply via email to