summaryrefslogtreecommitdiff
path: root/source3/smbd/pipes.c
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-08-20 20:32:23 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-08-20 20:32:23 +0000
commit46dbd8c06009ad9e64251ae844fb16f2a30f5ab7 (patch)
treeb3665c4cdda6e60c2e85218f6778213817b4210f /source3/smbd/pipes.c
parentc76dc7c2963d1205cf46849df6b6f0edbf63692d (diff)
downloadsamba-46dbd8c06009ad9e64251ae844fb16f2a30f5ab7.tar.gz
samba-46dbd8c06009ad9e64251ae844fb16f2a30f5ab7.tar.bz2
samba-46dbd8c06009ad9e64251ae844fb16f2a30f5ab7.zip
Changes to allow Samba to return the same error code as Windows NT.
Takes care of the cases where a Windows program is parsing a pathname component by component and expects 2 different errors. ERRbadpath - if a component in the path doesn't exist. ERRbaddirectory - if a component in the path exists but is not a directory. Extra error code added to smb.h to support this. Code based on suggestions from "Christian Groessler" <chris@fast-ag.de>. Jeremy (jallison@whistle.com) (This used to be commit 28b3c6db8a81b41b448a4f3cd98e9cd2c4b5fb2e)
Diffstat (limited to 'source3/smbd/pipes.c')
-rw-r--r--source3/smbd/pipes.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index a294ee4f49..afab7e1d91 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -84,6 +84,7 @@ int reply_open_pipe_and_X(char *inbuf,char *outbuf,int length,int bufsize)
struct stat sbuf;
int smb_action = 0;
int i;
+ BOOL bad_path = False;
/* XXXX we need to handle passed times, sattr and flags */
strcpy(fname,smb_buf(inbuf));
@@ -114,7 +115,7 @@ int reply_open_pipe_and_X(char *inbuf,char *outbuf,int length,int bufsize)
Connections[cnum].read_only = 0;
smb_ofun |= 0x10; /* Add Create it not exists flag */
- unix_convert(fname,cnum,0);
+ unix_convert(fname,cnum,0,&bad_path);
fnum = find_free_file();
if (fnum < 0)
@@ -129,7 +130,15 @@ int reply_open_pipe_and_X(char *inbuf,char *outbuf,int length,int bufsize)
&rmode,&smb_action);
if (!Files[fnum].open)
+ {
+ /* Change the error code if bad_path was set. */
+ if((errno == ENOENT) && bad_path)
+ {
+ unix_ERR_class = ERRDOS;
+ unix_ERR_code = ERRbadpath;
+ }
return(UNIXERROR(ERRDOS,ERRnoaccess));
+ }
if (fstat(Files[fnum].fd_ptr->fd,&sbuf) != 0) {
close_file(fnum);