r24004: Convert reply_checkpath to the new API
authorVolker Lendecke <vlendec@samba.org>
Mon, 23 Jul 2007 12:03:58 +0000 (12:03 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:28:55 +0000 (12:28 -0500)
(This used to be commit e5c7c6406af5552b3060f03a09b5e6c9a42e531c)

source3/smbd/process.c
source3/smbd/reply.c

index 2cc8b3976b631b8a0a533f1f35022325389dcc5d..41ca060d561547dd95d5f65723a72fc1b3bde723 100644 (file)
@@ -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},
index 725dd416f2fada5c10bea62dfda51cb9e2304f31..fd9fc09e5ac06bfc61f45022389db8ca1aeb92dc 100644 (file)
@@ -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);
 }
 
 /****************************************************************************