r23792: convert Samba4 to GPLv3
[tprouty/samba.git] / source4 / libcli / raw / rawfile.c
index d889b500fb05ab908e291012657672fa8b620afd..60a9bf26569e7d21eea2253c2d657e6193bffa95 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -396,7 +395,7 @@ static struct smbcli_request *smb_raw_t2open_send(struct smbcli_tree *tree,
 ****************************************************************************/
 static NTSTATUS smb_raw_t2open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms)
 {
-       struct smbcli_transport *transport = req?req->transport:NULL;
+       struct smbcli_transport *transport = req->transport;
        struct smb_trans2 t2;
        NTSTATUS status;
 
@@ -545,6 +544,8 @@ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_ope
                        SIVAL(req->out.vwv, VWV(10),parms->openxreadx.in.offset>>32);
                }
                break;
+       case RAW_OPEN_SMB2:
+               return NULL;
        }
 
        if (!smbcli_request_send(req)) {
@@ -680,6 +681,9 @@ NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, unio
                        req->status = NT_STATUS_BUFFER_TOO_SMALL;
                }
                break;
+       case RAW_OPEN_SMB2:
+               req->status = NT_STATUS_INTERNAL_ERROR;
+               break;
        }
 
 failed:
@@ -717,6 +721,9 @@ struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_cl
                SSVAL(req->out.vwv, VWV(0), parms->splclose.in.file.fnum);
                SIVAL(req->out.vwv, VWV(1), 0); /* reserved */
                break;
+
+       case RAW_CLOSE_SMB2:
+               return NULL;
        }
 
        if (!req) return NULL;
@@ -793,7 +800,10 @@ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_loc
                                SIVAL(p, 6, lockp[i].count);
                        }
                }       
+               break;
        }
+       case RAW_LOCK_SMB2:
+               return NULL;
        }
 
        if (!smbcli_request_send(req)) {
@@ -844,14 +854,26 @@ NTSTATUS smb_raw_chkpath(struct smbcli_tree *tree, union smb_chkpath *parms)
 
 /****************************************************************************
  flush a file - async send
- a flush to fnum 0xFFFF will flush all files
+ a flush with RAW_FLUSH_ALL will flush all files
 ****************************************************************************/
 struct smbcli_request *smb_raw_flush_send(struct smbcli_tree *tree, union smb_flush *parms)
 {
        struct smbcli_request *req; 
+       uint16_t fnum=0;
+
+       switch (parms->generic.level) {
+       case RAW_FLUSH_FLUSH:
+               fnum = parms->flush.in.file.fnum;
+               break;
+       case RAW_FLUSH_ALL:
+               fnum = 0xFFFF;
+               break;
+       case RAW_FLUSH_SMB2:
+               return NULL;
+       }
 
        SETUP_REQUEST(SMBflush, 1, 0);
-       SSVAL(req->out.vwv, VWV(0), parms->flush.in.file.fnum);
+       SSVAL(req->out.vwv, VWV(0), fnum);
 
        if (!smbcli_request_send(req)) {
                smbcli_request_destroy(req);