Reply to a TRANS2_FINDFIRST.
****************************************************************************/
-static int call_trans2findfirst(connection_struct *conn, char *inbuf, char *outbuf, int bufsize,
- char **pparams, int total_params, char **ppdata, int total_data,
- unsigned int max_data_bytes)
+static void call_trans2findfirst(connection_struct *conn,
+ struct smb_request *req,
+ char **pparams, int total_params,
+ char **ppdata, int total_data,
+ unsigned int max_data_bytes)
{
/* We must be careful here that we don't return more than the
allowed number of data bytes. If this means returning fewer than
NTSTATUS ntstatus = NT_STATUS_OK;
if (total_params < 13) {
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
dirtype = SVAL(params,0);
case SMB_FIND_FILE_UNIX:
case SMB_FIND_FILE_UNIX_INFO2:
if (!lp_unix_extensions()) {
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
break;
default:
- return ERROR_NT(NT_STATUS_INVALID_LEVEL);
+ reply_nterror(req, NT_STATUS_INVALID_LEVEL);
+ return;
}
- srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), directory,
+ srvstr_get_path_wcard(params, req->flags2, directory,
params+12, sizeof(directory), total_params - 12,
STR_TERMINATE, &ntstatus, &mask_contains_wcard);
if (!NT_STATUS_IS_OK(ntstatus)) {
- return ERROR_NT(ntstatus);
+ reply_nterror(req, ntstatus);
+ return;
}
- ntstatus = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES, directory, &mask_contains_wcard);
+ ntstatus = resolve_dfspath_wcard(conn, req->flags2 & FLAGS2_DFS_PATHNAMES, directory, &mask_contains_wcard);
if (!NT_STATUS_IS_OK(ntstatus)) {
if (NT_STATUS_EQUAL(ntstatus,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(ntstatus);
+ reply_nterror(req, ntstatus);
+ return;
}
ntstatus = unix_convert(conn, directory, True, NULL, &sbuf);
if (!NT_STATUS_IS_OK(ntstatus)) {
- return ERROR_NT(ntstatus);
+ reply_nterror(req, ntstatus);
+ return;
}
ntstatus = check_name(conn, directory);
if (!NT_STATUS_IS_OK(ntstatus)) {
- return ERROR_NT(ntstatus);
+ reply_nterror(req, ntstatus);
+ return;
}
p = strrchr_m(directory,'/');
uint32 ea_size;
if (total_data < 4) {
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
ea_size = IVAL(pdata,0);
if (ea_size != total_data) {
DEBUG(4,("call_trans2findfirst: Rejecting EA request with incorrect \
total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pdata,0) ));
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
if (!lp_ea_support(SNUM(conn))) {
- return ERROR_DOS(ERRDOS,ERReasnotsupported);
+ reply_doserror(req, ERRDOS, ERReasnotsupported);
+ return;
}
if ((ea_ctx = talloc_init("findnext_ea_list")) == NULL) {
- return ERROR_NT(NT_STATUS_NO_MEMORY);
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
}
/* Pull out the list of names. */
ea_list = read_ea_name_list(ea_ctx, pdata + 4, ea_size - 4);
if (!ea_list) {
talloc_destroy(ea_ctx);
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
}
*ppdata, max_data_bytes + DIR_ENTRY_SAFETY_MARGIN);
if(*ppdata == NULL ) {
talloc_destroy(ea_ctx);
- return ERROR_NT(NT_STATUS_NO_MEMORY);
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
}
pdata = *ppdata;
data_end = pdata + max_data_bytes + DIR_ENTRY_SAFETY_MARGIN - 1;
*pparams = (char *)SMB_REALLOC(*pparams, 10);
if (*pparams == NULL) {
talloc_destroy(ea_ctx);
- return ERROR_NT(NT_STATUS_NO_MEMORY);
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
}
params = *pparams;
directory,
False,
True,
- SVAL(inbuf,smb_pid),
+ req->smbpid,
mask,
mask_contains_wcard,
dirtype,
if (!NT_STATUS_IS_OK(ntstatus)) {
talloc_destroy(ea_ctx);
- return ERROR_NT(ntstatus);
+ reply_nterror(req, ntstatus);
+ return;
}
dptr_num = dptr_dnum(conn->dirptr);
finished = False;
} else {
finished = !get_lanman2_dir_entry(conn,
- SVAL(outbuf, smb_flg2),
+ req->flags2,
mask,dirtype,info_level,
requires_resume_key,dont_descend,
&p,pdata,data_end,
if(numentries == 0) {
dptr_close(&dptr_num);
if (Protocol < PROTOCOL_NT1) {
- return ERROR_DOS(ERRDOS,ERRnofiles);
+ reply_doserror(req, ERRDOS, ERRnofiles);
+ return;
} else {
- return ERROR_BOTH(NT_STATUS_NO_SUCH_FILE,ERRDOS,ERRbadfile);
+ reply_botherror(req, NT_STATUS_NO_SUCH_FILE,
+ ERRDOS, ERRbadfile);
+ return;
}
}
SSVAL(params,6,0); /* Never an EA error */
SSVAL(params,8,last_entry_off);
- send_trans2_replies(inbuf, outbuf, bufsize, params, 10, pdata, PTR_DIFF(p,pdata), max_data_bytes);
+ send_trans2_replies_new(req, params, 10, pdata, PTR_DIFF(p,pdata),
+ max_data_bytes);
if ((! *directory) && dptr_path(dptr_num))
slprintf(directory,sizeof(directory)-1, "(%s)",dptr_path(dptr_num));
DEBUG( 4, ( "%s mask=%s directory=%s dirtype=%d numentries=%d\n",
- smb_fn_name(CVAL(inbuf,smb_com)),
+ smb_fn_name(CVAL(req->inbuf,smb_com)),
mask, directory, dirtype, numentries ) );
/*
if(!mangle_is_8_3_wildcards( mask, False, conn->params))
mangle_map(mask, True, True, conn->params);
- return(-1);
+ return;
}
/****************************************************************************
case TRANSACT2_FINDFIRST:
{
START_PROFILE(Trans2_findfirst);
- outsize = call_trans2findfirst(
- conn, inbuf, outbuf, bufsize,
- &state->param, state->total_param,
- &state->data, state->total_data,
- state->max_data_return);
+ call_trans2findfirst(conn, req,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return);
END_PROFILE(Trans2_findfirst);
break;
}