summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c56
1 files changed, 13 insertions, 43 deletions
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));
}