summaryrefslogtreecommitdiff
path: root/source3/smbd/nttrans.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-07-15 10:35:28 +0000
committerAndrew Tridgell <tridge@samba.org>2002-07-15 10:35:28 +0000
commite90b65284812aaa5ff9e9935ce9bbad7791cbbcd (patch)
tree9e744d1dc2f93934a4b49166a37383d3cb2b2139 /source3/smbd/nttrans.c
parentec167dc9cc0ec2ee461837c25a371d2981744208 (diff)
downloadsamba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.gz
samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.bz2
samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.zip
updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r--source3/smbd/nttrans.c568
1 files changed, 287 insertions, 281 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index edee14513c..e0a0da7a75 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -454,6 +454,7 @@ to open_mode 0x%x\n", (unsigned long)*desired_access, (unsigned long)share_acces
/****************************************************************************
Reply to an NT create and X call on a pipe.
****************************************************************************/
+
static int nt_open_pipe(char *fname, connection_struct *conn,
char *inbuf, char *outbuf, int *ppnum)
{
@@ -502,7 +503,7 @@ static int do_ntcreate_pipe_open(connection_struct *conn,
int pnum = -1;
char *p = NULL;
- srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum)) != 0)
return ret;
@@ -605,12 +606,13 @@ int reply_ntcreate_and_X(connection_struct *conn,
}
if(!dir_fsp->is_directory) {
+
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
+
/*
* Check to see if this is a mac fork of some kind.
*/
- srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE);
-
if( strchr_m(fname, ':')) {
END_PROFILE(SMBntcreateX);
return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
@@ -635,10 +637,18 @@ int reply_ntcreate_and_X(connection_struct *conn,
dir_name_len++;
}
- srvstr_pull(inbuf, &fname[dir_name_len], smb_buf(inbuf), sizeof(fname)-dir_name_len,
- -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, &fname[dir_name_len], smb_buf(inbuf), sizeof(fname)-dir_name_len, STR_TERMINATE);
} else {
- srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
+
+ /*
+ * Check to see if this is a mac fork of some kind.
+ */
+
+ if( strchr_m(fname, ':')) {
+ END_PROFILE(SMBntcreateX);
+ return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ }
}
/*
@@ -880,29 +890,29 @@ static int do_nt_transact_create_pipe( connection_struct *conn,
return ERROR_DOS(ERRDOS,ERRbadaccess);
}
- srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE);
-
- if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum)) != 0)
- return ret;
+ srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
+ if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum)) != 0)
+ return ret;
+
/* Realloc the size of parameters and data we will return */
params = Realloc(*ppparams, 69);
if(params == NULL)
return ERROR_DOS(ERRDOS,ERRnomem);
-
+
*ppparams = params;
-
+
memset((char *)params,'\0',69);
-
+
p = params;
SCVAL(p,0,NO_OPLOCK_RETURN);
-
+
p += 2;
SSVAL(p,0,pnum);
p += 2;
SIVAL(p,0,FILE_WAS_OPENED);
p += 8;
-
+
p += 32;
SIVAL(p,0,FILE_ATTRIBUTE_NORMAL); /* File Attributes. */
p += 20;
@@ -910,12 +920,12 @@ static int do_nt_transact_create_pipe( connection_struct *conn,
SSVAL(p,0,FILE_TYPE_MESSAGE_MODE_PIPE);
/* Device state. */
SSVAL(p,2, 0x5FF); /* ? */
-
+
DEBUG(5,("do_nt_transact_create_pipe: open name = %s\n", fname));
-
+
/* Send the required number of replies */
send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, params, 69, *ppdata, 0);
-
+
return -1;
}
@@ -923,17 +933,15 @@ static int do_nt_transact_create_pipe( connection_struct *conn,
Internal fn to set security descriptors.
****************************************************************************/
-static BOOL set_sd(files_struct *fsp, char *data, uint32 sd_len, uint32 security_info_sent, int *pdef_class,uint32 *pdef_code)
+static NTSTATUS set_sd(files_struct *fsp, char *data, uint32 sd_len, uint32 security_info_sent)
{
prs_struct pd;
SEC_DESC *psd = NULL;
TALLOC_CTX *mem_ctx;
BOOL ret;
-
+
if (sd_len == 0) {
- *pdef_class = ERRDOS;
- *pdef_code = ERRbadaccess;
- return False;
+ return NT_STATUS_OK;
}
/*
@@ -942,9 +950,7 @@ static BOOL set_sd(files_struct *fsp, char *data, uint32 sd_len, uint32 security
if ((mem_ctx = talloc_init()) == NULL) {
DEBUG(0,("set_sd: talloc_init failed.\n"));
- *pdef_class = ERRDOS;
- *pdef_code = ERRnomem;
- return False;
+ return NT_STATUS_NO_MEMORY;
}
prs_init(&pd, 0, mem_ctx, UNMARSHALL);
@@ -966,11 +972,9 @@ static BOOL set_sd(files_struct *fsp, char *data, uint32 sd_len, uint32 security
* Return access denied for want of a better error message..
*/
talloc_destroy(mem_ctx);
- *pdef_class = ERRDOS;
- *pdef_code = ERRnomem;
- return False;
+ return NT_STATUS_NO_MEMORY;
}
-
+
if (psd->off_owner_sid==0)
security_info_sent &= ~OWNER_SECURITY_INFORMATION;
if (psd->off_grp_sid==0)
@@ -981,19 +985,15 @@ static BOOL set_sd(files_struct *fsp, char *data, uint32 sd_len, uint32 security
security_info_sent &= ~DACL_SECURITY_INFORMATION;
ret = fsp->conn->vfs_ops.fset_nt_acl( fsp, fsp->fd, security_info_sent, psd);
-
+
if (!ret) {
talloc_destroy(mem_ctx);
- *pdef_class = ERRDOS;
- *pdef_code = ERRnoaccess;
- return False;
+ return NT_STATUS_ACCESS_DENIED;
}
-
+
talloc_destroy(mem_ctx);
-
- *pdef_class = 0;
- *pdef_code = 0;
- return True;
+
+ return NT_STATUS_OK;
}
/****************************************************************************
@@ -1005,304 +1005,307 @@ static int call_nt_transact_create(connection_struct *conn,
int bufsize, char **ppsetup, char **ppparams,
char **ppdata)
{
- pstring fname;
- char *params = *ppparams;
- char *data = *ppdata;
- int total_parameter_count = (int)IVAL(inbuf, smb_nt_TotalParameterCount);
- /* Breakout the oplock request bits so we can set the
- reply bits separately. */
- int oplock_request = 0;
- mode_t unixmode;
- int fmode=0,rmode=0;
- SMB_OFF_T file_len = 0;
- SMB_STRUCT_STAT sbuf;
- int smb_action = 0;
- BOOL bad_path = False;
- files_struct *fsp = NULL;
- char *p = NULL;
- uint32 flags;
- uint32 desired_access;
- uint32 file_attributes;
- uint32 share_access;
- uint32 create_disposition;
- uint32 create_options;
- uint32 sd_len;
- uint16 root_dir_fid;
- int smb_ofun;
- int smb_open_mode;
- int smb_attr;
- int error_class;
- uint32 error_code;
- time_t c_time;
-
- DEBUG(5,("call_nt_transact_create\n"));
+ pstring fname;
+ char *params = *ppparams;
+ char *data = *ppdata;
+ int total_parameter_count = (int)IVAL(inbuf, smb_nt_TotalParameterCount);
+ /* Breakout the oplock request bits so we can set the reply bits separately. */
+ int oplock_request = 0;
+ mode_t unixmode;
+ int fmode=0,rmode=0;
+ SMB_OFF_T file_len = 0;
+ SMB_STRUCT_STAT sbuf;
+ int smb_action = 0;
+ BOOL bad_path = False;
+ files_struct *fsp = NULL;
+ char *p = NULL;
+ uint32 flags;
+ uint32 desired_access;
+ uint32 file_attributes;
+ uint32 share_access;
+ uint32 create_disposition;
+ uint32 create_options;
+ uint32 sd_len;
+ uint16 root_dir_fid;
+ int smb_ofun;
+ int smb_open_mode;
+ int smb_attr;
+ time_t c_time;
+ NTSTATUS nt_status;
- /*
- * If it's an IPC, use the pipe handler.
- */
+ DEBUG(5,("call_nt_transact_create\n"));
+
+ /*
+ * If it's an IPC, use the pipe handler.
+ */
- if (IS_IPC(conn)) {
+ if (IS_IPC(conn)) {
if (lp_nt_pipe_support())
return do_nt_transact_create_pipe(conn, inbuf, outbuf, length,
bufsize, ppsetup, ppparams, ppdata);
else
return ERROR_DOS(ERRDOS,ERRbadaccess);
- }
+ }
- /*
- * Ensure minimum number of parameters sent.
- */
+ /*
+ * Ensure minimum number of parameters sent.
+ */
- if(total_parameter_count < 54) {
- DEBUG(0,("call_nt_transact_create - insufficient parameters (%u)\n", (unsigned int)total_parameter_count));
- return ERROR_DOS(ERRDOS,ERRbadaccess);
- }
+ if(total_parameter_count < 54) {
+ DEBUG(0,("call_nt_transact_create - insufficient parameters (%u)\n", (unsigned int)total_parameter_count));
+ return ERROR_DOS(ERRDOS,ERRbadaccess);
+ }
- flags = IVAL(params,0);
- desired_access = IVAL(params,8);
- file_attributes = IVAL(params,20);
- share_access = IVAL(params,24);
- create_disposition = IVAL(params,28);
- create_options = IVAL(params,32);
- sd_len = IVAL(params,36);
- root_dir_fid = (uint16)IVAL(params,4);
- smb_attr = (file_attributes & SAMBA_ATTRIBUTES_MASK);
+ flags = IVAL(params,0);
+ desired_access = IVAL(params,8);
+ file_attributes = IVAL(params,20);
+ share_access = IVAL(params,24);
+ create_disposition = IVAL(params,28);
+ create_options = IVAL(params,32);
+ sd_len = IVAL(params,36);
+ root_dir_fid = (uint16)IVAL(params,4);
+ smb_attr = (file_attributes & SAMBA_ATTRIBUTES_MASK);
- /*
- * We need to construct the open_and_X ofun value from the
- * NT values, as that's what our code is structured to accept.
- */
+ /*
+ * We need to construct the open_and_X ofun value from the
+ * NT values, as that's what our code is structured to accept.
+ */
- if((smb_ofun = map_create_disposition( create_disposition )) == -1)
- return ERROR_DOS(ERRDOS,ERRbadmem);
+ if((smb_ofun = map_create_disposition( create_disposition )) == -1)
+ return ERROR_DOS(ERRDOS,ERRbadmem);
- /*
- * Get the file name.
- */
+ /*
+ * Get the file name.
+ */
- if(root_dir_fid != 0) {
- /*
- * This filename is relative to a directory fid.
- */
+ if(root_dir_fid != 0) {
+ /*
+ * This filename is relative to a directory fid.
+ */
- files_struct *dir_fsp = file_fsp(params,4);
- size_t dir_name_len;
+ files_struct *dir_fsp = file_fsp(params,4);
+ size_t dir_name_len;
- if(!dir_fsp)
- return ERROR_DOS(ERRDOS,ERRbadfid);
+ if(!dir_fsp)
+ return ERROR_DOS(ERRDOS,ERRbadfid);
- if(!dir_fsp->is_directory) {
- /*
- * Check to see if this is a mac fork of some kind.
- */
+ if(!dir_fsp->is_directory) {
- srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
- if( strchr_m(fname, ':')) {
- return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
- }
+ /*
+ * Check to see if this is a mac fork of some kind.
+ */
- return ERROR_DOS(ERRDOS,ERRbadfid);
- }
+ if( strchr_m(fname, ':'))
+ return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
- /*
- * Copy in the base directory name.
- */
+ return ERROR_DOS(ERRDOS,ERRbadfid);
+ }
- pstrcpy( fname, dir_fsp->fsp_name );
- dir_name_len = strlen(fname);
+ /*
+ * Copy in the base directory name.
+ */
- /*
- * Ensure it ends in a '\'.
- */
+ pstrcpy( fname, dir_fsp->fsp_name );
+ dir_name_len = strlen(fname);
- if((fname[dir_name_len-1] != '\\') && (fname[dir_name_len-1] != '/')) {
- pstrcat(fname, "\\");
- dir_name_len++;
- }
+ /*
+ * Ensure it ends in a '\'.
+ */
- srvstr_pull(inbuf, &fname[dir_name_len], params+53, sizeof(fname)-dir_name_len,
- -1, STR_TERMINATE);
- } else {
- srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE);
- }
+ if((fname[dir_name_len-1] != '\\') && (fname[dir_name_len-1] != '/')) {
+ pstrcat(fname, "\\");
+ dir_name_len++;
+ }
- /*
- * Now contruct the smb_open_mode value from the desired access
- * and the share access.
- */
+ srvstr_pull(inbuf, &fname[dir_name_len], params+53, sizeof(fname)-dir_name_len,
+ total_parameter_count-53, STR_TERMINATE);
+ } else {
+ srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
+
+ /*
+ * Check to see if this is a mac fork of some kind.
+ */
- if((smb_open_mode = map_share_mode( fname, create_options, &desired_access,
- share_access, file_attributes)) == -1)
- return ERROR_DOS(ERRDOS,ERRbadaccess);
+ if( strchr_m(fname, ':'))
+ return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ }
- oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
- oplock_request |= (flags & REQUEST_BATCH_OPLOCK) ? BATCH_OPLOCK : 0;
+ /*
+ * Now contruct the smb_open_mode value from the desired access
+ * and the share access.
+ */
- /*
- * Check if POSIX semantics are wanted.
- */
+ if((smb_open_mode = map_share_mode( fname, create_options, &desired_access,
+ share_access, file_attributes)) == -1)
+ return ERROR_DOS(ERRDOS,ERRbadaccess);
- set_posix_case_semantics(file_attributes);
+ oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
+ oplock_request |= (flags & REQUEST_BATCH_OPLOCK) ? BATCH_OPLOCK : 0;
+
+ /*
+ * Check if POSIX semantics are wanted.
+ */
+
+ set_posix_case_semantics(file_attributes);
- RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
+ RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
- unix_convert(fname,conn,0,&bad_path,&sbuf);
+ unix_convert(fname,conn,0,&bad_path,&sbuf);
- unixmode = unix_mode(conn,smb_attr | aARCH, fname);
+ unixmode = unix_mode(conn,smb_attr | aARCH, fname);
- /*
- * If it's a request for a directory open, deal with it separately.
- */
+ /*
+ * If it's a request for a directory open, deal with it separately.
+ */
- if(create_options & FILE_DIRECTORY_FILE) {
+ if(create_options & FILE_DIRECTORY_FILE) {
- oplock_request = 0;
+ oplock_request = 0;
- /*
- * We will get a create directory here if the Win32
- * app specified a security descriptor in the
- * CreateDirectory() call.
- */
+ /*
+ * We will get a create directory here if the Win32
+ * app specified a security descriptor in the
+ * CreateDirectory() call.
+ */
- fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, unixmode, &smb_action);
+ fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, unixmode, &smb_action);
- if(!fsp) {
- restore_case_semantics(file_attributes);
- set_bad_path_error(errno, bad_path);
- return(UNIXERROR(ERRDOS,ERRnoaccess));
- }
+ if(!fsp) {
+ restore_case_semantics(file_attributes);
+ set_bad_path_error(errno, bad_path);
+ return(UNIXERROR(ERRDOS,ERRnoaccess));
+ }
- } else {
+ } else {
- /*
- * Ordinary file case.
- */
+ /*
+ * Ordinary file case.
+ */
- fsp = open_file_shared1(conn,fname,&sbuf,desired_access,
- smb_open_mode,smb_ofun,unixmode,
- oplock_request,&rmode,&smb_action);
+ fsp = open_file_shared1(conn,fname,&sbuf,desired_access,
+ smb_open_mode,smb_ofun,unixmode,
+ oplock_request,&rmode,&smb_action);
- if (!fsp) {
+ if (!fsp) {
- if(errno == EISDIR) {
+ if(errno == EISDIR) {
- /*
- * Fail the open if it was explicitly a non-directory file.
- */
+ /*
+ * Fail the open if it was explicitly a non-directory file.
+ */
- if (create_options & FILE_NON_DIRECTORY_FILE) {
- restore_case_semantics(file_attributes);
- SSVAL(outbuf, smb_flg2,
- SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
- return ERROR_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
- }
+ if (create_options & FILE_NON_DIRECTORY_FILE) {
+ restore_case_semantics(file_attributes);
+ SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
+ return ERROR_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
+ }
- oplock_request = 0;
- fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, unixmode, &smb_action);
+ oplock_request = 0;
+ fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, unixmode, &smb_action);
- if(!fsp) {
+ if(!fsp) {
+ restore_case_semantics(file_attributes);
+ set_bad_path_error(errno, bad_path);
+ return(UNIXERROR(ERRDOS,ERRnoaccess));
+ }
+ } else {
restore_case_semantics(file_attributes);
set_bad_path_error(errno, bad_path);
return(UNIXERROR(ERRDOS,ERRnoaccess));
}
- } else {
-
- restore_case_semantics(file_attributes);
- set_bad_path_error(errno, bad_path);
- return(UNIXERROR(ERRDOS,ERRnoaccess));
- }
- }
+ }
- file_len = sbuf.st_size;
- fmode = dos_mode(conn,fname,&sbuf);
- if(fmode == 0)
- fmode = FILE_ATTRIBUTE_NORMAL;
+ file_len = sbuf.st_size;
+ fmode = dos_mode(conn,fname,&sbuf);
+ if(fmode == 0)
+ fmode = FILE_ATTRIBUTE_NORMAL;
- if (fmode & aDIR) {
- close_file(fsp,False);
- restore_case_semantics(file_attributes);
- return ERROR_DOS(ERRDOS,ERRnoaccess);
- }
+ if (fmode & aDIR) {
+ close_file(fsp,False);
+ restore_case_semantics(file_attributes);
+ return ERROR_DOS(ERRDOS,ERRnoaccess);
+ }
- /*
- * If the caller set the extended oplock request bit
- * and we granted one (by whatever means) - set the
- * correct bit for extended oplock reply.
- */
+ /*
+ * If the caller set the extended oplock request bit
+ * and we granted one (by whatever means) - set the
+ * correct bit for extended oplock reply.
+ */
- if (oplock_request && lp_fake_oplocks(SNUM(conn)))
- smb_action |= EXTENDED_OPLOCK_GRANTED;
+ if (oplock_request && lp_fake_oplocks(SNUM(conn)))
+ smb_action |= EXTENDED_OPLOCK_GRANTED;
- if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))
- smb_action |= EXTENDED_OPLOCK_GRANTED;
- }
-
- /*
- * Now try and apply the desired SD.
- */
+ if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))
+ smb_action |= EXTENDED_OPLOCK_GRANTED;
+ }
- if (!set_sd( fsp, data, sd_len, ALL_SECURITY_INFORMATION, &error_class, &error_code)) {
- close_file(fsp,False);
- restore_case_semantics(file_attributes);
- return ERROR_DOS(error_class, error_code);
- }
+ /*
+ * Now try and apply the desired SD.
+ */
- restore_case_semantics(file_attributes);
+ if (sd_len && !NT_STATUS_IS_OK(nt_status = set_sd( fsp, data, sd_len, ALL_SECURITY_INFORMATION))) {
+ close_file(fsp,False);
+ restore_case_semantics(file_attributes);
+ return ERROR_NT(nt_status);
+ }
+
+ restore_case_semantics(file_attributes);
- /* Realloc the size of parameters and data we will return */
- params = Realloc(*ppparams, 69);
- if(params == NULL)
- return ERROR_DOS(ERRDOS,ERRnomem);
+ /* Realloc the size of parameters and data we will return */
+ params = Realloc(*ppparams, 69);
+ if(params == NULL)
+ return ERROR_DOS(ERRDOS,ERRnomem);
- *ppparams = params;
+ *ppparams = params;
- memset((char *)params,'\0',69);
+ memset((char *)params,'\0',69);
- p = params;
- if (smb_action & EXTENDED_OPLOCK_GRANTED)
- SCVAL(p,0, BATCH_OPLOCK_RETURN);
- else if (LEVEL_II_OPLOCK_TYPE(fsp->oplock_type))
- SCVAL(p,0, LEVEL_II_OPLOCK_RETURN);
- else
- SCVAL(p,0,NO_OPLOCK_RETURN);
+ p = params;
+ if (smb_action & EXTENDED_OPLOCK_GRANTED)
+ SCVAL(p,0, BATCH_OPLOCK_RETURN);
+ else if (LEVEL_II_OPLOCK_TYPE(fsp->oplock_type))
+ SCVAL(p,0, LEVEL_II_OPLOCK_RETURN);
+ else
+ SCVAL(p,0,NO_OPLOCK_RETURN);
- p += 2;
- SSVAL(p,0,fsp->fnum);
- p += 2;
- SIVAL(p,0,smb_action);
- p += 8;
-
- /* Create time. */
- c_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
-
- if (lp_dos_filetime_resolution(SNUM(conn))) {
- c_time &= ~1;
- sbuf.st_atime &= ~1;
- sbuf.st_mtime &= ~1;
- sbuf.st_mtime &= ~1;
- }
+ p += 2;
+ SSVAL(p,0,fsp->fnum);
+ p += 2;
+ SIVAL(p,0,smb_action);
+ p += 8;
- put_long_date(p,c_time);
- p += 8;
- put_long_date(p,sbuf.st_atime); /* access time */
- p += 8;
- put_long_date(p,sbuf.st_mtime); /* write time */
- p += 8;
- put_long_date(p,sbuf.st_mtime); /* change time */
- p += 8;
- SIVAL(p,0,fmode); /* File Attributes. */
- p += 4;
- SOFF_T(p, 0, SMB_ROUNDUP_ALLOCATION(file_len));
- p += 8;
- SOFF_T(p,0,file_len);
-
- DEBUG(5,("call_nt_transact_create: open name = %s\n", fname));
-
- /* Send the required number of replies */
- send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, params, 69, *ppdata, 0);
+ /* Create time. */
+ c_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
- return -1;
+ if (lp_dos_filetime_resolution(SNUM(conn))) {
+ c_time &= ~1;
+ sbuf.st_atime &= ~1;
+ sbuf.st_mtime &= ~1;
+ sbuf.st_mtime &= ~1;
+ }
+
+ put_long_date(p,c_time);
+ p += 8;
+ put_long_date(p,sbuf.st_atime); /* access time */
+ p += 8;
+ put_long_date(p,sbuf.st_mtime); /* write time */
+ p += 8;
+ put_long_date(p,sbuf.st_mtime); /* change time */
+ p += 8;
+ SIVAL(p,0,fmode); /* File Attributes. */
+ p += 4;
+ SOFF_T(p, 0, SMB_ROUNDUP_ALLOCATION(file_len));
+ p += 8;
+ SOFF_T(p,0,file_len);
+
+ DEBUG(5,("call_nt_transact_create: open name = %s\n", fname));
+
+ /* Send the required number of replies */
+ send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, params, 69, *ppdata, 0);
+
+ return -1;
}
/****************************************************************************
@@ -1560,8 +1563,7 @@ static int call_nt_transact_set_security_desc(connection_struct *conn,
uint32 total_data_count = (uint32)IVAL(inbuf, smb_nts_TotalDataCount);
files_struct *fsp = NULL;
uint32 security_info_sent = 0;
- int error_class;
- uint32 error_code;
+ NTSTATUS nt_status;
if(total_parameter_count < 8)
return ERROR_DOS(ERRDOS,ERRbadfunc);
@@ -1577,8 +1579,11 @@ static int call_nt_transact_set_security_desc(connection_struct *conn,
DEBUG(3,("call_nt_transact_set_security_desc: file = %s, sent 0x%x\n", fsp->fsp_name,
(unsigned int)security_info_sent ));
- if (!set_sd( fsp, data, total_data_count, security_info_sent, &error_class, &error_code))
- return ERROR_DOS(error_class, error_code);
+ if (total_data_count == 0)
+ return ERROR_DOS(ERRDOS, ERRbadaccess);
+
+ if (!NT_STATUS_IS_OK(nt_status = set_sd( fsp, data, total_data_count, security_info_sent)))
+ return ERROR_NT(nt_status);
done:
@@ -1589,18 +1594,19 @@ static int call_nt_transact_set_security_desc(connection_struct *conn,
/****************************************************************************
Reply to IOCTL - not implemented - no plans.
****************************************************************************/
+
static int call_nt_transact_ioctl(connection_struct *conn,
char *inbuf, char *outbuf, int length,
int bufsize,
char **ppsetup, char **ppparams, char **ppdata)
{
- static BOOL logged_message = False;
+ static BOOL logged_message = False;
- if(!logged_message) {
- DEBUG(0,("call_nt_transact_ioctl: Currently not implemented.\n"));
- logged_message = True; /* Only print this once... */
- }
- return ERROR_DOS(ERRSRV,ERRnosupport);
+ if(!logged_message) {
+ DEBUG(3,("call_nt_transact_ioctl: Currently not implemented.\n"));
+ logged_message = True; /* Only print this once... */
+ }
+ return ERROR_DOS(ERRSRV,ERRnosupport);
}
/****************************************************************************