2 Unix SMB/CIFS implementation.
3 client message handling routines
4 Copyright (C) Andrew Tridgell 1994-1998
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /****************************************************************************
27 start a message sequence
28 ****************************************************************************/
29 BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
34 /* send a SMBsendstrt command */
35 memset(cli->outbuf,'\0',smb_size);
36 set_message(cli->outbuf,0,0,True);
37 SCVAL(cli->outbuf,smb_com,SMBsendstrt);
38 SSVAL(cli->outbuf,smb_tid,cli->cnum);
39 cli_setup_packet(cli);
41 p = smb_buf(cli->outbuf);
43 p += clistr_push(cli, p, username, -1, STR_TERMINATE);
45 p += clistr_push(cli, p, host, -1, STR_TERMINATE);
47 cli_setup_bcc(cli, p);
51 if (!cli_receive_smb(cli)) {
55 if (cli_is_error(cli)) return False;
57 *grp = SVAL(cli->inbuf,smb_vwv0);
63 /****************************************************************************
65 ****************************************************************************/
66 BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp)
70 memset(cli->outbuf,'\0',smb_size);
71 set_message(cli->outbuf,1,0,True);
72 SCVAL(cli->outbuf,smb_com,SMBsendtxt);
73 SSVAL(cli->outbuf,smb_tid,cli->cnum);
74 cli_setup_packet(cli);
76 SSVAL(cli->outbuf,smb_vwv0,grp);
78 p = smb_buf(cli->outbuf);
80 SSVAL(p,0,len); p += 2;
84 cli_setup_bcc(cli, p);
87 if (!cli_receive_smb(cli)) {
91 if (cli_is_error(cli)) return False;
96 /****************************************************************************
98 ****************************************************************************/
99 BOOL cli_message_end(struct cli_state *cli, int grp)
101 memset(cli->outbuf,'\0',smb_size);
102 set_message(cli->outbuf,1,0,True);
103 SCVAL(cli->outbuf,smb_com,SMBsendend);
104 SSVAL(cli->outbuf,smb_tid,cli->cnum);
106 SSVAL(cli->outbuf,smb_vwv0,grp);
108 cli_setup_packet(cli);
112 if (!cli_receive_smb(cli)) {
116 if (cli_is_error(cli)) return False;