From 01d5091c26b9edd54023b5d3b0ab00ad93608654 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 23 Jul 2007 12:03:58 +0000 Subject: r24004: Convert reply_checkpath to the new API (This used to be commit e5c7c6406af5552b3060f03a09b5e6c9a42e531c) --- source3/smbd/process.c | 2 +- source3/smbd/reply.c | 39 +++++++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 17 deletions(-) (limited to 'source3') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 2cc8b3976b..41ca060d56 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -650,7 +650,7 @@ static const struct smb_message_struct { /* 0x0d */ { "SMBunlock",reply_unlock,NULL,AS_USER}, /* 0x0e */ { "SMBctemp",reply_ctemp,NULL,AS_USER }, /* 0x0f */ { "SMBmknew",reply_mknew,NULL,AS_USER}, -/* 0x10 */ { "SMBcheckpath",reply_checkpath,NULL,AS_USER}, +/* 0x10 */ { "SMBcheckpath",NULL,reply_checkpath,AS_USER}, /* 0x11 */ { "SMBexit",reply_exit,NULL,DO_CHDIR}, /* 0x12 */ { "SMBlseek",reply_lseek,NULL,AS_USER}, /* 0x13 */ { "SMBlockread",reply_lockread,NULL,AS_USER}, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 725dd416f2..fd9fc09e5a 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -747,33 +747,36 @@ static NTSTATUS map_checkpath_error(const char *inbuf, NTSTATUS status) Reply to a checkpath. ****************************************************************************/ -int reply_checkpath(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) +void reply_checkpath(connection_struct *conn, struct smb_request *req) { - int outsize = 0; pstring name; SMB_STRUCT_STAT sbuf; NTSTATUS status; START_PROFILE(SMBcheckpath); - srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), name, smb_buf(inbuf) + 1, - sizeof(name), 0, STR_TERMINATE, &status); + srvstr_get_path((char *)req->inbuf, req->flags2, name, + smb_buf(req->inbuf) + 1, sizeof(name), 0, + STR_TERMINATE, &status); if (!NT_STATUS_IS_OK(status)) { + status = map_checkpath_error((char *)req->inbuf, status); + reply_nterror(req, status); END_PROFILE(SMBcheckpath); - status = map_checkpath_error(inbuf, status); - return ERROR_NT(status); + return; } - status = resolve_dfspath(conn, SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES, name); + status = resolve_dfspath(conn, req->flags2 & FLAGS2_DFS_PATHNAMES, name); if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { + reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, + ERRSRV, ERRbadpath); END_PROFILE(SMBcheckpath); - return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath); + return; } goto path_err; } - DEBUG(3,("reply_checkpath %s mode=%d\n", name, (int)SVAL(inbuf,smb_vwv0))); + DEBUG(3,("reply_checkpath %s mode=%d\n", name, (int)SVAL(req->inbuf,smb_vwv0))); status = unix_convert(conn, name, False, NULL, &sbuf); if (!NT_STATUS_IS_OK(status)) { @@ -793,14 +796,16 @@ int reply_checkpath(connection_struct *conn, char *inbuf,char *outbuf, int dum_s } if (!S_ISDIR(sbuf.st_mode)) { + reply_botherror(req, NT_STATUS_NOT_A_DIRECTORY, + ERRDOS, ERRbadpath); END_PROFILE(SMBcheckpath); - return ERROR_BOTH(NT_STATUS_NOT_A_DIRECTORY,ERRDOS,ERRbadpath); + return; } - outsize = set_message(inbuf,outbuf,0,0,False); + reply_outbuf(req, 0, 0); END_PROFILE(SMBcheckpath); - return outsize; + return; path_err: @@ -811,8 +816,8 @@ int reply_checkpath(connection_struct *conn, char *inbuf,char *outbuf, int dum_s one at a time - if a component fails it expects ERRbadpath, not ERRbadfile. */ - status = map_checkpath_error(inbuf, status); - if(NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { + status = map_checkpath_error((char *)req->inbuf, status); + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { /* * Windows returns different error codes if * the parent directory is valid but not the @@ -820,10 +825,12 @@ int reply_checkpath(connection_struct *conn, char *inbuf,char *outbuf, int dum_s * for that case and NT_STATUS_OBJECT_PATH_NOT_FOUND * if the path is invalid. */ - return ERROR_BOTH(NT_STATUS_OBJECT_NAME_NOT_FOUND,ERRDOS,ERRbadpath); + reply_botherror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND, + ERRDOS, ERRbadpath); + return; } - return ERROR_NT(status); + reply_nterror(req, status); } /**************************************************************************** -- cgit