1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r24088: Convert reply_unlink to the new API

(This used to be commit fb0a1b7bd0)
This commit is contained in:
Volker Lendecke 2007-07-31 07:57:33 +00:00 committed by Gerald (Jerry) Carter
parent e198b9d167
commit 4254af7180
2 changed files with 35 additions and 25 deletions

View File

@ -640,7 +640,7 @@ static const struct smb_message_struct {
/* 0x03 */ { "SMBcreate",reply_mknew,NULL,AS_USER}, /* 0x03 */ { "SMBcreate",reply_mknew,NULL,AS_USER},
/* 0x04 */ { "SMBclose",NULL,reply_close,AS_USER | CAN_IPC }, /* 0x04 */ { "SMBclose",NULL,reply_close,AS_USER | CAN_IPC },
/* 0x05 */ { "SMBflush",reply_flush,NULL,AS_USER}, /* 0x05 */ { "SMBflush",reply_flush,NULL,AS_USER},
/* 0x06 */ { "SMBunlink",reply_unlink,NULL,AS_USER | NEED_WRITE }, /* 0x06 */ { "SMBunlink",NULL,reply_unlink,AS_USER | NEED_WRITE },
/* 0x07 */ { "SMBmv",reply_mv,NULL,AS_USER | NEED_WRITE }, /* 0x07 */ { "SMBmv",reply_mv,NULL,AS_USER | NEED_WRITE },
/* 0x08 */ { "SMBgetatr",reply_getatr,NULL,AS_USER}, /* 0x08 */ { "SMBgetatr",reply_getatr,NULL,AS_USER},
/* 0x09 */ { "SMBsetatr",reply_setatr,NULL,AS_USER | NEED_WRITE}, /* 0x09 */ { "SMBsetatr",reply_setatr,NULL,AS_USER | NEED_WRITE},

View File

@ -2222,56 +2222,66 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
Reply to a unlink Reply to a unlink
****************************************************************************/ ****************************************************************************/
int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, void reply_unlink(connection_struct *conn, struct smb_request *req)
int dum_buffsize)
{ {
int outsize = 0;
pstring name; pstring name;
uint32 dirtype; uint32 dirtype;
NTSTATUS status; NTSTATUS status;
BOOL path_contains_wcard = False; BOOL path_contains_wcard = False;
struct smb_request req;
START_PROFILE(SMBunlink); START_PROFILE(SMBunlink);
init_smb_request(&req, (uint8 *)inbuf); if (req->wct < 1) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
dirtype = SVAL(inbuf,smb_vwv0);
srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name,
smb_buf(inbuf) + 1, sizeof(name), 0,
STR_TERMINATE, &status, &path_contains_wcard);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBunlink); END_PROFILE(SMBunlink);
return ERROR_NT(status); return;
} }
status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES, name, &path_contains_wcard); dirtype = SVAL(req->inbuf,smb_vwv0);
srvstr_get_path_wcard((char *)req->inbuf, req->flags2, name,
smb_buf(req->inbuf) + 1, sizeof(name), 0,
STR_TERMINATE, &status, &path_contains_wcard);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
END_PROFILE(SMBunlink); END_PROFILE(SMBunlink);
return;
}
status = resolve_dfspath_wcard(conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
name, &path_contains_wcard);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { 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);
END_PROFILE(SMBunlink);
return;
} }
return ERROR_NT(status); reply_nterror(req, status);
END_PROFILE(SMBunlink);
return;
} }
DEBUG(3,("reply_unlink : %s\n",name)); DEBUG(3,("reply_unlink : %s\n",name));
status = unlink_internals(conn, &req, dirtype, name, status = unlink_internals(conn, req, dirtype, name,
path_contains_wcard); path_contains_wcard);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBunlink); if (open_was_deferred(req->mid)) {
if (open_was_deferred(SVAL(inbuf,smb_mid))) {
/* We have re-scheduled this call. */ /* We have re-scheduled this call. */
return -1; END_PROFILE(SMBunlink);
return;
} }
return ERROR_NT(status); reply_nterror(req, status);
END_PROFILE(SMBunlink);
return;
} }
outsize = set_message(inbuf,outbuf,0,0,False); reply_outbuf(req, 0, 0);
END_PROFILE(SMBunlink); END_PROFILE(SMBunlink);
return outsize;
return;
} }
/**************************************************************************** /****************************************************************************