summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-05-25 19:16:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:01 -0500
commit72cc1a1f12d4a44e3993cd958cd6e51e8fc1d693 (patch)
tree9e7433b2c8a5f015355d7f2b1a3a39b86952b311 /source4
parente427f58622e3d88c59953d6c1fb583acfb046213 (diff)
downloadsamba-72cc1a1f12d4a44e3993cd958cd6e51e8fc1d693.tar.gz
samba-72cc1a1f12d4a44e3993cd958cd6e51e8fc1d693.tar.bz2
samba-72cc1a1f12d4a44e3993cd958cd6e51e8fc1d693.zip
r6975: Test opening filenames with control characters in fails
with INVALID_NAME. Jeremy. (This used to be commit ec72d7d614caf9504d98c96c86906ed598f8be78)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/torture.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index b7e2168319..d5ca41f9c2 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -1384,12 +1384,14 @@ static BOOL run_vuidtest(void)
static struct smbcli_state *cli1;
static struct smbcli_state *cli2;
const char *fname = "\\readonly.file";
+ char *control_char_fname;
int fnum1, fnum2;
uint8_t buf[20];
size_t fsize;
BOOL correct = True;
char *tmp_path;
int failures = 0;
+ int i;
printf("starting open test\n");
@@ -1397,6 +1399,30 @@ static BOOL run_vuidtest(void)
return False;
}
+ asprintf(&control_char_fname, "\\readonly.afile");
+ for (i = 1; i <= 0x1f; i++) {
+ control_char_fname[10] = i;
+ fnum1 = smbcli_nt_create_full(cli1->tree, control_char_fname, 0, SEC_FILE_WRITE_DATA, FILE_ATTRIBUTE_NORMAL,
+ NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
+
+ if (!check_error(__location__, cli1, ERRDOS, ERRinvalidname,
+ NT_STATUS_OBJECT_NAME_INVALID)) {
+ printf("Error code should be NT_STATUS_OBJECT_NAME_INVALID, was %s for file with %d char\n",
+ smbcli_errstr(cli1->tree), i);
+ failures++;
+ }
+
+ if (fnum1 != -1) {
+ smbcli_close(cli1->tree, fnum1);
+ }
+ smbcli_setatr(cli1->tree, control_char_fname, 0, 0);
+ smbcli_unlink(cli1->tree, control_char_fname);
+ }
+ free(control_char_fname);
+
+ if (!failures)
+ printf("Create file with control char names passed.\n");
+
smbcli_setatr(cli1->tree, fname, 0, 0);
smbcli_unlink(cli1->tree, fname);