summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/ntvfs/posix/pvfs_resolve.c17
-rwxr-xr-xsource4/script/tests/test_posix.sh4
-rw-r--r--source4/torture/raw/mkdir.c4
3 files changed, 20 insertions, 5 deletions
diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c
index 5b86cd3a73..5d98274511 100644
--- a/source4/ntvfs/posix/pvfs_resolve.c
+++ b/source4/ntvfs/posix/pvfs_resolve.c
@@ -180,8 +180,9 @@ static NTSTATUS pvfs_case_search(struct pvfs_state *pvfs, struct pvfs_filename *
static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
uint_t flags, struct pvfs_filename *name)
{
- char *ret, *p;
+ char *ret, *p, *p_start;
size_t len;
+ int num_components=0;
name->original_name = talloc_strdup(name, cifs_name);
name->stream_name = NULL;
@@ -217,6 +218,7 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
/* now do an in-place conversion of '\' to '/', checking
for legal characters */
+ p_start = p;
while (*p) {
size_t c_size;
codepoint_t c = next_codepoint(p, &c_size);
@@ -228,6 +230,7 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
return NT_STATUS_ILLEGAL_CHARACTER;
}
*p = '/';
+ num_components++;
break;
case ':':
if (!(flags & PVFS_RESOLVE_STREAMS)) {
@@ -252,6 +255,18 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
case '/':
case '|':
return NT_STATUS_ILLEGAL_CHARACTER;
+ case '.':
+ if (p[1] != '.' ||
+ (p[2] != '\\' && p[2] != 0) ||
+ (p != p_start && p[-1] != '/')) {
+ break;
+ }
+ /* its definately a .. component */
+ num_components--;
+ if (num_components <= 0) {
+ return NT_STATUS_OBJECT_PATH_SYNTAX_BAD;
+ }
+ break;
}
p += c_size;
diff --git a/source4/script/tests/test_posix.sh b/source4/script/tests/test_posix.sh
index 414cf30a67..0db84a83ed 100755
--- a/source4/script/tests/test_posix.sh
+++ b/source4/script/tests/test_posix.sh
@@ -30,7 +30,7 @@ testit() {
tests="BASE-FDPASS BASE-LOCK1 BASE-LOCK2 BASE-LOCK3 BASE-LOCK4"
tests="$tests BASE-LOCK5 BASE-LOCK6 BASE-LOCK7 BASE-UNLINK BASE-ATTR"
-tests="$tests BASE-NEGNOWAIT BASE-DIR"
+tests="$tests BASE-NEGNOWAIT BASE-DIR RAW-MKDIR"
tests="$tests BASE-DENY2 BASE-TCON BASE-TCONDEV BASE-RW1"
tests="$tests BASE-DENY3 BASE-XCOPY"
tests="$tests BASE-DELETE BASE-PROPERTIES BASE-MANGLE"
@@ -40,7 +40,7 @@ tests="$tests RAW-LOCK RAW-SEEK RAW-CONTEXT BASE-RENAME"
soon="BASE-DIR1 BASE-DENY1 BASE-VUID BASE-OPEN BASE-DEFER_OPEN BASE-OPENATTR BASE-CHARSET"
-soon="$soon RAW-SFILEINFO RAW-SEARCH RAW-OPEN RAW-MKDIR RAW-OPLOCK RAW-NOTIFY RAW-MUX RAW-IOCTL"
+soon="$soon RAW-SFILEINFO RAW-SEARCH RAW-OPEN RAW-OPLOCK RAW-NOTIFY RAW-MUX RAW-IOCTL"
soon="$soon RAW-CHKPATH RAW-UNLINK RAW-READ RAW-WRITE RAW-RENAME RAW-CLOSE BASE-TRANS2"
for t in $tests; do
diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c
index bc2ddbb544..48c4853554 100644
--- a/source4/torture/raw/mkdir.c
+++ b/source4/torture/raw/mkdir.c
@@ -22,8 +22,8 @@
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
- printf("(%d) Incorrect status %s - should be %s\n", \
- __LINE__, nt_errstr(status), nt_errstr(correct)); \
+ printf("(%s) Incorrect status %s - should be %s\n", \
+ __location__, nt_errstr(status), nt_errstr(correct)); \
ret = False; \
goto done; \
}} while (0)