summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-07 17:59:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:05:33 -0500
commit3b6186a67630cf05bc33e6e9288e132f39173ef4 (patch)
tree88df177f593f209d1463f22a5e2460c84b609e5c
parentb50ef4caef44e3b45445728818f3bca09273249d (diff)
downloadsamba-3b6186a67630cf05bc33e6e9288e132f39173ef4.tar.gz
samba-3b6186a67630cf05bc33e6e9288e132f39173ef4.tar.bz2
samba-3b6186a67630cf05bc33e6e9288e132f39173ef4.zip
r25008: Remove use of pstring.
(This used to be commit c57869e2620de30c303b0cb2f70cd07b32f269fc)
-rw-r--r--source4/lib/util/util_strlist.c1
-rw-r--r--source4/torture/basic/mangle_test.c31
-rw-r--r--source4/torture/nbt/dgram.c2
3 files changed, 18 insertions, 16 deletions
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<len;i++) {
p[i] = chars[random() % max_idx];
@@ -152,6 +155,8 @@ static void gen_name(char *name)
s[4] = 0;
}
}
+
+ return name;
}
@@ -173,13 +178,11 @@ bool torture_mangle(struct torture_context *torture,
}
for (i=0;i<torture_numops;i++) {
- fstring name;
-
- ZERO_STRUCT(name);
+ char *name;
- gen_name(name);
+ name = gen_name(torture);
- if (!test_one(cli, name)) {
+ if (!test_one(torture, cli, name)) {
break;
}
if (total && total % 100 == 0) {
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index c5b009979e..c4515ea797 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -342,7 +342,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
*/
struct torture_suite *torture_nbt_dgram(TALLOC_CTX *mem_ctx)
{
- struct torture_suite *suite = torture_suite_create(suite, "DGRAM");
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "DGRAM");
torture_suite_add_simple_test(suite, "netlogon", nbt_test_netlogon);
torture_suite_add_simple_test(suite, "netlogon2", nbt_test_netlogon2);