****************************************************************************/
static NTSTATUS smb_set_posix_lock(connection_struct *conn,
- char *inbuf,
+ const uint8 *inbuf,
int length,
const char *pdata,
int total_data,
* onto the blocking lock queue.
*/
if(push_blocking_lock_request(br_lck,
- inbuf, length,
+ (char *)inbuf, length,
fsp,
-1, /* infinite timeout. */
0,
Reply to a TRANS2_SETFILEINFO (set file info by fileid or pathname).
****************************************************************************/
-static int call_trans2setfilepathinfo(connection_struct *conn,
- struct smb_request *req,
- char *inbuf, char *outbuf, int length,
- int bufsize,
- unsigned int tran_call,
- char **pparams, int total_params, char **ppdata, int total_data,
- unsigned int max_data_bytes)
+static void call_trans2setfilepathinfo(connection_struct *conn,
+ struct smb_request *req,
+ unsigned int tran_call,
+ char **pparams, int total_params,
+ char **ppdata, int total_data,
+ unsigned int max_data_bytes)
{
char *params = *pparams;
char *pdata = *ppdata;
int data_return_size = 0;
if (!params) {
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
ZERO_STRUCT(sbuf);
if (tran_call == TRANSACT2_SETFILEINFO) {
if (total_params < 4) {
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
fsp = file_fsp(SVAL(params,0));
/* Always do lstat for UNIX calls. */
if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS,ERRbadpath);
+ reply_unixerror(req,ERRDOS,ERRbadpath);
+ return;
}
} else {
if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS,ERRbadpath);
+ reply_unixerror(req,ERRDOS,ERRbadpath);
+ return;
}
}
} else if (fsp && fsp->print_file) {
DEBUG(3,("call_trans2setfilepathinfo: Cancelling print job (%s)\n", fsp->fsp_name ));
SSVAL(params,0,0);
- send_trans2_replies(inbuf, outbuf, bufsize, params, 2, *ppdata, 0, max_data_bytes);
- return(-1);
- } else
- return (UNIXERROR(ERRDOS,ERRbadpath));
+ send_trans2_replies_new(req, params, 2,
+ *ppdata, 0,
+ max_data_bytes);
+ return;
+ }
+ else {
+ reply_unixerror(req, ERRDOS, ERRbadpath);
+ return;
+ }
} else {
/*
* Original code - this is an open file.
*/
- CHECK_FSP(fsp,conn);
+ if (!check_fsp(conn, req, fsp, ¤t_user)) {
+ return;
+ }
pstrcpy(fname, fsp->fsp_name);
if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &sbuf) != 0) {
DEBUG(3,("call_trans2setfilepathinfo: fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno)));
- return(UNIXERROR(ERRDOS,ERRbadfid));
+ reply_unixerror(req, ERRDOS, ERRbadfid);
+ return;
}
}
} else {
/* set path info */
if (total_params < 7) {
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
info_level = SVAL(params,0);
sizeof(fname), total_params - 6, STR_TERMINATE,
&status);
if (!NT_STATUS_IS_OK(status)) {
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
status = resolve_dfspath(conn,
fname);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
- return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath);
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ return;
}
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
status = unix_convert(conn, fname, False, NULL, &sbuf);
if (!NT_STATUS_IS_OK(status)) {
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
status = check_name(conn, fname);
if (!NT_STATUS_IS_OK(status)) {
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
if (INFO_LEVEL_IS_UNIX(info_level)) {
} else if (!VALID_STAT(sbuf) && SMB_VFS_STAT(conn,fname,&sbuf)) {
DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
- return UNIXERROR(ERRDOS,ERRbadpath);
+ reply_unixerror(req, ERRDOS, ERRbadpath);
+ return;
}
}
if (!CAN_WRITE(conn)) {
- return ERROR_DOS(ERRSRV,ERRaccess);
+ reply_doserror(req, ERRSRV, ERRaccess);
+ return;
}
if (INFO_LEVEL_IS_UNIX(info_level) && !lp_unix_extensions()) {
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
DEBUG(3,("call_trans2setfilepathinfo(%d) %s (fnum %d) info_level=%d totdata=%d\n",
/* Realloc the parameter size */
*pparams = (char *)SMB_REALLOC(*pparams,2);
if (*pparams == NULL) {
- return ERROR_NT(NT_STATUS_NO_MEMORY);
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
}
params = *pparams;
{
if (tran_call != TRANSACT2_SETPATHINFO) {
/* We must have a pathname for this. */
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
status = smb_set_file_unix_link(conn, req, pdata,
total_data, fname);
{
if (tran_call != TRANSACT2_SETPATHINFO) {
/* We must have a pathname for this. */
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
status = smb_set_file_unix_hlink(conn, req,
pdata, total_data,
case SMB_SET_POSIX_LOCK:
{
if (tran_call != TRANSACT2_SETFILEINFO) {
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
- status = smb_set_posix_lock(conn,
- inbuf,
- length,
- pdata,
- total_data,
- fsp);
+ status = smb_set_posix_lock(conn, req->inbuf,
+ smb_len(req->inbuf) + 4,
+ pdata, total_data, fsp);
break;
}
{
if (tran_call != TRANSACT2_SETPATHINFO) {
/* We must have a pathname for this. */
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
status = smb_posix_open(conn, req,
{
if (tran_call != TRANSACT2_SETPATHINFO) {
/* We must have a pathname for this. */
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
status = smb_posix_unlink(conn, req,
}
default:
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->mid)) {
/* We have re-scheduled this call. */
- return -1;
+ return;
}
if (blocking_lock_was_deferred(req->mid)) {
/* We have re-scheduled this call. */
- return -1;
+ return;
}
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
- return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath);
+ reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ return;
}
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
SSVAL(params,0,0);
- send_trans2_replies(inbuf, outbuf, bufsize, params, 2, *ppdata, data_return_size, max_data_bytes);
+ send_trans2_replies_new(req, params, 2, *ppdata, data_return_size,
+ max_data_bytes);
- return -1;
+ return;
}
/****************************************************************************
case TRANSACT2_SETFILEINFO:
{
START_PROFILE(Trans2_setpathinfo);
- outsize = call_trans2setfilepathinfo(
- conn, req, inbuf, outbuf, size, bufsize, state->call,
- &state->param, state->total_param,
- &state->data, state->total_data,
- state->max_data_return);
+ call_trans2setfilepathinfo(conn, req, state->call,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return);
END_PROFILE(Trans2_setpathinfo);
break;
}