]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
torture4: Simplification with generate_random_str_list_buf()
authorVolker Lendecke <vl@samba.org>
Sun, 29 Dec 2024 10:49:35 +0000 (11:49 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 23 Jan 2025 23:08:38 +0000 (23:08 +0000)
No NULL check required

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/torture/rpc/samba3rpc.c

index 84561de7b99f3e487bfebcadf51c7d32a46c2870..ac394199eab878ff6fcb741e019454fe80014030 100644 (file)
@@ -2094,7 +2094,7 @@ static bool torture_samba3_rpc_randomauth2(struct torture_context *torture)
        TALLOC_CTX *mem_ctx;
        struct dcerpc_pipe *net_pipe;
        struct dcerpc_binding_handle *net_handle;
-       char *wksname;
+       char wksname[15];
        bool result = false;
        NTSTATUS status;
        struct netr_ServerReqChallenge r;
@@ -2112,11 +2112,9 @@ static bool torture_samba3_rpc_randomauth2(struct torture_context *torture)
                return false;
        }
 
-       if (!(wksname = generate_random_str_list(
-                     mem_ctx, 14, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"))) {
-               torture_comment(torture, "generate_random_str_list failed\n");
-               goto done;
-       }
+       generate_random_str_list_buf(wksname,
+                                    sizeof(wksname),
+                                    "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
 
        if (!(torture_open_connection_share(
                      mem_ctx, &cli,