r4069: better error code for SMBwriteBMPX
[samba.git] / source4 / smb_server / reply.c
index 9c7d027f4a1795f156bfcd25bd153c6b6b3c7e54..d81b2bfeefb84479bb0197813efd2fb51073eefd 100644 (file)
@@ -83,7 +83,7 @@ void reply_tcon(struct smbsrv_request *req)
 {
        union smb_tcon con;
        NTSTATUS status;
-       char *p;
+       uint8_t *p;
        
        /* parse request */
        REQ_CHECK_WCT(req, 0);
@@ -126,7 +126,7 @@ void reply_tcon_and_X(struct smbsrv_request *req)
 {
        NTSTATUS status;
        union smb_tcon con;
-       char *p;
+       uint8_t *p;
        uint16_t passlen;
 
        con.tconx.level = RAW_TCON_TCONX;
@@ -556,7 +556,11 @@ void reply_mknew(struct smbsrv_request *req)
        REQ_CHECK_WCT(req, 3);
        REQ_TALLOC(oi, sizeof(*oi));
 
-       oi->mknew.level = RAW_OPEN_MKNEW;
+       if (CVAL(req->in.hdr, HDR_COM) == SMBmknew) {
+               oi->mknew.level = RAW_OPEN_MKNEW;
+       } else {
+               oi->mknew.level = RAW_OPEN_CREATE;
+       }
        oi->mknew.in.attrib  = SVAL(req->in.vwv, VWV(0));
        oi->mknew.in.write_time  = srv_pull_dos_date3(req->smb_conn, req->in.vwv + VWV(1));
 
@@ -592,7 +596,7 @@ static void reply_ctemp_send(struct smbsrv_request *req)
        SSVAL(req->out.vwv, VWV(0), oi->ctemp.out.fnum);
 
        /* the returned filename is relative to the directory */
-       req_push_str(req, NULL, oi->ctemp.out.name, -1, STR_TERMINATE);
+       req_push_str(req, NULL, oi->ctemp.out.name, -1, STR_TERMINATE | STR_ASCII);
 
        req_send_reply(req);
 }
@@ -1621,7 +1625,7 @@ void reply_rmdir(struct smbsrv_request *req)
 void reply_mv(struct smbsrv_request *req)
 {
        union smb_rename *io;
-       char *p;
+       uint8_t *p;
  
        /* parse the request */
        REQ_CHECK_WCT(req, 1);
@@ -1655,7 +1659,7 @@ void reply_mv(struct smbsrv_request *req)
 void reply_ntrename(struct smbsrv_request *req)
 {
        union smb_rename *io;
-       char *p;
+       uint8_t *p;
  
        /* parse the request */
        REQ_CHECK_WCT(req, 4);
@@ -1707,7 +1711,7 @@ static void reply_copy_send(struct smbsrv_request *req)
 void reply_copy(struct smbsrv_request *req)
 {
        struct smb_copy *cp;
-       char *p;
+       uint8_t *p;
 
        /* parse request */
        REQ_CHECK_WCT(req, 3);
@@ -1770,7 +1774,7 @@ void reply_lockingX(struct smbsrv_request *req)
        union smb_lock *lck;
        uint_t total_locks, i;
        uint_t lck_size;
-       char *p;
+       uint8_t *p;
 
        /* parse request */
        REQ_CHECK_WCT(req, 8);
@@ -1879,8 +1883,7 @@ void reply_setattrE(struct smbsrv_request *req)
 ****************************************************************************/
 void reply_writebmpx(struct smbsrv_request *req)
 {
-       /* we will need to implement this one for OS/2, but right now I can't be bothered */
-       req_reply_error(req, NT_STATUS_FOOBAR);
+       req_reply_dos_error(req, ERRSRV, ERRuseSTD);
 }
 
 
@@ -1889,8 +1892,7 @@ void reply_writebmpx(struct smbsrv_request *req)
 ****************************************************************************/
 void reply_writebs(struct smbsrv_request *req)
 {
-       /* see reply_writebmpx */
-       req_reply_error(req, NT_STATUS_FOOBAR);
+       req_reply_dos_error(req, ERRSRV, ERRuseSTD);
 }
 
 
@@ -1949,7 +1951,7 @@ static void reply_sesssetup_old(struct smbsrv_request *req)
 {
        NTSTATUS status;
        union smb_sesssetup sess;
-       char *p;
+       uint8_t *p;
        uint16_t passlen;
 
        sess.old.level = RAW_SESSSETUP_OLD;
@@ -2007,7 +2009,7 @@ static void reply_sesssetup_nt1(struct smbsrv_request *req)
 {
        NTSTATUS status;
        union smb_sesssetup sess;
-       char *p;
+       uint8_t *p;
        uint16_t passlen1, passlen2;
 
        sess.nt1.level = RAW_SESSSETUP_NT1;
@@ -2077,7 +2079,7 @@ static void reply_sesssetup_spnego(struct smbsrv_request *req)
 {
        NTSTATUS status;
        union smb_sesssetup sess;
-       char *p;
+       uint8_t *p;
        uint16_t blob_len;
 
        sess.spnego.level = RAW_SESSSETUP_SPNEGO;
@@ -2290,6 +2292,8 @@ void reply_ntcreate_and_X(struct smbsrv_request *req)
        io->ntcreatex.in.create_options =   IVAL(req->in.vwv, 39);
        io->ntcreatex.in.impersonation =    IVAL(req->in.vwv, 43);
        io->ntcreatex.in.security_flags =   CVAL(req->in.vwv, 47);
+       io->ntcreatex.in.ea_list          = NULL;
+       io->ntcreatex.in.sec_desc         = NULL;
 
        /* we need a neater way to handle this alignment */
        if ((req->flags2 & FLAGS2_UNICODE_STRINGS) && 
@@ -2319,7 +2323,10 @@ void reply_ntcreate_and_X(struct smbsrv_request *req)
 ****************************************************************************/
 void reply_ntcancel(struct smbsrv_request *req)
 {
-       req_reply_error(req, NT_STATUS_FOOBAR);
+       /* NOTE: this request does not generate a reply */
+       req_signing_no_reply(req);
+       ntvfs_cancel(req);
+       req_destroy(req);
 }
 
 /****************************************************************************
@@ -2362,7 +2369,7 @@ void reply_sendtxt(struct smbsrv_request *req)
 void reply_special(struct smbsrv_request *req)
 {
        uint8_t msg_type;
-       char buf[4];
+       uint8_t *buf = talloc_zero_array_p(req, uint8_t, 4);
        
        msg_type = CVAL(req->in.buffer,0);