r22522: Print why we can't find these entries.
[Samba.git] / source / libcli / climessage.c
blob010d48c9bb7710d7a3b1e0595c9086664726857e
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>
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 2 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "includes.h"
23 #include "libcli/raw/libcliraw.h"
26 /****************************************************************************
27 start a message sequence
28 ****************************************************************************/
29 BOOL smbcli_message_start(struct smbcli_tree *tree, const char *host, const char *username,
30 int *grp)
32 struct smbcli_request *req;
34 req = smbcli_request_setup(tree, SMBsendstrt, 0, 0);
35 smbcli_req_append_string(req, username, STR_TERMINATE);
36 smbcli_req_append_string(req, host, STR_TERMINATE);
37 if (!smbcli_request_send(req) ||
38 !smbcli_request_receive(req) ||
39 smbcli_is_error(tree)) {
40 smbcli_request_destroy(req);
41 return False;
44 *grp = SVAL(req->in.vwv, VWV(0));
45 smbcli_request_destroy(req);
47 return True;
51 /****************************************************************************
52 send a message
53 ****************************************************************************/
54 BOOL smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
56 struct smbcli_request *req;
58 req = smbcli_request_setup(tree, SMBsendtxt, 1, 0);
59 SSVAL(req->out.vwv, VWV(0), grp);
61 smbcli_req_append_bytes(req, (const uint8_t *)msg, len);
63 if (!smbcli_request_send(req) ||
64 !smbcli_request_receive(req) ||
65 smbcli_is_error(tree)) {
66 smbcli_request_destroy(req);
67 return False;
70 smbcli_request_destroy(req);
71 return True;
74 /****************************************************************************
75 end a message
76 ****************************************************************************/
77 BOOL smbcli_message_end(struct smbcli_tree *tree, int grp)
79 struct smbcli_request *req;
81 req = smbcli_request_setup(tree, SMBsendend, 1, 0);
82 SSVAL(req->out.vwv, VWV(0), grp);
84 if (!smbcli_request_send(req) ||
85 !smbcli_request_receive(req) ||
86 smbcli_is_error(tree)) {
87 smbcli_request_destroy(req);
88 return False;
91 smbcli_request_destroy(req);
92 return True;