summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-08-31 21:29:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:33 -0500
commite197fb368afd2e22d8a481b0d1adfbb74093ef06 (patch)
tree617aa76856c360d4f5f61a2e9466a41f2a057f16 /source3
parentf4c2e60ed0310152430fd4e7a2ad6d23f8e3267a (diff)
downloadsamba-e197fb368afd2e22d8a481b0d1adfbb74093ef06.tar.gz
samba-e197fb368afd2e22d8a481b0d1adfbb74093ef06.tar.bz2
samba-e197fb368afd2e22d8a481b0d1adfbb74093ef06.zip
r2150: Fix parsing of names ending in dot and a few other error returns
(commit to Samba4 smbtorture will exercise these fixes). Jeremy. (This used to be commit ff20dacc68c78b8d30993712366af30a64e960aa)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/reply.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 611fb04c19..30616a66fb 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -97,26 +97,25 @@ NTSTATUS check_path_syntax(pstring destname, const pstring srcname, BOOL allow_w
d--;
}
s += 3;
- } else if ((s[0] == '.') && (IS_DIRECTORY_SEP(s[1]) || (s[1] == '\0'))) {
-
+ } else if ((s[0] == '.') && (s[1] == '\0')) {
+ if (s == srcname) {
+ ret = NT_STATUS_OBJECT_NAME_INVALID;
+ break;
+ }
+ *d++ = *s++;
+ } else if ((s[0] == '.') && IS_DIRECTORY_SEP(s[1])) {
/*
* No mb char starts with '.' so we're safe checking the directory separator here.
*/
- /* "./" or ".\\" fails with a different error depending on where it is... */
+ /* "./" or ".\\" fails with a different error depending on what is after it... */
- if (s == srcname) {
+ if (s[2] == '\0') {
ret = NT_STATUS_OBJECT_NAME_INVALID;
- break;
} else {
- if (s[1] != '\0' && s[2] == '\0') {
- ret = NT_STATUS_INVALID_PARAMETER;
- break;
- }
ret = NT_STATUS_OBJECT_PATH_NOT_FOUND;
- break;
}
- s++;
+ break;
} else {
if (!(*s & 0x80)) {
if (allow_wcard_names) {
@@ -521,7 +520,6 @@ int reply_ioctl(connection_struct *conn,
int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
int outsize = 0;
- int mode;
pstring name;
BOOL ok = False;
BOOL bad_path = False;
@@ -544,8 +542,6 @@ int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
}
- mode = SVAL(inbuf,smb_vwv0);
-
if (check_name(name,conn)) {
if (VALID_STAT(sbuf) || SMB_VFS_STAT(conn,name,&sbuf) == 0)
if (!(ok = S_ISDIR(sbuf.st_mode))) {
@@ -578,8 +574,7 @@ int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
}
outsize = set_message(outbuf,0,0,True);
-
- DEBUG(3,("chkpth %s mode=%d\n", name, mode));
+ DEBUG(3,("chkpth %s mode=%d\n", name, (int)SVAL(inbuf,smb_vwv0)));
END_PROFILE(SMBchkpth);
return(outsize);