From 2a664807c53c2af335b1473bfef1a03071e4852c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 2 Apr 2002 19:34:36 +0000 Subject: Fixed the error bad path for recursive mkdir so mkdir \a\b\c\d works. Forward ported some of the code tidyups from 2.2. Jeremy. (This used to be commit 2475c09b354cc7b5f4ce384e4497207d30f619bb) --- source3/smbd/reply.c | 56 ++++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 43 deletions(-) (limited to 'source3/smbd/reply.c') diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 06f068dccc..af582f1a41 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -463,12 +463,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size if (!ok) { - if((errno == ENOENT) && bad_path) - { - unix_ERR_class = ERRDOS; - unix_ERR_code = ERRbadpath; - } - + set_bad_path_error(errno, bad_path); END_PROFILE(SMBgetatr); return(UNIXERROR(ERRDOS,ERRbadfile)); } @@ -527,12 +522,7 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size if (!ok) { - if((errno == ENOENT) && bad_path) - { - unix_ERR_class = ERRDOS; - unix_ERR_code = ERRbadpath; - } - + set_bad_path_error(errno, bad_path); END_PROFILE(SMBsetatr); return(UNIXERROR(ERRDOS,ERRnoaccess)); } @@ -678,12 +668,8 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size { if(dptr_num == -2) { - if((errno == ENOENT) && bad_path) - { - unix_ERR_class = ERRDOS; - unix_ERR_code = ERRbadpath; - } - END_PROFILE(SMBsearch); + set_bad_path_error(errno, bad_path); + END_PROFILE(SMBsearch); return (UNIXERROR(ERRDOS,ERRnofids)); } END_PROFILE(SMBsearch); @@ -857,11 +843,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, if (!fsp) { - if((errno == ENOENT) && bad_path) - { - unix_ERR_class = ERRDOS; - unix_ERR_code = ERRbadpath; - } + set_bad_path_error(errno, bad_path); END_PROFILE(SMBopen); return(UNIXERROR(ERRDOS,ERRnoaccess)); } @@ -951,11 +933,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt if (!fsp) { - if((errno == ENOENT) && bad_path) - { - unix_ERR_class = ERRDOS; - unix_ERR_code = ERRbadpath; - } + set_bad_path_error(errno, bad_path); END_PROFILE(SMBopenX); return(UNIXERROR(ERRDOS,ERRnoaccess)); } @@ -1090,11 +1068,7 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, if (!fsp) { - if((errno == ENOENT) && bad_path) - { - unix_ERR_class = ERRDOS; - unix_ERR_code = ERRbadpath; - } + set_bad_path_error(errno, bad_path); END_PROFILE(SMBcreate); return(UNIXERROR(ERRDOS,ERRnoaccess)); } @@ -1164,11 +1138,8 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, /* close fd from smb_mkstemp() */ close(tmpfd); - if (!fsp) { - if((errno == ENOENT) && bad_path) { - unix_ERR_class = ERRDOS; - unix_ERR_code = ERRbadpath; - } + if (!fsp) { + set_bad_path_error(errno, bad_path); END_PROFILE(SMBctemp); return(UNIXERROR(ERRDOS,ERRnoaccess)); } @@ -2724,6 +2695,9 @@ NTSTATUS mkdir_internal(connection_struct *conn, pstring directory) ret = vfs_mkdir(conn,directory,unix_mode(conn,aDIR,directory)); if (ret == -1) { + NTSTATUS nterr = set_bad_path_error(errno, bad_path); + if (!NT_STATUS_IS_OK(nterr)) + return nterr; return map_nt_error_from_unix(errno); } @@ -2916,11 +2890,7 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, if (!ok) { - if((errno == ENOENT) && bad_path) - { - unix_ERR_class = ERRDOS; - unix_ERR_code = ERRbadpath; - } + set_bad_path_error(errno, bad_path); END_PROFILE(SMBrmdir); return(UNIXERROR(ERRDOS,ERRbadpath)); } -- cgit