diff options
Diffstat (limited to 'source4/libcli')
28 files changed, 162 insertions, 0 deletions
diff --git a/source4/libcli/auth/config.mk b/source4/libcli/auth/config.mk index 0d8c21d527..c879c60956 100644 --- a/source4/libcli/auth/config.mk +++ b/source4/libcli/auth/config.mk @@ -1,6 +1,7 @@ ################################# # Start SUBSYSTEM LIBCLI_AUTH [SUBSYSTEM::LIBCLI_AUTH] +PRIVATE_PROTO_HEADER = proto.h OBJ_FILES = credentials.o \ session.o \ smbencrypt.o diff --git a/source4/libcli/auth/smbencrypt.c b/source4/libcli/auth/smbencrypt.c index 12c5d2dfb6..0ebd78fa7f 100644 --- a/source4/libcli/auth/smbencrypt.c +++ b/source4/libcli/auth/smbencrypt.c @@ -27,6 +27,7 @@ #include "smb.h" #include "auth/ntlmssp/ntlmssp.h" #include "lib/crypto/crypto.h" +#include "libcli/auth/proto.h" #include "pstring.h" /* diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index 490a03d50e..9e407ba200 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -38,6 +38,7 @@ #include "libcli/ldap/ldap.h" #include "libcli/cldap/cldap.h" #include "lib/socket/socket.h" +#include "libcli/security/proto.h" /* destroy a pending request diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 8103208a26..8616e42cd4 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -24,6 +24,7 @@ #include "includes.h" #include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" +#include "libcli/auth/proto.h" #include "libcli/smb_composite/smb_composite.h" /* diff --git a/source4/libcli/composite/composite.h b/source4/libcli/composite/composite.h index 26490f1c4a..d1299d77c1 100644 --- a/source4/libcli/composite/composite.h +++ b/source4/libcli/composite/composite.h @@ -60,3 +60,5 @@ struct composite_context { BOOL used_wait; }; + +#include "libcli/composite/proto.h" diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk index b431922de7..71adaaa8c9 100644 --- a/source4/libcli/config.mk +++ b/source4/libcli/config.mk @@ -16,11 +16,13 @@ OBJ_FILES = util/clilsa.o REQUIRED_SUBSYSTEMS = RPC_NDR_LSA [SUBSYSTEM::LIBCLI_COMPOSITE] +PRIVATE_PROTO_HEADER = composite/proto.h OBJ_FILES = \ composite/composite.o REQUIRED_SUBSYSTEMS = LIBEVENTS [SUBSYSTEM::LIBCLI_SMB_COMPOSITE] +PRIVATE_PROTO_HEADER = smb_composite/proto.h OBJ_FILES = \ smb_composite/loadfile.o \ smb_composite/savefile.o \ @@ -80,6 +82,7 @@ OBJ_FILES = \ REQUIRED_SUBSYSTEMS = NDR_WINSREPL SOCKET LIBEVENTS [SUBSYSTEM::LIBCLI_RESOLVE] +PRIVATE_PROTO_HEADER = resolve/resolve.h OBJ_FILES = \ resolve/resolve.o \ resolve/nbtlist.o \ diff --git a/source4/libcli/dgram/browse.c b/source4/libcli/dgram/browse.c index 25cee387c4..f67e561afc 100644 --- a/source4/libcli/dgram/browse.c +++ b/source4/libcli/dgram/browse.c @@ -24,6 +24,7 @@ #include "includes.h" #include "libcli/dgram/libdgram.h" #include "lib/socket/socket.h" +#include "libcli/resolve/resolve.h" NTSTATUS dgram_mailslot_browse_send(struct nbt_dgram_socket *dgmsock, struct nbt_name *dest_name, diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 6ad4c28811..df8c63fa87 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/dgram/libdgram.h" #include "lib/socket/socket.h" +#include "libcli/resolve/resolve.h" /* send a netlogon mailslot request diff --git a/source4/libcli/dgram/ntlogon.c b/source4/libcli/dgram/ntlogon.c index ecd6bd4587..84ad814fa0 100644 --- a/source4/libcli/dgram/ntlogon.c +++ b/source4/libcli/dgram/ntlogon.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/dgram/libdgram.h" #include "lib/socket/socket.h" +#include "libcli/resolve/resolve.h" /* send a ntlogon mailslot request diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c index 9caf9b5578..085aa352ac 100644 --- a/source4/libcli/finddcs.c +++ b/source4/libcli/finddcs.c @@ -27,6 +27,7 @@ #include "librpc/gen_ndr/ndr_samr.h" #include "libcli/composite/composite.h" #include "libcli/libcli.h" +#include "libcli/resolve/resolve.h" struct finddcs_state { struct composite_context *ctx; diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 40d9d2784a..4b1d70d8d2 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -26,6 +26,7 @@ #include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" #include "lib/socket/socket.h" +#include "libcli/resolve/resolve.h" struct sock_connect_state { struct composite_context *ctx; diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c index f8ea6b2b3b..1b58918ea7 100644 --- a/source4/libcli/resolve/bcast.c +++ b/source4/libcli/resolve/bcast.c @@ -21,6 +21,9 @@ */ #include "includes.h" +#include "libcli/resolve/resolve.h" +#include "system/network.h" +#include "netif/netif.h" /* broadcast name resolution method - async send diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index 3af40c1b24..e8473966b4 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -26,6 +26,8 @@ #include "includes.h" #include "libcli/composite/composite.h" +#include "system/network.h" +#include "netif/netif.h" struct nbtlist_state { struct nbt_name name; diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c index d3d197e567..c3fdf4bc25 100644 --- a/source4/libcli/resolve/resolve.c +++ b/source4/libcli/resolve/resolve.c @@ -23,6 +23,7 @@ #include "includes.h" #include "lib/events/events.h" #include "libcli/composite/composite.h" +#include "libcli/resolve/resolve.h" struct resolve_state { struct nbt_name name; diff --git a/source4/libcli/resolve/wins.c b/source4/libcli/resolve/wins.c index b2e0ddae6f..f11033ae4f 100644 --- a/source4/libcli/resolve/wins.c +++ b/source4/libcli/resolve/wins.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "libcli/resolve/resolve.h" /* wins name resolution method - async send diff --git a/source4/libcli/security/access_check.c b/source4/libcli/security/access_check.c index 00275d8824..9d565363e6 100644 --- a/source4/libcli/security/access_check.c +++ b/source4/libcli/security/access_check.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "libcli/security/proto.h" /* diff --git a/source4/libcli/security/config.mk b/source4/libcli/security/config.mk index a8de499531..3202def26c 100644 --- a/source4/libcli/security/config.mk +++ b/source4/libcli/security/config.mk @@ -1,6 +1,7 @@ ################################# # Start SUBSYSTEM LIB_SECURITY [SUBSYSTEM::LIB_SECURITY] +PRIVATE_PROTO_HEADER = proto.h OBJ_FILES = security_token.o \ security_descriptor.o \ dom_sid.o \ diff --git a/source4/libcli/security/sddl.c b/source4/libcli/security/sddl.c index c434072529..a1e9985edd 100644 --- a/source4/libcli/security/sddl.c +++ b/source4/libcli/security/sddl.c @@ -22,6 +22,7 @@ #include "includes.h" #include "system/iconv.h" +#include "libcli/security/proto.h" struct flag_map { const char *name; diff --git a/source4/libcli/security/security_descriptor.c b/source4/libcli/security/security_descriptor.c index 64983e20d0..20cdeb0ba7 100644 --- a/source4/libcli/security/security_descriptor.c +++ b/source4/libcli/security/security_descriptor.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "libcli/security/proto.h" /* return a blank security descriptor (no owners, dacl or sacl) diff --git a/source4/libcli/security/security_token.c b/source4/libcli/security/security_token.c index 6774894a86..7760ee7c22 100644 --- a/source4/libcli/security/security_token.c +++ b/source4/libcli/security/security_token.c @@ -23,6 +23,7 @@ #include "includes.h" #include "dsdb/samdb/samdb.h" +#include "libcli/security/proto.h" /* return a blank security token diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index d15f370feb..b185ff7a88 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -25,6 +25,7 @@ #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" #include "libcli/composite/composite.h" +#include "libcli/resolve/resolve.h" struct smb2_connect_state { struct cli_credentials *credentials; diff --git a/source4/libcli/smb_composite/appendacl.c b/source4/libcli/smb_composite/appendacl.c index c68c0a185d..0a5b56b90d 100644 --- a/source4/libcli/smb_composite/appendacl.c +++ b/source4/libcli/smb_composite/appendacl.c @@ -1,6 +1,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" +#include "libcli/security/proto.h" #include "libcli/smb_composite/smb_composite.h" /* the stages of this call */ diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c index 785b0d076b..07da2d363a 100644 --- a/source4/libcli/smb_composite/connect.c +++ b/source4/libcli/smb_composite/connect.c @@ -26,6 +26,7 @@ #include "libcli/composite/composite.h" #include "libcli/smb_composite/smb_composite.h" #include "lib/events/events.h" +#include "libcli/resolve/resolve.h" /* the stages of this call */ enum connect_stage {CONNECT_RESOLVE, diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c index bbe6a7edfb..9e345ab4f8 100644 --- a/source4/libcli/smb_composite/sesssetup.c +++ b/source4/libcli/smb_composite/sesssetup.c @@ -25,6 +25,7 @@ #include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" #include "libcli/smb_composite/smb_composite.h" +#include "libcli/auth/proto.h" #include "auth/auth.h" #include "version.h" diff --git a/source4/libcli/smb_composite/smb_composite.h b/source4/libcli/smb_composite/smb_composite.h index 7ab0127440..ac34ad40ac 100644 --- a/source4/libcli/smb_composite/smb_composite.h +++ b/source4/libcli/smb_composite/smb_composite.h @@ -170,3 +170,5 @@ struct smb_composite_connectmulti { struct smbcli_socket *socket; } out; }; + +#include "libcli/smb_composite/proto.h" diff --git a/source4/libcli/util/clilsa.c b/source4/libcli/util/clilsa.c index bf5048b02a..97aa7e13ac 100644 --- a/source4/libcli/util/clilsa.c +++ b/source4/libcli/util/clilsa.c @@ -29,6 +29,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "libcli/security/proto.h" #include "librpc/gen_ndr/ndr_lsa.h" struct smblsa_state { diff --git a/source4/libcli/util/nt_status.h b/source4/libcli/util/nt_status.h new file mode 100644 index 0000000000..a805a1cfbd --- /dev/null +++ b/source4/libcli/util/nt_status.h @@ -0,0 +1,127 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup, plus a whole lot more. + + Copyright (C) Andrew Tridgell 2001 + + 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. +*/ + +#ifndef _NT_STATUS_H +#define _NT_STATUS_H + +/* The Splint code analysis tool doesn't like immediate structures. */ + +#ifdef _SPLINT_ /* http://www.splint.org */ +#undef HAVE_IMMEDIATE_STRUCTURES +#endif + +/* the following rather strange looking definitions of NTSTATUS and WERROR + and there in order to catch common coding errors where different error types + are mixed up. This is especially important as we slowly convert Samba + from using BOOL for internal functions +*/ + +#if defined(HAVE_IMMEDIATE_STRUCTURES) +typedef struct {uint32_t v;} NTSTATUS; +#define NT_STATUS(x) ((NTSTATUS) { x }) +#define NT_STATUS_V(x) ((x).v) +#else +typedef uint32_t NTSTATUS; +#define NT_STATUS(x) (x) +#define NT_STATUS_V(x) (x) +#endif + +#if defined(HAVE_IMMEDIATE_STRUCTURES) +typedef struct {uint32_t v;} WERROR; +#define W_ERROR(x) ((WERROR) { x }) +#define W_ERROR_V(x) ((x).v) +#else +typedef uint32_t WERROR; +#define W_ERROR(x) (x) +#define W_ERROR_V(x) (x) +#endif + +#define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0) +#define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000) +/* checking for DOS error mapping here is ugly, but unfortunately the + alternative is a very intrusive rewrite of the torture code */ +#define NT_STATUS_EQUAL(x,y) (NT_STATUS_IS_DOS(x)||NT_STATUS_IS_DOS(y)?ntstatus_dos_equal(x,y):NT_STATUS_V(x) == NT_STATUS_V(y)) + +#define NT_STATUS_HAVE_NO_MEMORY(x) do { \ + if (!(x)) {\ + return NT_STATUS_NO_MEMORY;\ + }\ +} while (0) + +#define NT_STATUS_IS_OK_RETURN(x) do { \ + if (NT_STATUS_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +#define NT_STATUS_NOT_OK_RETURN(x) do { \ + if (!NT_STATUS_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +#define NT_STATUS_IS_ERR_RETURN(x) do { \ + if (NT_STATUS_IS_ERR(x)) {\ + return x;\ + }\ +} while (0) + +#define NT_STATUS_NOT_ERR_RETURN(x) do { \ + if (!NT_STATUS_IS_ERR(x)) {\ + return x;\ + }\ +} while (0) + +#define W_ERROR_IS_OK(x) (W_ERROR_V(x) == 0) +#define W_ERROR_EQUAL(x,y) (W_ERROR_V(x) == W_ERROR_V(y)) + +#define W_ERROR_HAVE_NO_MEMORY(x) do { \ + if (!(x)) {\ + return WERR_NOMEM;\ + }\ +} while (0) + +#define W_ERROR_IS_OK_RETURN(x) do { \ + if (W_ERROR_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +#define W_ERROR_NOT_OK_RETURN(x) do { \ + if (!W_ERROR_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +/* this defines special NTSTATUS codes to represent DOS errors. I + have chosen this macro to produce status codes in the invalid + NTSTATUS range */ +#define NT_STATUS_DOS(class, code) NT_STATUS(0xF1000000 | ((class)<<16) | code) +#define NT_STATUS_IS_DOS(status) ((NT_STATUS_V(status) & 0xFF000000) == 0xF1000000) +#define NT_STATUS_DOS_CLASS(status) ((NT_STATUS_V(status) >> 16) & 0xFF) +#define NT_STATUS_DOS_CODE(status) (NT_STATUS_V(status) & 0xFFFF) + +/* define ldap error codes as NTSTATUS codes */ +#define NT_STATUS_LDAP(code) NT_STATUS(0xF2000000 | code) +#define NT_STATUS_IS_LDAP(status) ((NT_STATUS_V(status) & 0xFF000000) == 0xF2000000) +#define NT_STATUS_LDAP_CODE(status) (NT_STATUS_V(status) & ~0xFF000000) + +#endif diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index ba7203c33a..3fb142ea0b 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -27,6 +27,8 @@ #include "libcli/wrepl/winsrepl.h" #include "lib/stream/packet.h" #include "libcli/composite/composite.h" +#include "system/network.h" +#include "netif/netif.h" static struct wrepl_request *wrepl_request_finished(struct wrepl_request *req, NTSTATUS status); |