From 3b6186a67630cf05bc33e6e9288e132f39173ef4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Sep 2007 17:59:53 +0000 Subject: r25008: Remove use of pstring. (This used to be commit c57869e2620de30c303b0cb2f70cd07b32f269fc) --- source4/lib/util/util_strlist.c | 1 - source4/torture/basic/mangle_test.c | 31 +++++++++++++++++-------------- source4/torture/nbt/dgram.c | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) (limited to 'source4') diff --git a/source4/lib/util/util_strlist.c b/source4/lib/util/util_strlist.c index a8b106a567..ed4ab00031 100644 --- a/source4/lib/util/util_strlist.c +++ b/source4/lib/util/util_strlist.c @@ -19,7 +19,6 @@ */ #include "includes.h" -#include "pstring.h" #include "system/locale.h" /** diff --git a/source4/torture/basic/mangle_test.c b/source4/torture/basic/mangle_test.c index d13450dd3a..729e2c5c43 100644 --- a/source4/torture/basic/mangle_test.c +++ b/source4/torture/basic/mangle_test.c @@ -25,7 +25,6 @@ #include "lib/util/util_tdb.h" #include "libcli/libcli.h" #include "torture/util.h" -#include "pstring.h" static TDB_CONTEXT *tdb; @@ -33,11 +32,12 @@ static TDB_CONTEXT *tdb; static uint_t total, collisions, failures; -static BOOL test_one(struct smbcli_state *cli, const char *name) +static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli, + const char *name) { int fnum; const char *shortname; - fstring name2; + const char *name2; NTSTATUS status; TDB_DATA data; @@ -46,12 +46,12 @@ static BOOL test_one(struct smbcli_state *cli, const char *name) fnum = smbcli_open(cli->tree, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { printf("open of %s failed (%s)\n", name, smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { printf("close of %s failed (%s)\n", name, smbcli_errstr(cli->tree)); - return False; + return false; } /* get the short name */ @@ -61,7 +61,7 @@ static BOOL test_one(struct smbcli_state *cli, const char *name) return False; } - snprintf(name2, sizeof(name2), "\\mangle_test\\%s", shortname); + name2 = talloc_asprintf(tctx, "\\mangle_test\\%s", shortname); if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, name2))) { printf("unlink of %s (%s) failed (%s)\n", name2, name, smbcli_errstr(cli->tree)); @@ -112,18 +112,21 @@ static BOOL test_one(struct smbcli_state *cli, const char *name) } -static void gen_name(char *name) +static char *gen_name(TALLOC_CTX *mem_ctx) { const char *chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-$~..."; uint_t max_idx = strlen(chars); uint_t len; int i; char *p; + char *name; - fstrcpy(name, "\\mangle_test\\"); - p = name + strlen(name); + name = talloc_strdup(mem_ctx, "\\mangle_test\\"); len = 1 + random() % NAME_LENGTH; + + name = talloc_realloc(mem_ctx, name, char, strlen(name) + len + 6); + p = name + strlen(name); for (i=0;i