summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-01 01:03:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:07 -0500
commit9f1210a243654fd6d94acdef83f468a33c1b3b3f (patch)
tree83ec67226d43c456a1f7facec38ce22e35d5e5d3
parent86a2844bfc9d7ffbb36e69cc92d327e5505f19d2 (diff)
downloadsamba-9f1210a243654fd6d94acdef83f468a33c1b3b3f.tar.gz
samba-9f1210a243654fd6d94acdef83f468a33c1b3b3f.tar.bz2
samba-9f1210a243654fd6d94acdef83f468a33c1b3b3f.zip
r3419: moved the libcli/raw structures into libcli/raw/libcliraw.h
and made them private (This used to be commit 386ac565c452ede1d74e06acb401ca9db99d3ff3)
-rw-r--r--source4/client/client.c2
-rw-r--r--source4/include/cli_context.h268
-rw-r--r--source4/libcli/cliconnect.c1
-rw-r--r--source4/libcli/clifile.c1
-rw-r--r--source4/libcli/clilist.c1
-rw-r--r--source4/libcli/climessage.c1
-rw-r--r--source4/libcli/clireadwrite.c1
-rw-r--r--source4/libcli/raw/clioplock.c1
-rw-r--r--source4/libcli/raw/clisession.c1
-rw-r--r--source4/libcli/raw/clisocket.c1
-rw-r--r--source4/libcli/raw/clitransport.c1
-rw-r--r--source4/libcli/raw/clitree.c1
-rw-r--r--source4/libcli/raw/libcliraw.h286
-rw-r--r--source4/libcli/raw/rawacl.c1
-rw-r--r--source4/libcli/raw/rawdate.c1
-rw-r--r--source4/libcli/raw/raweas.c1
-rw-r--r--source4/libcli/raw/rawfile.c1
-rw-r--r--source4/libcli/raw/rawfileinfo.c1
-rw-r--r--source4/libcli/raw/rawfsinfo.c1
-rw-r--r--source4/libcli/raw/rawioctl.c1
-rw-r--r--source4/libcli/raw/rawnegotiate.c1
-rw-r--r--source4/libcli/raw/rawnotify.c1
-rw-r--r--source4/libcli/raw/rawreadwrite.c1
-rw-r--r--source4/libcli/raw/rawrequest.c1
-rw-r--r--source4/libcli/raw/rawsearch.c1
-rw-r--r--source4/libcli/raw/rawsetfileinfo.c1
-rw-r--r--source4/libcli/raw/rawtrans.c1
-rw-r--r--source4/libcli/raw/smb_signing.c1
-rw-r--r--source4/libcli/util/clierror.c1
-rw-r--r--source4/libcli/util/cliutil.c2
-rw-r--r--source4/librpc/rpc/dcerpc_smb.c1
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c1
-rw-r--r--source4/torture/basic/denytest.c1
-rw-r--r--source4/torture/basic/locking.c1
-rw-r--r--source4/torture/basic/scanner.c1
-rw-r--r--source4/torture/basic/secleak.c1
-rw-r--r--source4/torture/gentest.c1
-rw-r--r--source4/torture/masktest.c1
-rw-r--r--source4/torture/raw/context.c1
-rw-r--r--source4/torture/raw/lock.c1
-rw-r--r--source4/torture/raw/mux.c1
-rw-r--r--source4/torture/raw/open.c1
-rw-r--r--source4/torture/raw/qfileinfo.c1
-rw-r--r--source4/torture/raw/qfsinfo.c1
-rw-r--r--source4/torture/raw/read.c1
-rw-r--r--source4/torture/raw/search.c1
-rw-r--r--source4/torture/raw/write.c1
-rw-r--r--source4/torture/torture.c1
-rw-r--r--source4/torture/torture_util.c1
49 files changed, 336 insertions, 267 deletions
diff --git a/source4/client/client.c b/source4/client/client.c
index dce99a7833..3958f078e5 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -22,6 +22,8 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
+
#ifndef REGISTER
#define REGISTER 0
#endif
diff --git a/source4/include/cli_context.h b/source4/include/cli_context.h
index 06d7469b70..a69cb93aa8 100644
--- a/source4/include/cli_context.h
+++ b/source4/include/cli_context.h
@@ -1,9 +1,7 @@
/*
Unix SMB/CIFS implementation.
SMB parameters and setup
- Copyright (C) Andrew Tridgell 1992-1998
- Copyright (C) Luke Kenneth Casson Leighton 1996-1998
- Copyright (C) Jeremy Allison 1998
+ Copyright (C) Andrew Tridgell 2004
Copyright (C) James Myers 2003 <myersjj@samba.org>
This program is free software; you can redistribute it and/or modify
@@ -24,257 +22,6 @@
#ifndef _SMBCLI_CONTEXT_H
#define _SMBCLI_CONTEXT_H
-struct smbcli_tree; /* forward declare */
-struct smbcli_request; /* forward declare */
-struct smbcli_session; /* forward declare */
-struct smbcli_transport; /* forward declare */
-
-/* context that will be and has been negotiated between the client and server */
-struct smbcli_negotiate {
- /*
- * negotiated maximum transmit size - this is given to us by the server
- */
- uint32_t max_xmit;
-
- /* maximum number of requests that can be multiplexed */
- uint16_t max_mux;
-
- /* the negotiatiated protocol */
- enum protocol_types protocol;
-
- uint8_t sec_mode; /* security mode returned by negprot */
- uint8_t key_len;
- DATA_BLOB server_guid; /* server_guid */
- DATA_BLOB secblob; /* cryptkey or negTokenInit blob */
- uint32_t sesskey;
-
- struct smb_signing_context sign_info;
-
- /* capabilities that the server reported */
- uint32_t capabilities;
-
- int server_zone;
- time_t server_time;
- uint_t readbraw_supported:1;
- uint_t writebraw_supported:1;
-
- char *server_domain;
-};
-
-/* this is the context for a SMB socket associated with the socket itself */
-struct smbcli_socket {
- struct in_addr dest_ip;
- /* dest hostname (which may or may not be a DNS name) */
- char *hostname;
-
- /* the port used */
- int port;
-
- struct socket_context *sock;
-
- /* a count of the number of packets we have received. We
- * actually only care about zero/non-zero at this stage */
- uint_t pkt_count;
-
- /* the network address of the client */
- char *client_addr;
-
- /* timeout for socket operations in milliseconds. */
- int timeout;
-};
-
-/*
- this structure allows applications to control the behaviour of the
- client library
-*/
-struct smbcli_options {
- uint_t use_oplocks:1;
- uint_t use_level2_oplocks:1;
- uint_t use_spnego:1;
- uint32_t max_xmit;
- uint16_t max_mux;
-};
-
-/* this is the context for the client transport layer */
-struct smbcli_transport {
- /* socket level info */
- struct smbcli_socket *socket;
-
- /* the next mid to be allocated - needed for signing and
- request matching */
- uint16_t next_mid;
-
- /* negotiated protocol information */
- struct smbcli_negotiate negotiate;
-
- /* options to control the behaviour of the client code */
- struct smbcli_options options;
-
- /* is a readbraw pending? we need to handle that case
- specially on receiving packets */
- uint_t readbraw_pending:1;
-
- /* an idle function - if this is defined then it will be
- called once every period seconds while we are waiting
- for a packet */
- struct {
- void (*func)(struct smbcli_transport *, void *);
- void *private;
- uint_t period;
- } idle;
-
- /* the error fields from the last message */
- struct {
- enum {ETYPE_NONE, ETYPE_DOS, ETYPE_NT, ETYPE_SOCKET, ETYPE_NBT} etype;
- union {
- struct {
- uint8_t eclass;
- uint16_t ecode;
- } dos;
- NTSTATUS nt_status;
- enum {SOCKET_READ_TIMEOUT,
- SOCKET_READ_EOF,
- SOCKET_READ_ERROR,
- SOCKET_WRITE_ERROR,
- SOCKET_READ_BAD_SIG} socket_error;
- uint_t nbt_error;
- } e;
- } error;
-
- struct {
- /* a oplock break request handler */
- BOOL (*handler)(struct smbcli_transport *transport,
- uint16_t tid, uint16_t fnum, uint8_t level, void *private);
- /* private data passed to the oplock handler */
- void *private;
- } oplock;
-
- /* a list of async requests that are pending for send on this connection */
- struct smbcli_request *pending_send;
-
- /* a list of async requests that are pending for receive on this connection */
- struct smbcli_request *pending_recv;
-
- /* remember the called name - some sub-protocols require us to
- know the server name */
- struct nmb_name called;
-
- /* a buffer for partially received SMB packets. */
- struct {
- uint8_t header[NBT_HDR_SIZE];
- size_t req_size;
- size_t received;
- uint8_t *buffer;
- } recv_buffer;
-
- /* the event handle for waiting for socket IO */
- struct {
- struct event_context *ctx;
- struct fd_event *fde;
- struct timed_event *te;
- } event;
-};
-
-/* this is the context for the user */
-
-/* this is the context for the session layer */
-struct smbcli_session {
- /* transport layer info */
- struct smbcli_transport *transport;
-
- /* after a session setup the server provides us with
- a vuid identifying the security context */
- uint16_t vuid;
-
- /* default pid for this session */
- uint32_t pid;
-
- /* the flags2 for each packet - this allows
- the user to control these for torture testing */
- uint16_t flags2;
-
- DATA_BLOB user_session_key;
-
- /* the spnego context if we use extented security */
- struct gensec_security *gensec;
-};
-
-/*
- smbcli_tree context: internal state for a tree connection.
- */
-struct smbcli_tree {
- /* session layer info */
- struct smbcli_session *session;
-
- uint16_t tid; /* tree id, aka cnum */
- char *device;
- char *fs_type;
-};
-
-
-/*
- a client request moves between the following 4 states.
-*/
-enum smbcli_request_state {SMBCLI_REQUEST_INIT, /* we are creating the request */
- SMBCLI_REQUEST_SEND, /* the request is in the outgoing socket Q */
- SMBCLI_REQUEST_RECV, /* we are waiting for a matching reply */
- SMBCLI_REQUEST_DONE, /* the request is finished */
- SMBCLI_REQUEST_ERROR}; /* a packet or transport level error has occurred */
-
-/* the context for a single SMB request. This is passed to any request-context
- * functions (similar to context.h, the server version).
- * This will allow requests to be multi-threaded. */
-struct smbcli_request {
- /* allow a request to be part of a list of requests */
- struct smbcli_request *next, *prev;
-
- /* each request is in one of 4 possible states */
- enum smbcli_request_state state;
-
- /* a request always has a transport context, nearly always has
- a session context and usually has a tree context */
- struct smbcli_transport *transport;
- struct smbcli_session *session;
- struct smbcli_tree *tree;
-
- /* the flags2 from the SMB request, in raw form (host byte
- order). Used to parse strings */
- uint16_t flags2;
-
- /* the NT status for this request. Set by packet receive code
- or code detecting error. */
- NTSTATUS status;
-
- /* the sequence number of this packet - used for signing */
- uint_t seq_num;
-
- /* set if this is a one-way request, meaning we are not
- expecting a reply from the server. */
- uint_t one_way_request:1;
-
- /* set this when the request should only increment the signing
- counter by one */
- uint_t sign_single_increment:1;
-
- /* the mid of this packet - used to match replies */
- uint16_t mid;
-
- struct request_buffer in;
- struct request_buffer out;
-
- /* information on what to do with a reply when it is received
- asyncronously. If this is not setup when a reply is received then
- the reply is discarded
-
- The private pointer is private to the caller of the client
- library (the application), not private to the library
- */
- struct {
- void (*fn)(struct smbcli_request *);
- void *private;
- } async;
-};
-
/*
smbcli_state: internal state used in libcli library for single-threaded callers,
i.e. a single session on a single socket.
@@ -286,17 +33,4 @@ struct smbcli_state {
struct substitute_context substitute;
};
-/* useful way of catching wct errors with file and line number */
-#define SMBCLI_CHECK_MIN_WCT(req, wcount) if ((req)->in.wct < (wcount)) { \
- DEBUG(1,("Unexpected WCT %d at %s(%d) - expected min %d\n", (req)->in.wct, __FILE__, __LINE__, wcount)); \
- req->status = NT_STATUS_INVALID_PARAMETER; \
- goto failed; \
-}
-
-#define SMBCLI_CHECK_WCT(req, wcount) if ((req)->in.wct != (wcount)) { \
- DEBUG(1,("Unexpected WCT %d at %s(%d) - expected %d\n", (req)->in.wct, __FILE__, __LINE__, wcount)); \
- req->status = NT_STATUS_INVALID_PARAMETER; \
- goto failed; \
-}
-
#endif /* _SMBCLI_CONTEXT_H */
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index 8e7e128a4e..c3bc43aa8c 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/*
wrapper around smbcli_sock_connect()
diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c
index e8b49f71df..b233064085 100644
--- a/source4/libcli/clifile.c
+++ b/source4/libcli/clifile.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
Hard/Symlink a file (UNIX extensions).
diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c
index 84d96d62f4..dde2a7befa 100644
--- a/source4/libcli/clilist.c
+++ b/source4/libcli/clilist.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
struct search_private {
file_info *dirlist;
diff --git a/source4/libcli/climessage.c b/source4/libcli/climessage.c
index dde512159e..7e3a50b842 100644
--- a/source4/libcli/climessage.c
+++ b/source4/libcli/climessage.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
diff --git a/source4/libcli/clireadwrite.c b/source4/libcli/clireadwrite.c
index f8220526e3..6b6cb2f2a2 100644
--- a/source4/libcli/clireadwrite.c
+++ b/source4/libcli/clireadwrite.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
Read size bytes at offset offset using SMBreadX.
diff --git a/source4/libcli/raw/clioplock.c b/source4/libcli/raw/clioplock.c
index 6ae21a08f4..f26aa0c5f2 100644
--- a/source4/libcli/raw/clioplock.c
+++ b/source4/libcli/raw/clioplock.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
send an ack for an oplock break request
diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c
index 9c73c07831..14018f676c 100644
--- a/source4/libcli/raw/clisession.c
+++ b/source4/libcli/raw/clisession.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define SETUP_REQUEST_SESSION(cmd, wct, buflen) do { \
req = smbcli_request_setup_session(session, cmd, wct, buflen); \
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index 907206a5e8..c641f8bf12 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/*
create a smbcli_socket context
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 9d2dd49985..a6e8071a05 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
static void smbcli_transport_process_recv(struct smbcli_transport *transport);
diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c
index 77fe0ebe2f..daa8549099 100644
--- a/source4/libcli/raw/clitree.c
+++ b/source4/libcli/raw/clitree.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define SETUP_REQUEST_TREE(cmd, wct, buflen) do { \
req = smbcli_request_setup(tree, cmd, wct, buflen); \
diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h
new file mode 100644
index 0000000000..48abc82a68
--- /dev/null
+++ b/source4/libcli/raw/libcliraw.h
@@ -0,0 +1,286 @@
+/*
+ Unix SMB/CIFS implementation.
+ SMB parameters and setup
+ Copyright (C) Andrew Tridgell 1992-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1996-1998
+ Copyright (C) Jeremy Allison 1998
+ Copyright (C) James Myers 2003 <myersjj@samba.org>
+
+ 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
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 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.
+*/
+
+struct smbcli_tree; /* forward declare */
+struct smbcli_request; /* forward declare */
+struct smbcli_session; /* forward declare */
+struct smbcli_transport; /* forward declare */
+
+/* context that will be and has been negotiated between the client and server */
+struct smbcli_negotiate {
+ /*
+ * negotiated maximum transmit size - this is given to us by the server
+ */
+ uint32_t max_xmit;
+
+ /* maximum number of requests that can be multiplexed */
+ uint16_t max_mux;
+
+ /* the negotiatiated protocol */
+ enum protocol_types protocol;
+
+ uint8_t sec_mode; /* security mode returned by negprot */
+ uint8_t key_len;
+ DATA_BLOB server_guid; /* server_guid */
+ DATA_BLOB secblob; /* cryptkey or negTokenInit blob */
+ uint32_t sesskey;
+
+ struct smb_signing_context sign_info;
+
+ /* capabilities that the server reported */
+ uint32_t capabilities;
+
+ int server_zone;
+ time_t server_time;
+ uint_t readbraw_supported:1;
+ uint_t writebraw_supported:1;
+
+ char *server_domain;
+};
+
+/* this is the context for a SMB socket associated with the socket itself */
+struct smbcli_socket {
+ struct in_addr dest_ip;
+ /* dest hostname (which may or may not be a DNS name) */
+ char *hostname;
+
+ /* the port used */
+ int port;
+
+ struct socket_context *sock;
+
+ /* a count of the number of packets we have received. We
+ * actually only care about zero/non-zero at this stage */
+ uint_t pkt_count;
+
+ /* the network address of the client */
+ char *client_addr;
+
+ /* timeout for socket operations in milliseconds. */
+ int timeout;
+};
+
+/*
+ this structure allows applications to control the behaviour of the
+ client library
+*/
+struct smbcli_options {
+ uint_t use_oplocks:1;
+ uint_t use_level2_oplocks:1;
+ uint_t use_spnego:1;
+ uint32_t max_xmit;
+ uint16_t max_mux;
+};
+
+/* this is the context for the client transport layer */
+struct smbcli_transport {
+ /* socket level info */
+ struct smbcli_socket *socket;
+
+ /* the next mid to be allocated - needed for signing and
+ request matching */
+ uint16_t next_mid;
+
+ /* negotiated protocol information */
+ struct smbcli_negotiate negotiate;
+
+ /* options to control the behaviour of the client code */
+ struct smbcli_options options;
+
+ /* is a readbraw pending? we need to handle that case
+ specially on receiving packets */
+ uint_t readbraw_pending:1;
+
+ /* an idle function - if this is defined then it will be
+ called once every period seconds while we are waiting
+ for a packet */
+ struct {
+ void (*func)(struct smbcli_transport *, void *);
+ void *private;
+ uint_t period;
+ } idle;
+
+ /* the error fields from the last message */
+ struct {
+ enum {ETYPE_NONE, ETYPE_DOS, ETYPE_NT, ETYPE_SOCKET, ETYPE_NBT} etype;
+ union {
+ struct {
+ uint8_t eclass;
+ uint16_t ecode;
+ } dos;
+ NTSTATUS nt_status;
+ enum {SOCKET_READ_TIMEOUT,
+ SOCKET_READ_EOF,
+ SOCKET_READ_ERROR,
+ SOCKET_WRITE_ERROR,
+ SOCKET_READ_BAD_SIG} socket_error;
+ uint_t nbt_error;
+ } e;
+ } error;
+
+ struct {
+ /* a oplock break request handler */
+ BOOL (*handler)(struct smbcli_transport *transport,
+ uint16_t tid, uint16_t fnum, uint8_t level, void *private);
+ /* private data passed to the oplock handler */
+ void *private;
+ } oplock;
+
+ /* a list of async requests that are pending for send on this connection */
+ struct smbcli_request *pending_send;
+
+ /* a list of async requests that are pending for receive on this connection */
+ struct smbcli_request *pending_recv;
+
+ /* remember the called name - some sub-protocols require us to
+ know the server name */
+ struct nmb_name called;
+
+ /* a buffer for partially received SMB packets. */
+ struct {
+ uint8_t header[NBT_HDR_SIZE];
+ size_t req_size;
+ size_t received;
+ uint8_t *buffer;
+ } recv_buffer;
+
+ /* the event handle for waiting for socket IO */
+ struct {
+ struct event_context *ctx;
+ struct fd_event *fde;
+ struct timed_event *te;
+ } event;
+};
+
+/* this is the context for the user */
+
+/* this is the context for the session layer */
+struct smbcli_session {
+ /* transport layer info */
+ struct smbcli_transport *transport;
+
+ /* after a session setup the server provides us with
+ a vuid identifying the security context */
+ uint16_t vuid;
+
+ /* default pid for this session */
+ uint32_t pid;
+
+ /* the flags2 for each packet - this allows
+ the user to control these for torture testing */
+ uint16_t flags2;
+
+ DATA_BLOB user_session_key;
+
+ /* the spnego context if we use extented security */
+ struct gensec_security *gensec;
+};
+
+/*
+ smbcli_tree context: internal state for a tree connection.
+ */
+struct smbcli_tree {
+ /* session layer info */
+ struct smbcli_session *session;
+
+ uint16_t tid; /* tree id, aka cnum */
+ char *device;
+ char *fs_type;
+};
+
+
+/*
+ a client request moves between the following 4 states.
+*/
+enum smbcli_request_state {SMBCLI_REQUEST_INIT, /* we are creating the request */
+ SMBCLI_REQUEST_SEND, /* the request is in the outgoing socket Q */
+ SMBCLI_REQUEST_RECV, /* we are waiting for a matching reply */
+ SMBCLI_REQUEST_DONE, /* the request is finished */
+ SMBCLI_REQUEST_ERROR}; /* a packet or transport level error has occurred */
+
+/* the context for a single SMB request. This is passed to any request-context
+ * functions (similar to context.h, the server version).
+ * This will allow requests to be multi-threaded. */
+struct smbcli_request {
+ /* allow a request to be part of a list of requests */
+ struct smbcli_request *next, *prev;
+
+ /* each request is in one of 4 possible states */
+ enum smbcli_request_state state;
+
+ /* a request always has a transport context, nearly always has
+ a session context and usually has a tree context */
+ struct smbcli_transport *transport;
+ struct smbcli_session *session;
+ struct smbcli_tree *tree;
+
+ /* the flags2 from the SMB request, in raw form (host byte
+ order). Used to parse strings */
+ uint16_t flags2;
+
+ /* the NT status for this request. Set by packet receive code
+ or code detecting error. */
+ NTSTATUS status;
+
+ /* the sequence number of this packet - used for signing */
+ uint_t seq_num;
+
+ /* set if this is a one-way request, meaning we are not
+ expecting a reply from the server. */
+ uint_t one_way_request:1;
+
+ /* set this when the request should only increment the signing
+ counter by one */
+ uint_t sign_single_increment:1;
+
+ /* the mid of this packet - used to match replies */
+ uint16_t mid;
+
+ struct request_buffer in;
+ struct request_buffer out;
+
+ /* information on what to do with a reply when it is received
+ asyncronously. If this is not setup when a reply is received then
+ the reply is discarded
+
+ The private pointer is private to the caller of the client
+ library (the application), not private to the library
+ */
+ struct {
+ void (*fn)(struct smbcli_request *);
+ void *private;
+ } async;
+};
+
+/* useful way of catching wct errors with file and line number */
+#define SMBCLI_CHECK_MIN_WCT(req, wcount) if ((req)->in.wct < (wcount)) { \
+ DEBUG(1,("Unexpected WCT %d at %s(%d) - expected min %d\n", (req)->in.wct, __FILE__, __LINE__, wcount)); \
+ req->status = NT_STATUS_INVALID_PARAMETER; \
+ goto failed; \
+}
+
+#define SMBCLI_CHECK_WCT(req, wcount) if ((req)->in.wct != (wcount)) { \
+ DEBUG(1,("Unexpected WCT %d at %s(%d) - expected %d\n", (req)->in.wct, __FILE__, __LINE__, wcount)); \
+ req->status = NT_STATUS_INVALID_PARAMETER; \
+ goto failed; \
+}
diff --git a/source4/libcli/raw/rawacl.c b/source4/libcli/raw/rawacl.c
index 9b4f2db3b2..35c7ce2049 100644
--- a/source4/libcli/raw/rawacl.c
+++ b/source4/libcli/raw/rawacl.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
fetch file ACL (async send)
diff --git a/source4/libcli/raw/rawdate.c b/source4/libcli/raw/rawdate.c
index bfb7465bd5..db18a7a194 100644
--- a/source4/libcli/raw/rawdate.c
+++ b/source4/libcli/raw/rawdate.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/*******************************************************************
put a dos date into a buffer (time/date format)
diff --git a/source4/libcli/raw/raweas.c b/source4/libcli/raw/raweas.c
index e07fbcd288..da079c402b 100644
--- a/source4/libcli/raw/raweas.c
+++ b/source4/libcli/raw/raweas.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/*
work out how many bytes on the wire a ea list will consume.
diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c
index 3eb2ab49b2..92b995dd4a 100644
--- a/source4/libcli/raw/rawfile.c
+++ b/source4/libcli/raw/rawfile.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define SETUP_REQUEST(cmd, wct, buflen) do { \
req = smbcli_request_setup(tree, cmd, wct, buflen); \
diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c
index a0ee7891bf..c844f923b8 100644
--- a/source4/libcli/raw/rawfileinfo.c
+++ b/source4/libcli/raw/rawfileinfo.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/* local macros to make the code more readable */
#define FINFO_CHECK_MIN_SIZE(size) if (blob->length < (size)) { \
diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c
index 49378887fa..7cec93b6bc 100644
--- a/source4/libcli/raw/rawfsinfo.c
+++ b/source4/libcli/raw/rawfsinfo.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
Query FS Info - SMBdskattr call (async send)
diff --git a/source4/libcli/raw/rawioctl.c b/source4/libcli/raw/rawioctl.c
index 798300451b..874d055013 100644
--- a/source4/libcli/raw/rawioctl.c
+++ b/source4/libcli/raw/rawioctl.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define SETUP_REQUEST(cmd, wct, buflen) do { \
req = smbcli_request_setup(tree, cmd, wct, buflen); \
diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c
index f99b9741f4..da7bcabda9 100644
--- a/source4/libcli/raw/rawnegotiate.c
+++ b/source4/libcli/raw/rawnegotiate.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
static const struct {
enum protocol_types prot;
diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c
index 47553e735e..ea5fada1ee 100644
--- a/source4/libcli/raw/rawnotify.c
+++ b/source4/libcli/raw/rawnotify.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
change notify (async send)
diff --git a/source4/libcli/raw/rawreadwrite.c b/source4/libcli/raw/rawreadwrite.c
index bc9730f33d..4978514d26 100644
--- a/source4/libcli/raw/rawreadwrite.c
+++ b/source4/libcli/raw/rawreadwrite.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define SETUP_REQUEST(cmd, wct, buflen) do { \
req = smbcli_request_setup(tree, cmd, wct, buflen); \
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index 26604cbcd4..5cf1621d2d 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -24,6 +24,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/* we over allocate the data buffer to prevent too many realloc calls */
#define REQ_OVER_ALLOCATION 256
diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c
index 120a42f0d6..4907eec70a 100644
--- a/source4/libcli/raw/rawsearch.c
+++ b/source4/libcli/raw/rawsearch.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
Old style search backend - process output.
diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c
index 2b525f2661..0c263ac082 100644
--- a/source4/libcli/raw/rawsetfileinfo.c
+++ b/source4/libcli/raw/rawsetfileinfo.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/****************************************************************************
Handle setfileinfo/setpathinfo trans2 backend.
diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c
index 21e20d00e0..32c12382f6 100644
--- a/source4/libcli/raw/rawtrans.c
+++ b/source4/libcli/raw/rawtrans.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/*
diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c
index 2a0c64f598..d348c202f5 100644
--- a/source4/libcli/raw/smb_signing.c
+++ b/source4/libcli/raw/smb_signing.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/***********************************************************
SMB signing - Common code before we set a new signing implementation
diff --git a/source4/libcli/util/clierror.c b/source4/libcli/util/clierror.c
index e7e413bbcb..1c82958ce2 100644
--- a/source4/libcli/util/clierror.c
+++ b/source4/libcli/util/clierror.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/***************************************************************************
diff --git a/source4/libcli/util/cliutil.c b/source4/libcli/util/cliutil.c
index 3efa1dbbc9..ead09c4b41 100644
--- a/source4/libcli/util/cliutil.c
+++ b/source4/libcli/util/cliutil.c
@@ -20,6 +20,8 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
+
/*******************************************************************
Functions nicked from lib/util.c needed by client.
*******************************************************************/
diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c
index ead479230d..25f3ea277a 100644
--- a/source4/librpc/rpc/dcerpc_smb.c
+++ b/source4/librpc/rpc/dcerpc_smb.c
@@ -22,6 +22,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/* transport private information used by SMB pipe transport */
struct smb_private {
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 9c5cfd9584..39befebae5 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -26,6 +26,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/* this is stored in ntvfs_private */
struct cvfs_private {
diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c
index 5dfd610bff..a2f1e17f76 100644
--- a/source4/torture/basic/denytest.c
+++ b/source4/torture/basic/denytest.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
extern BOOL torture_showall;
extern int torture_failures;
diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c
index 9683557ca8..00187cbeac 100644
--- a/source4/torture/basic/locking.c
+++ b/source4/torture/basic/locking.c
@@ -22,6 +22,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/*
This test checks for two things:
diff --git a/source4/torture/basic/scanner.c b/source4/torture/basic/scanner.c
index 0e79e94f82..da18a50a0f 100644
--- a/source4/torture/basic/scanner.c
+++ b/source4/torture/basic/scanner.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define VERBOSE 0
#define OP_MIN 0
diff --git a/source4/torture/basic/secleak.c b/source4/torture/basic/secleak.c
index c3c8dcbb13..7cf1d43b81 100644
--- a/source4/torture/basic/secleak.c
+++ b/source4/torture/basic/secleak.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
static BOOL try_failed_login(struct smbcli_state *cli)
{
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 22cbb79769..15956d3b3b 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define NSERVERS 2
#define NINSTANCES 2
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 82b15722c5..c112158492 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
static fstring password;
static fstring username;
diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c
index c1cf860a8d..8f72c6d582 100644
--- a/source4/torture/raw/context.c
+++ b/source4/torture/raw/context.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define BASEDIR "\\rawcontext"
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index abedcd171e..9d7ff0a28f 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c
index 69118fdf09..c184fb79a7 100644
--- a/source4/torture/raw/mux.c
+++ b/source4/torture/raw/mux.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define BASEDIR "\\test_mux"
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 89c686448f..5da0338552 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
/* enum for whether reads/writes are possible on a file */
enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR};
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 99f1dd7a38..45abecfa8d 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
static struct {
const char *name;
diff --git a/source4/torture/raw/qfsinfo.c b/source4/torture/raw/qfsinfo.c
index 998dbc40cc..d302435a6c 100644
--- a/source4/torture/raw/qfsinfo.c
+++ b/source4/torture/raw/qfsinfo.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
static struct {
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index 9d7b2e3fe3..46b5f9403a 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index 8a8e4cc0f9..0c3a724bf9 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define BASEDIR "\\testsearch"
diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c
index 965911dc1a..28faf6b22c 100644
--- a/source4/torture/raw/write.c
+++ b/source4/torture/raw/write.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 462a46fbf1..4eab4e1ecc 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
int torture_nprocs=4;
int torture_numops=100;
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c
index 99192536f4..034bc807bb 100644
--- a/source4/torture/torture_util.c
+++ b/source4/torture/torture_util.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "libcli/raw/libcliraw.h"
static struct timeval tp1,tp2;