The branch, master has been updated
       via  c94f994dda494f78f0ffb018632abf75d99b45d6 (commit)
       via  12ad92165eba14a593e0d152fbeda1e8f7d90ef8 (commit)
       via  02fac426901ca0ac95d63c374f8480825f5cf6bc (commit)
      from  b8b0274e0351709266dc727d6ee4f857441e5d9e (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c94f994dda494f78f0ffb018632abf75d99b45d6
Merge: 12ad92165eba14a593e0d152fbeda1e8f7d90ef8 
b8b0274e0351709266dc727d6ee4f857441e5d9e
Author: Jelmer Vernooij <[EMAIL PROTECTED]>
Date:   Wed Oct 22 16:57:46 2008 +0200

    Merge branch 'master' of ssh://git.samba.org/data/git/samba

commit 12ad92165eba14a593e0d152fbeda1e8f7d90ef8
Author: Jelmer Vernooij <[EMAIL PROTECTED]>
Date:   Wed Oct 22 16:56:06 2008 +0200

    masktest: Avoid creating new memory context, use dynamic allocation.

commit 02fac426901ca0ac95d63c374f8480825f5cf6bc
Author: Jelmer Vernooij <[EMAIL PROTECTED]>
Date:   Wed Oct 22 16:49:56 2008 +0200

    Change some dynamic allocations back to static buffers to fix build.

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

Summary of changes:
 source4/torture/masktest.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 5eccf86..6e9ae89 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -74,6 +74,7 @@ return a connection to a server
 *******************************************************/
 static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, 
                                        struct event_context *ev,
+                                       TALLOC_CTX *mem_ctx,
                                        char *share, const char **ports,
                                        struct smbcli_options *options,
                                        struct smbcli_session_options 
*session_options)
@@ -82,12 +83,9 @@ static struct smbcli_state *connect_one(struct 
resolve_context *resolve_ctx,
        char *server;
        NTSTATUS status;
 
-       server = smb_xstrdup(share+2);
+       server = talloc_strdup(mem_ctx, share+2);
        share = strchr_m(server,'\\');
-       if (!share) {
-               SAFE_FREE(server);
-               return NULL;
-       }
+       if (!share) return NULL;
        *share = 0;
        share++;
 
@@ -100,8 +98,6 @@ static struct smbcli_state *connect_one(struct 
resolve_context *resolve_ctx,
                                        cmdline_credentials, resolve_ctx, ev,
                                        options, session_options);
 
-       SAFE_FREE(server);
-
        if (!NT_STATUS_IS_OK(status)) {
                return NULL;
        }
@@ -170,7 +166,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct 
smbcli_state *cli, char *mask,
                char *file)
 {
        int fnum;
-       char *res1;
+       char res1[256];
        char *res2;
        static int count;
        char *short_name = NULL;
@@ -179,7 +175,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct 
smbcli_state *cli, char *mask,
 
        count++;
 
-       res1 = talloc_strdup(mem_ctx, "---");
+       safe_strcpy(res1, "---", sizeof(res1));
 
        state.mem_ctx = mem_ctx;
 
@@ -191,8 +187,9 @@ static void testpair(TALLOC_CTX *mem_ctx, struct 
smbcli_state *cli, char *mask,
        smbcli_close(cli->tree, fnum);
 
        resultp = res1;
+       short_name = talloc_strdup(mem_ctx, "");
        get_real_name(mem_ctx, cli, &long_name, &short_name);
-       res1 = talloc_strdup(mem_ctx, "---");
+       safe_strcpy(res1, "---", sizeof(res1));
        smbcli_list_new(cli->tree, mask,
                        FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
                        RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO,
@@ -214,16 +211,14 @@ static void testpair(TALLOC_CTX *mem_ctx, struct 
smbcli_state *cli, char *mask,
 }
 
 static void test_mask(int argc, char *argv[],
+                                         TALLOC_CTX *mem_ctx,
                      struct smbcli_state *cli)
 {
-       TALLOC_CTX *mem_ctx;
        char *mask, *file;
        int l1, l2, i, l;
        int mc_len = strlen(maskchars);
        int fc_len = strlen(filechars);
 
-       mem_ctx = talloc_init("test_mask");
-
        smbcli_mkdir(cli->tree, "\\masktest");
 
        smbcli_unlink(cli->tree, "\\masktest\\*");
@@ -304,6 +299,7 @@ static void usage(poptContext pc)
        poptContext pc;
        int argc_new, i;
        char **argv_new;
+       TALLOC_CTX *mem_ctx;
        enum {OPT_UNCLIST=1000};
        struct poptOption long_options[] = {
                POPT_AUTOHELP
@@ -360,14 +356,16 @@ static void usage(poptContext pc)
 
        lp_ctx = cmdline_lp_ctx;
 
-       ev = s4_event_context_init(talloc_autofree_context());
+       mem_ctx = talloc_autofree_context();
+
+       ev = s4_event_context_init(mem_ctx);
 
        gensec_init(lp_ctx);
 
        lp_smbcli_options(lp_ctx, &options);
        lp_smbcli_session_options(lp_ctx, &session_options);
 
-       cli = connect_one(lp_resolve_context(lp_ctx), ev, share, 
+       cli = connect_one(lp_resolve_context(lp_ctx), ev, mem_ctx, share, 
                          lp_smb_ports(lp_ctx), &options, &session_options);
        if (!cli) {
                DEBUG(0,("Failed to connect to %s\n", share));
@@ -378,7 +376,7 @@ static void usage(poptContext pc)
        DEBUG(0,("seed=%d     format --- --- (server, correct)\n", seed));
        srandom(seed);
 
-       test_mask(argc_new-1, argv_new+1, cli);
+       test_mask(argc_new-1, argv_new+1, mem_ctx, cli);
 
        return(0);
 }


-- 
Samba Shared Repository

Reply via email to