summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1997-12-20 05:25:37 +0000
committerJeremy Allison <jra@samba.org>1997-12-20 05:25:37 +0000
commitcb771b2667070cff8d6cf86998a11ba2e4977690 (patch)
tree77a61a260e8b722c9d35e7177855bdadb96558d7 /source
parent45962779a658b0b78895ae08ad394e870ce6ed10 (diff)
downloadsamba-cb771b2667070cff8d6cf86998a11ba2e4977690.tar.gz
samba-cb771b2667070cff8d6cf86998a11ba2e4977690.tar.xz
samba-cb771b2667070cff8d6cf86998a11ba2e4977690.zip
trans2.c: Forced trans2_findfirst to behave as NT does in error returns.
util.c: Applied fix from Branko Cibej <branko.cibej@hermes.si> where StrnCaseCmp tests one character too many. Jeremy.
Diffstat (limited to 'source')
-rw-r--r--source/lib/util.c3
-rw-r--r--source/smbd/trans2.c32
2 files changed, 11 insertions, 24 deletions
diff --git a/source/lib/util.c b/source/lib/util.c
index 18f1240bbdd..58560bd2271 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -953,10 +953,11 @@ int StrnCaseCmp(char *s, char *t, int n)
else
#endif /* KANJI_WIN95_COMPATIBILITY */
{
- while (n-- && *s && *t && toupper(*s) == toupper(*t))
+ while (n && *s && *t && toupper(*s) == toupper(*t))
{
s++;
t++;
+ n--;
}
/* not run out of chars - strings are different lengths */
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index 0ca678b7682..ce4a4500502 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -646,29 +646,7 @@ static int call_trans2findfirst(char *inbuf, char *outbuf, int bufsize, int cnum
dptr_num = dptr_create(cnum,directory, True ,SVAL(inbuf,smb_pid));
if (dptr_num < 0)
- {
- if(dptr_num == -2)
- {
- if((errno == ENOENT) && bad_path)
- {
- unix_ERR_class = ERRDOS;
- unix_ERR_code = ERRbadpath;
- }
-
-#if 0
- /* Ugly - NT specific hack - maybe not needed ? (JRA) */
- if((errno == ENOTDIR) && (Protocol >= PROTOCOL_NT1) &&
- (get_remote_arch() == RA_WINNT))
- {
- unix_ERR_class = ERRDOS;
- unix_ERR_code = ERRbaddirectory;
- }
-#endif
-
- return (UNIXERROR(ERRDOS,ERRbadpath));
- }
- return(ERROR(ERRDOS,ERRbadpath));
- }
+ return(ERROR(ERRDOS,ERRbadfile));
/* convert the formatted masks */
{
@@ -748,6 +726,14 @@ static int call_trans2findfirst(char *inbuf, char *outbuf, int bufsize, int cnum
dptr_num = -1;
}
+ /*
+ * If there are no matching entries we must return ERRDOS/ERRbadfile -
+ * from observation of NT.
+ */
+
+ if(numentries == 0)
+ return(ERROR(ERRDOS,ERRbadfile));
+
/* At this point pdata points to numentries directory entries. */
/* Set up the return parameter block */