]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Strip trailing whitespaces in session_key.c
authorAndreas Schneider <asn@samba.org>
Thu, 17 Nov 2016 14:35:47 +0000 (15:35 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 2 Jan 2017 10:56:52 +0000 (11:56 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12433

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 80f7f568f8960c809756d5233c8f875db4ea07d6)

source4/torture/rpc/session_key.c

index 11f6a0b994915debffc3dd415285acc42b66048a..b460036f2b9869e75862736d83ee96930350dcad 100644 (file)
@@ -1,20 +1,20 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    test suite for lsa rpc operations
 
    Copyright (C) Andrew Tridgell 2003
    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2005
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -32,7 +32,7 @@ static void init_lsa_String(struct lsa_String *name, const char *s)
        name->string = s;
 }
 
-static bool test_CreateSecret_basic(struct dcerpc_pipe *p, 
+static bool test_CreateSecret_basic(struct dcerpc_pipe *p,
                                    struct torture_context *tctx,
                                    struct policy_handle *handle)
 {
@@ -56,66 +56,66 @@ static bool test_CreateSecret_basic(struct dcerpc_pipe *p,
        secname = talloc_asprintf(tctx, "torturesecret-%u", (unsigned int)random());
 
        torture_comment(tctx, "Testing CreateSecret of %s\n", secname);
-               
+
        init_lsa_String(&r.in.name, secname);
-       
+
        r.in.handle = handle;
        r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
        r.out.sec_handle = &sec_handle;
-       
+
        torture_assert_ntstatus_ok(tctx, dcerpc_lsa_CreateSecret_r(b, tctx, &r),
                "CreateSecret failed");
        torture_assert_ntstatus_ok(tctx, r.out.result, "CreateSecret failed");
-       
+
        status = dcerpc_fetch_session_key(p, &session_key);
        torture_assert_ntstatus_ok(tctx, status, "dcerpc_fetch_session_key failed");
-       
+
        enc_key = sess_encrypt_string(secret1, &session_key);
-       
+
        r3.in.sec_handle = &sec_handle;
        r3.in.new_val = &buf1;
        r3.in.old_val = NULL;
        r3.in.new_val->data = enc_key.data;
        r3.in.new_val->length = enc_key.length;
        r3.in.new_val->size = enc_key.length;
-       
+
        torture_comment(tctx, "Testing SetSecret\n");
-       
+
        torture_assert_ntstatus_ok(tctx, dcerpc_lsa_SetSecret_r(b, tctx, &r3),
                "SetSecret failed");
        torture_assert_ntstatus_ok(tctx, r3.out.result, "SetSecret failed");
-               
+
        r3.in.sec_handle = &sec_handle;
        r3.in.new_val = &buf1;
        r3.in.old_val = NULL;
        r3.in.new_val->data = enc_key.data;
        r3.in.new_val->length = enc_key.length;
        r3.in.new_val->size = enc_key.length;
-       
+
        /* break the encrypted data */
        enc_key.data[0]++;
-       
+
        torture_comment(tctx, "Testing SetSecret with broken key\n");
-       
+
        torture_assert_ntstatus_ok(tctx, dcerpc_lsa_SetSecret_r(b, tctx, &r3),
                "SetSecret failed");
        torture_assert_ntstatus_equal(tctx, r3.out.result, NT_STATUS_UNKNOWN_REVISION,
                "SetSecret should have failed UNKNOWN_REVISION");
-       
+
        data_blob_free(&enc_key);
-       
+
        ZERO_STRUCT(new_mtime);
        ZERO_STRUCT(old_mtime);
-       
+
        /* fetch the secret back again */
        r4.in.sec_handle = &sec_handle;
        r4.in.new_val = &bufp1;
        r4.in.new_mtime = &new_mtime;
        r4.in.old_val = NULL;
        r4.in.old_mtime = NULL;
-       
+
        bufp1.buf = NULL;
-       
+
        torture_comment(tctx, "Testing QuerySecret\n");
        torture_assert_ntstatus_ok(tctx, dcerpc_lsa_QuerySecret_r(b, tctx, &r4),
                "QuerySecret failed");
@@ -126,7 +126,7 @@ static bool test_CreateSecret_basic(struct dcerpc_pipe *p,
        blob1.length = r4.out.new_val->buf->size;
 
        secret2 = sess_decrypt_string(tctx, &blob1, &session_key);
-       
+
        torture_assert_str_equal(tctx, secret1, secret2, "Returned secret invalid");
 
        d.in.handle = &sec_handle;
@@ -149,7 +149,7 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
         struct dcerpc_pipe *p;
        struct policy_handle *handle;
        struct dcerpc_binding *binding;
-       const struct secret_settings *settings = 
+       const struct secret_settings *settings =
                (const struct secret_settings *)_data;
        NTSTATUS status;
        struct dcerpc_binding_handle *b;
@@ -158,7 +158,7 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
        lpcfg_set_cmdline(torture->lp_ctx, "ntlmssp_client:ntlm2", settings->ntlm2?"True":"False");
        lpcfg_set_cmdline(torture->lp_ctx, "ntlmssp_client:lm_key", settings->lm_key?"True":"False");
 
-       torture_assert_ntstatus_ok(torture, torture_rpc_binding(torture, &binding), 
+       torture_assert_ntstatus_ok(torture, torture_rpc_binding(torture, &binding),
                                   "Getting bindoptions");
 
        status = dcerpc_binding_set_flags(binding, settings->bindoptions, 0);
@@ -179,7 +179,7 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
        }
 
        torture_assert(torture, handle, "OpenPolicy2 failed.  This test cannot run against this server");
-       
+
        if (!test_CreateSecret_basic(p, torture, handle)) {
                talloc_free(p);
                return false;
@@ -190,7 +190,7 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
        return true;
 }
 
-static struct torture_tcase *add_test(struct torture_suite *suite, uint32_t bindoptions, 
+static struct torture_tcase *add_test(struct torture_suite *suite, uint32_t bindoptions,
                                     bool keyexchange, bool ntlm2, bool lm_key)
 {
        char *name = NULL;
@@ -203,7 +203,7 @@ static struct torture_tcase *add_test(struct torture_suite *suite, uint32_t bind
                name = talloc_strdup(suite, "bigendian");
        else if (bindoptions == DCERPC_SEAL)
                name = talloc_strdup(suite, "seal");
-       else if (bindoptions == 0) 
+       else if (bindoptions == 0)
                name = talloc_strdup(suite, "none");
        else
                name = talloc_strdup(suite, "unknown");
@@ -232,7 +232,7 @@ struct torture_suite *torture_rpc_lsa_secrets(TALLOC_CTX *mem_ctx)
        for (keyexchange = 0; keyexchange < ARRAY_SIZE(bool_vals); keyexchange++) {
                for (ntlm2 = 0; ntlm2 < ARRAY_SIZE(bool_vals); ntlm2++) {
                        for (lm_key = 0; lm_key < ARRAY_SIZE(bool_vals); lm_key++) {
-                               add_test(suite, DCERPC_PUSH_BIGENDIAN, bool_vals[keyexchange], bool_vals[ntlm2], 
+                               add_test(suite, DCERPC_PUSH_BIGENDIAN, bool_vals[keyexchange], bool_vals[ntlm2],
                                         bool_vals[lm_key]);
                                add_test(suite, DCERPC_SEAL, bool_vals[keyexchange], bool_vals[ntlm2], bool_vals[lm_key]);
                                add_test(suite, 0, bool_vals[keyexchange], bool_vals[ntlm2], bool_vals[lm_key]);