LCOV - code coverage report
Current view: top level - source4/libcli - climessage.c (source / functions) Hit Total Coverage
Test: coverage report for master 98b443d9 Lines: 0 42 0.0 %
Date: 2024-05-31 13:13:24 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             :    client message handling routines
       4             :    Copyright (C) Andrew Tridgell 1994-1998
       5             :    Copyright (C) James J Myers 2003  <myersjj@samba.org>
       6             :    
       7             :    This program is free software; you can redistribute it and/or modify
       8             :    it under the terms of the GNU General Public License as published by
       9             :    the Free Software Foundation; either version 3 of the License, or
      10             :    (at your option) any later version.
      11             :    
      12             :    This program is distributed in the hope that it will be useful,
      13             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :    GNU General Public License for more details.
      16             :    
      17             :    You should have received a copy of the GNU General Public License
      18             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : */
      20             : 
      21             : #include "includes.h"
      22             : #include "libcli/raw/libcliraw.h"
      23             : #include "libcli/raw/raw_proto.h"
      24             : #include "libcli/libcli.h"
      25             : 
      26             : 
      27             : /****************************************************************************
      28             : start a message sequence
      29             : ****************************************************************************/
      30           0 : bool smbcli_message_start(struct smbcli_tree *tree, const char *host, const char *username, 
      31             :                        int *grp)
      32             : {
      33           0 :         struct smbcli_request *req; 
      34             :         
      35           0 :         req = smbcli_request_setup(tree, SMBsendstrt, 0, 0);
      36           0 :         if (req == NULL) {
      37           0 :                 return false;
      38             :         }
      39           0 :         smbcli_req_append_string(req, username, STR_TERMINATE);
      40           0 :         smbcli_req_append_string(req, host, STR_TERMINATE);
      41           0 :         if (!smbcli_request_send(req) || 
      42           0 :             !smbcli_request_receive(req) ||
      43           0 :             smbcli_is_error(tree)) {
      44           0 :                 smbcli_request_destroy(req);
      45           0 :                 return false;
      46             :         }
      47             : 
      48           0 :         *grp = SVAL(req->in.vwv, VWV(0));
      49           0 :         smbcli_request_destroy(req);
      50             : 
      51           0 :         return true;
      52             : }
      53             : 
      54             : 
      55             : /****************************************************************************
      56             : send a message 
      57             : ****************************************************************************/
      58           0 : bool smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
      59             : {
      60           0 :         struct smbcli_request *req; 
      61             :         
      62           0 :         req = smbcli_request_setup(tree, SMBsendtxt, 1, 0);
      63           0 :         if (req == NULL) {
      64           0 :                 return false;
      65             :         }
      66           0 :         SSVAL(req->out.vwv, VWV(0), grp);
      67             : 
      68           0 :         smbcli_req_append_bytes(req, (const uint8_t *)msg, len);
      69             : 
      70           0 :         if (!smbcli_request_send(req) || 
      71           0 :             !smbcli_request_receive(req) ||
      72           0 :             smbcli_is_error(tree)) {
      73           0 :                 smbcli_request_destroy(req);
      74           0 :                 return false;
      75             :         }
      76             : 
      77           0 :         smbcli_request_destroy(req);
      78           0 :         return true;
      79             : }      
      80             : 
      81             : /****************************************************************************
      82             : end a message 
      83             : ****************************************************************************/
      84           0 : bool smbcli_message_end(struct smbcli_tree *tree, int grp)
      85             : {
      86           0 :         struct smbcli_request *req; 
      87             :         
      88           0 :         req = smbcli_request_setup(tree, SMBsendend, 1, 0);
      89           0 :         if (req == NULL) {
      90           0 :                 return false;
      91             :         }
      92           0 :         SSVAL(req->out.vwv, VWV(0), grp);
      93             : 
      94           0 :         if (!smbcli_request_send(req) || 
      95           0 :             !smbcli_request_receive(req) ||
      96           0 :             smbcli_is_error(tree)) {
      97           0 :                 smbcli_request_destroy(req);
      98           0 :                 return false;
      99             :         }
     100             : 
     101           0 :         smbcli_request_destroy(req);
     102           0 :         return true;
     103             : }      
     104             : 

Generated by: LCOV version 1.14