summaryrefslogtreecommitdiff
path: root/source4/include
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-02-23 15:52:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:52:05 -0500
commitdfc517b05395d925a4d7b1ce9633a849f9468e70 (patch)
treea81c020c89022980e6fbb68116648da217fbb0fc /source4/include
parent80c8a522861068e7b0974986936f65052dd6f70f (diff)
downloadsamba-dfc517b05395d925a4d7b1ce9633a849f9468e70.tar.gz
samba-dfc517b05395d925a4d7b1ce9633a849f9468e70.tar.bz2
samba-dfc517b05395d925a4d7b1ce9633a849f9468e70.zip
r13658: More moving around of files:
- Collect the generic utility functions into a lib/util/ (a la GLib is for the GNOME folks) - Remove even more files from include/ (This used to be commit ba62880f5b05c2a505dc7f54676b231197a7e707)
Diffstat (limited to 'source4/include')
-rw-r--r--source4/include/byteorder.h224
-rw-r--r--source4/include/core.h6
-rw-r--r--source4/include/dynconfig.h43
-rw-r--r--source4/include/enums.h38
-rw-r--r--source4/include/includes.h24
-rw-r--r--source4/include/ioctl.h33
-rw-r--r--source4/include/safe_string.h55
-rw-r--r--source4/include/smb_macros.h73
-rw-r--r--source4/include/structs.h4
-rw-r--r--source4/include/trans2.h435
10 files changed, 14 insertions, 921 deletions
diff --git a/source4/include/byteorder.h b/source4/include/byteorder.h
deleted file mode 100644
index 941dee9e88..0000000000
--- a/source4/include/byteorder.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- SMB Byte handling
- Copyright (C) Andrew Tridgell 1992-1998
-
- 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 _BYTEORDER_H
-#define _BYTEORDER_H
-
-/*
- This file implements macros for machine independent short and
- int manipulation
-
-Here is a description of this file that I emailed to the samba list once:
-
-> I am confused about the way that byteorder.h works in Samba. I have
-> looked at it, and I would have thought that you might make a distinction
-> between LE and BE machines, but you only seem to distinguish between 386
-> and all other architectures.
->
-> Can you give me a clue?
-
-sure.
-
-The distinction between 386 and other architectures is only there as
-an optimisation. You can take it out completely and it will make no
-difference. The routines (macros) in byteorder.h are totally byteorder
-independent. The 386 optimsation just takes advantage of the fact that
-the x86 processors don't care about alignment, so we don't have to
-align ints on int boundaries etc. If there are other processors out
-there that aren't alignment sensitive then you could also define
-CAREFUL_ALIGNMENT=0 on those processors as well.
-
-Ok, now to the macros themselves. I'll take a simple example, say we
-want to extract a 2 byte integer from a SMB packet and put it into a
-type called uint16_t that is in the local machines byte order, and you
-want to do it with only the assumption that uint16_t is _at_least_ 16
-bits long (this last condition is very important for architectures
-that don't have any int types that are 2 bytes long)
-
-You do this:
-
-#define CVAL(buf,pos) (((uint8_t *)(buf))[pos])
-#define PVAL(buf,pos) ((uint_t)CVAL(buf,pos))
-#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
-
-then to extract a uint16_t value at offset 25 in a buffer you do this:
-
-char *buffer = foo_bar();
-uint16_t xx = SVAL(buffer,25);
-
-We are using the byteoder independence of the ANSI C bitshifts to do
-the work. A good optimising compiler should turn this into efficient
-code, especially if it happens to have the right byteorder :-)
-
-I know these macros can be made a bit tidier by removing some of the
-casts, but you need to look at byteorder.h as a whole to see the
-reasoning behind them. byteorder.h defines the following macros:
-
-SVAL(buf,pos) - extract a 2 byte SMB value
-IVAL(buf,pos) - extract a 4 byte SMB value
-SVALS(buf,pos) signed version of SVAL()
-IVALS(buf,pos) signed version of IVAL()
-
-SSVAL(buf,pos,val) - put a 2 byte SMB value into a buffer
-SIVAL(buf,pos,val) - put a 4 byte SMB value into a buffer
-SSVALS(buf,pos,val) - signed version of SSVAL()
-SIVALS(buf,pos,val) - signed version of SIVAL()
-
-RSVAL(buf,pos) - like SVAL() but for NMB byte ordering
-RSVALS(buf,pos) - like SVALS() but for NMB byte ordering
-RIVAL(buf,pos) - like IVAL() but for NMB byte ordering
-RIVALS(buf,pos) - like IVALS() but for NMB byte ordering
-RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering
-RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering
-RSIVALS(buf,pos,val) - like SIVALS() but for NMB ordering
-
-it also defines lots of intermediate macros, just ignore those :-)
-
-*/
-
-
-/*
- on powerpc we can use the magic instructions to load/store
- in little endian
-*/
-#if (defined(__powerpc__) && defined(__GNUC__))
-static __inline__ uint16_t ld_le16(const uint16_t *addr)
-{
- uint16_t val;
- __asm__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
- return val;
-}
-
-static __inline__ void st_le16(uint16_t *addr, const uint16_t val)
-{
- __asm__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
-}
-
-static __inline__ uint32_t ld_le32(const uint32_t *addr)
-{
- uint32_t val;
- __asm__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
- return val;
-}
-
-static __inline__ void st_le32(uint32_t *addr, const uint32_t val)
-{
- __asm__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
-}
-#define HAVE_ASM_BYTEORDER 1
-#endif
-
-
-
-#undef CAREFUL_ALIGNMENT
-
-/* we know that the 386 can handle misalignment and has the "right"
- byteorder */
-#if defined(__i386__)
-#define CAREFUL_ALIGNMENT 0
-#endif
-
-#ifndef CAREFUL_ALIGNMENT
-#define CAREFUL_ALIGNMENT 1
-#endif
-
-#define CVAL(buf,pos) ((uint_t)(((const uint8_t *)(buf))[pos]))
-#define CVAL_NC(buf,pos) (((uint8_t *)(buf))[pos]) /* Non-const version of CVAL */
-#define PVAL(buf,pos) (CVAL(buf,pos))
-#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
-
-#if HAVE_ASM_BYTEORDER
-
-#define _PTRPOS(buf,pos) (((const uint8_t *)buf)+(pos))
-#define SVAL(buf,pos) ld_le16((const uint16_t *)_PTRPOS(buf,pos))
-#define IVAL(buf,pos) ld_le32((const uint32_t *)_PTRPOS(buf,pos))
-#define SSVAL(buf,pos,val) st_le16((uint16_t *)_PTRPOS(buf,pos), val)
-#define SIVAL(buf,pos,val) st_le32((uint32_t *)_PTRPOS(buf,pos), val)
-#define SVALS(buf,pos) ((int16_t)SVAL(buf,pos))
-#define IVALS(buf,pos) ((int32_t)IVAL(buf,pos))
-#define SSVALS(buf,pos,val) SSVAL((buf),(pos),((int16_t)(val)))
-#define SIVALS(buf,pos,val) SIVAL((buf),(pos),((int32_t)(val)))
-
-#elif CAREFUL_ALIGNMENT
-
-#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
-#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16)
-#define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(uint8_t)((val)&0xFF),CVAL_NC(buf,pos+1)=(uint8_t)((val)>>8))
-#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
-#define SVALS(buf,pos) ((int16_t)SVAL(buf,pos))
-#define IVALS(buf,pos) ((int32_t)IVAL(buf,pos))
-#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16_t)(val)))
-#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32_t)(val)))
-#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16_t)(val)))
-#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32_t)(val)))
-
-#else /* CAREFUL_ALIGNMENT */
-
-/* this handles things for architectures like the 386 that can handle
- alignment errors */
-/*
- WARNING: This section is dependent on the length of int16_t and int32_t
- being correct
-*/
-
-/* get single value from an SMB buffer */
-#define SVAL(buf,pos) (*(const uint16_t *)((const char *)(buf) + (pos)))
-#define SVAL_NC(buf,pos) (*(uint16_t *)((char *)(buf) + (pos))) /* Non const version of above. */
-#define IVAL(buf,pos) (*(const uint32_t *)((const char *)(buf) + (pos)))
-#define IVAL_NC(buf,pos) (*(uint32_t *)((char *)(buf) + (pos))) /* Non const version of above. */
-#define SVALS(buf,pos) (*(const int16_t *)((const char *)(buf) + (pos)))
-#define SVALS_NC(buf,pos) (*(int16_t *)((char *)(buf) + (pos))) /* Non const version of above. */
-#define IVALS(buf,pos) (*(const int32_t *)((const char *)(buf) + (pos)))
-#define IVALS_NC(buf,pos) (*(int32_t *)((char *)(buf) + (pos))) /* Non const version of above. */
-
-/* store single value in an SMB buffer */
-#define SSVAL(buf,pos,val) SVAL_NC(buf,pos)=((uint16_t)(val))
-#define SIVAL(buf,pos,val) IVAL_NC(buf,pos)=((uint32_t)(val))
-#define SSVALS(buf,pos,val) SVALS_NC(buf,pos)=((int16_t)(val))
-#define SIVALS(buf,pos,val) IVALS_NC(buf,pos)=((int32_t)(val))
-
-#endif /* CAREFUL_ALIGNMENT */
-
-/* now the reverse routines - these are used in nmb packets (mostly) */
-#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
-#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
-
-#define RSVAL(buf,pos) SREV(SVAL(buf,pos))
-#define RSVALS(buf,pos) SREV(SVALS(buf,pos))
-#define RIVAL(buf,pos) IREV(IVAL(buf,pos))
-#define RIVALS(buf,pos) IREV(IVALS(buf,pos))
-#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
-#define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val))
-#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
-#define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val))
-
-/* Alignment macros. */
-#define ALIGN4(p,base) ((p) + ((4 - (PTR_DIFF((p), (base)) & 3)) & 3))
-#define ALIGN2(p,base) ((p) + ((2 - (PTR_DIFF((p), (base)) & 1)) & 1))
-
-
-/* macros for accessing SMB protocol elements */
-#define VWV(vwv) ((vwv)*2)
-
-/* 64 bit macros */
-#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,((uint64_t)(v))>>32))
-#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
-
-#endif /* _BYTEORDER_H */
diff --git a/source4/include/core.h b/source4/include/core.h
index d0c92880de..0ffbeea6a4 100644
--- a/source4/include/core.h
+++ b/source4/include/core.h
@@ -24,10 +24,6 @@
#ifndef _SAMBA_CORE_H
#define _SAMBA_CORE_H
-/*
- * Define VOLATILE if needed.
- */
-
#define False (0)
#define True (1)
#define Auto (2)
@@ -54,4 +50,4 @@ typedef uint64_t NTTIME;
typedef NTSTATUS (*init_module_fn) (void);
-#endif /* _SMB_H */
+#endif /* _SAMBA_CORE_H */
diff --git a/source4/include/dynconfig.h b/source4/include/dynconfig.h
deleted file mode 100644
index 5acf5b7338..0000000000
--- a/source4/include/dynconfig.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Copyright (C) 2001 by Martin Pool <mbp@samba.org>
- Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
-
-
- 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.
-*/
-
-/**
- * @file dynconfig.h
- *
- * @brief Exported global configurations.
- **/
-
-extern const char *dyn_SBINDIR, *dyn_BINDIR;
-extern const char *dyn_CONFIGFILE;
-extern const char *dyn_NCALRPCDIR;
-extern const char *dyn_LOGFILEBASE;
-extern const char *dyn_LMHOSTSFILE;
-extern const char *dyn_LIBDIR;
-extern const char *dyn_MODULESDIR;
-extern const char *dyn_SHLIBEXT;
-extern const char *dyn_LOCKDIR;
-extern const char *dyn_PIDDIR;
-extern const char *dyn_SMB_PASSWD_FILE;
-extern const char *dyn_PRIVATE_DIR;
-extern const char *dyn_SWATDIR;
-extern const char *dyn_JSDIR;
-extern const char *dyn_SETUPDIR;
-extern const char *dyn_WINBINDD_SOCKET_DIR;
diff --git a/source4/include/enums.h b/source4/include/enums.h
deleted file mode 100644
index 6003dfc7a0..0000000000
--- a/source4/include/enums.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Copyright (C) Andrew Tridgell 2003
-
- 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.
-*/
-
-/*
- this header declares basic enumerated types
-*/
-
-/* protocol types. It assumes that higher protocols include lower protocols
- as subsets */
-enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1};
-
-/* security levels */
-enum security_types {SEC_SHARE,SEC_USER};
-
-/* passed to br lock code */
-enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK};
-
-enum smb_signing_state {SMB_SIGNING_OFF, SMB_SIGNING_SUPPORTED,
- SMB_SIGNING_REQUIRED, SMB_SIGNING_AUTO};
-
-
diff --git a/source4/include/includes.h b/source4/include/includes.h
index 444feab6fc..8bede51721 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -86,28 +86,31 @@ struct ipv4_addr {
uint32_t addr;
};
+/* protocol types. It assumes that higher protocols include lower protocols
+ as subsets. FIXME: Move to one of the smb-specific headers */
+enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1};
+
+/* passed to br lock code. FIXME: Move to one of the smb-specific headers */
+enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK};
+
#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
#include "lib/replace/replace.h"
/* Lists, trees, caching, database... */
-#include "xfile.h"
-#include "talloc/talloc.h"
#include "nt_status.h"
+#include "talloc/talloc.h"
+#include "core.h"
+#include "charset/charset.h"
#include "structs.h"
-#include "trans2.h"
+#include "util/util.h"
#include "libcli/util/nterr.h"
-#include "charset/charset.h"
-#include "core.h"
-#include "debug.h"
#include "libcli/util/doserr.h"
-#include "enums.h"
-#include "smb_macros.h"
-#include "byteorder.h"
#include "librpc/ndr/libndr.h"
#include "librpc/gen_ndr/dcerpc.h"
#include "librpc/ndr/ndr_orpc.h"
#include "librpc/gen_ndr/orpc.h"
#include "librpc/rpc/dcerpc.h"
+#include "libcli/raw/trans2.h"
#include "libcli/raw/interfaces.h"
#include "auth/credentials/credentials.h"
#include "libcli/nbt/libnbt.h"
@@ -116,12 +119,11 @@ struct ipv4_addr {
#define _PRINTF_ATTRIBUTE(a1, a2)
/***** automatically generated prototypes *****/
-#include "basic.h"
#include "include/proto.h"
/* String routines */
-#include "safe_string.h"
+#include "util/safe_string.h"
#ifndef HAVE_PIPE
#define SYNC_DNS 1
diff --git a/source4/include/ioctl.h b/source4/include/ioctl.h
deleted file mode 100644
index cd658c121b..0000000000
--- a/source4/include/ioctl.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- ioctl and fsctl definitions
-
- Copyright (C) Andrew Tridgell 2003
-
- 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.
-*/
-
-
-/* ioctl codes */
-#define IOCTL_QUERY_JOB_INFO 0x530060
-
-
-/* filesystem control codes */
-#define FSCTL_FILESYSTEM 0x90000
-#define FSCTL_SET_SPARSE (FSCTL_FILESYSTEM | (49<<2))
-#define FSCTL_REQUEST_BATCH_OPLOCK (FSCTL_FILESYSTEM | (2<<2))
-
-#define FSCTL_NAMED_PIPE 0x110000
-#define FSCTL_NAMED_PIPE_READ_WRITE (FSCTL_NAMED_PIPE | 0xc017)
diff --git a/source4/include/safe_string.h b/source4/include/safe_string.h
deleted file mode 100644
index 43e094467c..0000000000
--- a/source4/include/safe_string.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Safe string handling routines.
- Copyright (C) Andrew Tridgell 1994-1998
-
- 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 _SAFE_STRING_H
-#define _SAFE_STRING_H
-
-#ifndef _SPLINT_ /* http://www.splint.org */
-/* Some macros to ensure people don't use buffer overflow vulnerable string
- functions. */
-
-#ifdef bcopy
-#undef bcopy
-#endif /* bcopy */
-#define bcopy(src,dest,size) __ERROR__XX__NEVER_USE_BCOPY___;
-
-#ifdef strcpy
-#undef strcpy
-#endif /* strcpy */
-#define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
-
-#ifdef strcat
-#undef strcat
-#endif /* strcat */
-#define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
-
-#ifdef sprintf
-#undef sprintf
-#endif /* sprintf */
-#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
-
-#endif /* !_SPLINT_ */
-
-/* replace some string functions with multi-byte
- versions */
-#define strlower(s) strlower_m(s)
-#define strupper(s) strupper_m(s)
-
-#endif
diff --git a/source4/include/smb_macros.h b/source4/include/smb_macros.h
deleted file mode 100644
index 956b0709ca..0000000000
--- a/source4/include/smb_macros.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Some convenient macros
- Copyright (C) Andrew Tridgell 1992-1999
- Copyright (C) John H Terpstra 1996-1999
- Copyright (C) Luke Kenneth Casson Leighton 1996-1999
- Copyright (C) Paul Ashton 1998 - 1999
-
- 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 _SMB_MACROS_H
-#define _SMB_MACROS_H
-
-/* zero a structure */
-#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
-
-/* zero a structure given a pointer to the structure */
-#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
-
-/* zero a structure given a pointer to the structure - no zero check */
-#define ZERO_STRUCTPN(x) memset((char *)(x), 0, sizeof(*(x)))
-
-/* pointer difference macro */
-#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
-
-/* work out how many elements there are in a static array */
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
-
-/* assert macros */
-#define SMB_ASSERT(b) do { if (!(b)) { \
- DEBUG(0,("PANIC: assert failed at %s(%d)\n", __FILE__, __LINE__)); \
- smb_panic("assert failed"); }} while (0)
-
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
-#ifndef MAX
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#ifndef ABS
-#define ABS(a) ((a)>0?(a):(-(a)))
-#endif
-
-#ifndef SAFE_FREE /* Oh no this is also defined in tdb.h */
-/**
- * Free memory if the pointer and zero the pointer.
- *
- * @note You are explicitly allowed to pass NULL pointers -- they will
- * always be ignored.
- **/
-#define SAFE_FREE(x) do { if ((x) != NULL) {free(discard_const_p(void *, (x))); (x)=NULL;} } while(0)
-#endif
-
-#define malloc_p(type) (type *)malloc(sizeof(type))
-#define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count)
-#define realloc_p(p, type, count) (type *)realloc_array(p, sizeof(type), count)
-
-#endif /* _SMB_MACROS_H */
diff --git a/source4/include/structs.h b/source4/include/structs.h
index 60ec1eae67..7bfe326234 100644
--- a/source4/include/structs.h
+++ b/source4/include/structs.h
@@ -133,8 +133,6 @@ struct wb_sid_object;
struct cldap_socket;
struct cldapd_server;
-struct mutex_ops;
-
struct websrv_context;
struct wbsrv_call;
@@ -161,6 +159,4 @@ struct nbtd_interface;
struct smbcli_session;
struct smbcli_state;
-struct substitute_context;
-
struct model_ops;
diff --git a/source4/include/trans2.h b/source4/include/trans2.h
deleted file mode 100644
index a3f6e28a2a..0000000000
--- a/source4/include/trans2.h
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- SMB transaction2 handling
- Copyright (C) Jeremy Allison 1994-2002.
- Copyright (C) Andrew Tridgell 1995-2003.
-
- 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 _TRANS2_H_
-#define _TRANS2_H_
-
-/* These are the TRANS2 sub commands */
-#define TRANSACT2_OPEN 0
-#define TRANSACT2_FINDFIRST 1
-#define TRANSACT2_FINDNEXT 2
-#define TRANSACT2_QFSINFO 3
-#define TRANSACT2_SETFSINFO 4
-#define TRANSACT2_QPATHINFO 5
-#define TRANSACT2_SETPATHINFO 6
-#define TRANSACT2_QFILEINFO 7
-#define TRANSACT2_SETFILEINFO 8
-#define TRANSACT2_FSCTL 9
-#define TRANSACT2_IOCTL 0xA
-#define TRANSACT2_FINDNOTIFYFIRST 0xB
-#define TRANSACT2_FINDNOTIFYNEXT 0xC
-#define TRANSACT2_MKDIR 0xD
-#define TRANSACT2_SESSION_SETUP 0xE
-#define TRANSACT2_GET_DFS_REFERRAL 0x10
-#define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11
-
-
-/* trans2 Query FS info levels */
-/*
-w2k3 TRANS2ALIASES:
-Checking for QFSINFO aliases
- Found level 1 (0x001) of size 18 (0x12)
- Found level 2 (0x002) of size 12 (0x0c)
- Found level 258 (0x102) of size 26 (0x1a)
- Found level 259 (0x103) of size 24 (0x18)
- Found level 260 (0x104) of size 8 (0x08)
- Found level 261 (0x105) of size 20 (0x14)
- Found level 1001 (0x3e9) of size 26 (0x1a)
- Found level 1003 (0x3eb) of size 24 (0x18)
- Found level 1004 (0x3ec) of size 8 (0x08)
- Found level 1005 (0x3ed) of size 20 (0x14)
- Found level 1006 (0x3ee) of size 48 (0x30)
- Found level 1007 (0x3ef) of size 32 (0x20)
- Found level 1008 (0x3f0) of size 64 (0x40)
-Found 13 levels with success status
- Level 261 (0x105) and level 1005 (0x3ed) are possible aliases
- Level 260 (0x104) and level 1004 (0x3ec) are possible aliases
- Level 259 (0x103) and level 1003 (0x3eb) are possible aliases
- Level 258 (0x102) and level 1001 (0x3e9) are possible aliases
-Found 4 aliased levels
-*/
-#define SMB_QFS_ALLOCATION 1
-#define SMB_QFS_VOLUME 2
-#define SMB_QFS_VOLUME_INFO 0x102
-#define SMB_QFS_SIZE_INFO 0x103
-#define SMB_QFS_DEVICE_INFO 0x104
-#define SMB_QFS_ATTRIBUTE_INFO 0x105
-#define SMB_QFS_UNIX_INFO 0x200
-#define SMB_QFS_POSIX_INFO 0x201
-#define SMB_QFS_VOLUME_INFORMATION 1001
-#define SMB_QFS_SIZE_INFORMATION 1003
-#define SMB_QFS_DEVICE_INFORMATION 1004
-#define SMB_QFS_ATTRIBUTE_INFORMATION 1005
-#define SMB_QFS_QUOTA_INFORMATION 1006
-#define SMB_QFS_FULL_SIZE_INFORMATION 1007
-#define SMB_QFS_OBJECTID_INFORMATION 1008
-
-
-/* trans2 qfileinfo/qpathinfo */
-/* w2k3 TRANS2ALIASES:
-Checking for QPATHINFO aliases
-setting up complex file \qpathinfo_aliases.txt
- Found level 1 (0x001) of size 22 (0x16)
- Found level 2 (0x002) of size 26 (0x1a)
- Found level 4 (0x004) of size 41 (0x29)
- Found level 6 (0x006) of size 0 (0x00)
- Found level 257 (0x101) of size 40 (0x28)
- Found level 258 (0x102) of size 24 (0x18)
- Found level 259 (0x103) of size 4 (0x04)
- Found level 260 (0x104) of size 48 (0x30)
- Found level 263 (0x107) of size 126 (0x7e)
- Found level 264 (0x108) of size 28 (0x1c)
- Found level 265 (0x109) of size 38 (0x26)
- Found level 267 (0x10b) of size 16 (0x10)
- Found level 1004 (0x3ec) of size 40 (0x28)
- Found level 1005 (0x3ed) of size 24 (0x18)
- Found level 1006 (0x3ee) of size 8 (0x08)
- Found level 1007 (0x3ef) of size 4 (0x04)
- Found level 1008 (0x3f0) of size 4 (0x04)
- Found level 1009 (0x3f1) of size 48 (0x30)
- Found level 1014 (0x3f6) of size 8 (0x08)
- Found level 1016 (0x3f8) of size 4 (0x04)
- Found level 1017 (0x3f9) of size 4 (0x04)
- Found level 1018 (0x3fa) of size 126 (0x7e)
- Found level 1021 (0x3fd) of size 28 (0x1c)
- Found level 1022 (0x3fe) of size 38 (0x26)
- Found level 1028 (0x404) of size 16 (0x10)
- Found level 1034 (0x40a) of size 56 (0x38)
- Found level 1035 (0x40b) of size 8 (0x08)
-Found 27 levels with success status
- Level 267 (0x10b) and level 1028 (0x404) are possible aliases
- Level 265 (0x109) and level 1022 (0x3fe) are possible aliases
- Level 264 (0x108) and level 1021 (0x3fd) are possible aliases
- Level 263 (0x107) and level 1018 (0x3fa) are possible aliases
- Level 260 (0x104) and level 1009 (0x3f1) are possible aliases
- Level 259 (0x103) and level 1007 (0x3ef) are possible aliases
- Level 258 (0x102) and level 1005 (0x3ed) are possible aliases
- Level 257 (0x101) and level 1004 (0x3ec) are possible aliases
-Found 8 aliased levels
-*/
-#define SMB_QFILEINFO_STANDARD 1
-#define SMB_QFILEINFO_EA_SIZE 2
-#define SMB_QFILEINFO_EA_LIST 3
-#define SMB_QFILEINFO_ALL_EAS 4
-#define SMB_QFILEINFO_IS_NAME_VALID 6 /* only for QPATHINFO */
-#define SMB_QFILEINFO_BASIC_INFO 0x101
-#define SMB_QFILEINFO_STANDARD_INFO 0x102
-#define SMB_QFILEINFO_EA_INFO 0x103
-#define SMB_QFILEINFO_NAME_INFO 0x104
-#define SMB_QFILEINFO_ALL_INFO 0x107
-#define SMB_QFILEINFO_ALT_NAME_INFO 0x108
-#define SMB_QFILEINFO_STREAM_INFO 0x109
-#define SMB_QFILEINFO_COMPRESSION_INFO 0x10b
-#define SMB_QFILEINFO_UNIX_BASIC 0x200
-#define SMB_QFILEINFO_UNIX_LINK 0x201
-#define SMB_QFILEINFO_BASIC_INFORMATION 1004
-#define SMB_QFILEINFO_STANDARD_INFORMATION 1005
-#define SMB_QFILEINFO_INTERNAL_INFORMATION 1006
-#define SMB_QFILEINFO_EA_INFORMATION 1007
-#define SMB_QFILEINFO_ACCESS_INFORMATION 1008
-#define SMB_QFILEINFO_NAME_INFORMATION 1009
-#define SMB_QFILEINFO_POSITION_INFORMATION 1014
-#define SMB_QFILEINFO_MODE_INFORMATION 1016
-#define SMB_QFILEINFO_ALIGNMENT_INFORMATION 1017
-#define SMB_QFILEINFO_ALL_INFORMATION 1018
-#define SMB_QFILEINFO_ALT_NAME_INFORMATION 1021
-#define SMB_QFILEINFO_STREAM_INFORMATION 1022
-#define SMB_QFILEINFO_COMPRESSION_INFORMATION 1028
-#define SMB_QFILEINFO_NETWORK_OPEN_INFORMATION 1034
-#define SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION 1035
-
-
-
-/* trans2 setfileinfo/setpathinfo levels */
-/*
-w2k3 TRANS2ALIASES
-Checking for SETFILEINFO aliases
-setting up complex file \setfileinfo_aliases.txt
- Found level 1 (0x001) of size 2 (0x02)
- Found level 2 (0x002) of size 2 (0x02)
- Found level 257 (0x101) of size 40 (0x28)
- Found level 258 (0x102) of size 2 (0x02)
- Found level 259 (0x103) of size 8 (0x08)
- Found level 260 (0x104) of size 8 (0x08)
- Found level 1004 (0x3ec) of size 40 (0x28)
- Found level 1010 (0x3f2) of size 2 (0x02)
- Found level 1013 (0x3f5) of size 2 (0x02)
- Found level 1014 (0x3f6) of size 8 (0x08)
- Found level 1016 (0x3f8) of size 4 (0x04)
- Found level 1019 (0x3fb) of size 8 (0x08)
- Found level 1020 (0x3fc) of size 8 (0x08)
- Found level 1023 (0x3ff) of size 8 (0x08)
- Found level 1025 (0x401) of size 16 (0x10)
- Found level 1029 (0x405) of size 72 (0x48)
- Found level 1032 (0x408) of size 56 (0x38)
- Found level 1039 (0x40f) of size 8 (0x08)
- Found level 1040 (0x410) of size 8 (0x08)
-Found 19 valid levels
-
-Checking for SETPATHINFO aliases
- Found level 1004 (0x3ec) of size 40 (0x28)
- Found level 1010 (0x3f2) of size 2 (0x02)
- Found level 1013 (0x3f5) of size 2 (0x02)
- Found level 1014 (0x3f6) of size 8 (0x08)
- Found level 1016 (0x3f8) of size 4 (0x04)
- Found level 1019 (0x3fb) of size 8 (0x08)
- Found level 1020 (0x3fc) of size 8 (0x08)
- Found level 1023 (0x3ff) of size 8 (0x08)
- Found level 1025 (0x401) of size 16 (0x10)
- Found level 1029 (0x405) of size 72 (0x48)
- Found level 1032 (0x408) of size 56 (0x38)
- Found level 1039 (0x40f) of size 8 (0x08)
- Found level 1040 (0x410) of size 8 (0x08)
-Found 13 valid levels
-*/
-#define SMB_SFILEINFO_STANDARD 1
-#define SMB_SFILEINFO_EA_SET 2
-#define SMB_SFILEINFO_BASIC_INFO 0x101
-#define SMB_SFILEINFO_DISPOSITION_INFO 0x102
-#define SMB_SFILEINFO_ALLOCATION_INFO 0x103
-#define SMB_SFILEINFO_END_OF_FILE_INFO 0x104
-#define SMB_SFILEINFO_UNIX_BASIC 0x200
-#define SMB_SFILEINFO_UNIX_LINK 0x201
-#define SMB_SPATHINFO_UNIX_HLINK 0x203
-#define SMB_SPATHINFO_POSIX_ACL 0x204
-#define SMB_SPATHINFO_XATTR 0x205
-#define SMB_SFILEINFO_ATTR_FLAGS 0x206
-#define SMB_SFILEINFO_BASIC_INFORMATION 1004
-#define SMB_SFILEINFO_RENAME_INFORMATION 1010
-#define SMB_SFILEINFO_DISPOSITION_INFORMATION 1013
-#define SMB_SFILEINFO_POSITION_INFORMATION 1014
-#define SMB_SFILEINFO_MODE_INFORMATION 1016
-#define SMB_SFILEINFO_ALLOCATION_INFORMATION 1019
-#define SMB_SFILEINFO_END_OF_FILE_INFORMATION 1020
-
-/* filemon shows FilePipeInformation */
-#define SMB_SFILEINFO_1023 1023
-
-/* filemon shows FilePipeRemoteInformation */
-#define SMB_SFILEINFO_1025 1025
-
-/* filemon shows CopyOnWriteInformation */
-#define SMB_SFILEINFO_1029 1029
-
-/* filemon shows OleClassIdInformation */
-#define SMB_SFILEINFO_1032 1032
-
-/* seems to be the file size - perhaps valid data size?
- filemon shows 'InheritContentIndexInfo'
-*/
-#define SMB_SFILEINFO_1039 1039
-
-/* OLE_INFORMATION? */
-#define SMB_SFILEINFO_1040 1040
-
-
-/* trans2 findfirst levels */
-/*
-w2k3 TRANS2ALIASES:
-Checking for FINDFIRST aliases
- Found level 1 (0x001) of size 68 (0x44)
- Found level 2 (0x002) of size 70 (0x46)
- Found level 257 (0x101) of size 108 (0x6c)
- Found level 258 (0x102) of size 116 (0x74)
- Found level 259 (0x103) of size 60 (0x3c)
- Found level 260 (0x104) of size 140 (0x8c)
- Found level 261 (0x105) of size 124 (0x7c)
- Found level 262 (0x106) of size 148 (0x94)
-Found 8 levels with success status
-Found 0 aliased levels
-*/
-#define SMB_FIND_STANDARD 1
-#define SMB_FIND_EA_SIZE 2
-#define SMB_FIND_EA_LIST 3
-#define SMB_FIND_DIRECTORY_INFO 0x101
-#define SMB_FIND_FULL_DIRECTORY_INFO 0x102
-#define SMB_FIND_NAME_INFO 0x103
-#define SMB_FIND_BOTH_DIRECTORY_INFO 0x104
-#define SMB_FIND_ID_FULL_DIRECTORY_INFO 0x105
-#define SMB_FIND_ID_BOTH_DIRECTORY_INFO 0x106
-#define SMB_FIND_UNIX_INFO 0x202
-
-/* flags on trans2 findfirst/findnext that control search */
-#define FLAG_TRANS2_FIND_CLOSE 0x1
-#define FLAG_TRANS2_FIND_CLOSE_IF_END 0x2
-#define FLAG_TRANS2_FIND_REQUIRE_RESUME 0x4
-#define FLAG_TRANS2_FIND_CONTINUE 0x8
-#define FLAG_TRANS2_FIND_BACKUP_INTENT 0x10
-
-/*
- * DeviceType and Characteristics returned in a
- * SMB_QFS_DEVICE_INFO call.
- */
-#define QFS_DEVICETYPE_CD_ROM 0x2
-#define QFS_DEVICETYPE_CD_ROM_FILE_SYSTEM 0x3
-#define QFS_DEVICETYPE_DISK 0x7
-#define QFS_DEVICETYPE_DISK_FILE_SYSTEM 0x8
-#define QFS_DEVICETYPE_FILE_SYSTEM 0x9
-
-/* Characteristics. */
-#define QFS_TYPE_REMOVABLE_MEDIA 0x1
-#define QFS_TYPE_READ_ONLY_DEVICE 0x2
-#define QFS_TYPE_FLOPPY 0x4
-#define QFS_TYPE_WORM 0x8
-#define QFS_TYPE_REMOTE 0x10
-#define QFS_TYPE_MOUNTED 0x20
-#define QFS_TYPE_VIRTUAL 0x40
-
-
-/*
- * Thursby MAC extensions....
- */
-
-/*
- * MAC CIFS Extensions have the range 0x300 - 0x2FF reserved.
- * Supposedly Microsoft have agreed to this.
- */
-
-#define MIN_MAC_INFO_LEVEL 0x300
-#define MAX_MAC_INFO_LEVEL 0x3FF
-#define SMB_QFS_MAC_FS_INFO 0x301
-
-
-
-/* UNIX CIFS Extensions - created by HP */
-/*
- * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
- * Supposedly Microsoft have agreed to this.
- */
-
-#define MIN_UNIX_INFO_LEVEL 0x200
-#define MAX_UNIX_INFO_LEVEL 0x2FF
-
-#define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL))
-
-#define SMB_QFILEINFO_UNIX_BASIC 0x200 /* UNIX File Info*/
-#define SMB_SFILEINFO_UNIX_BASIC 0x200
-
-#define SMB_MODE_NO_CHANGE 0xFFFFFFFF /* file mode value which */
- /* means "don't change it" */
-#define SMB_UID_NO_CHANGE 0xFFFFFFFF
-#define SMB_GID_NO_CHANGE 0xFFFFFFFF
-
-#define SMB_SIZE_NO_CHANGE_LO 0xFFFFFFFF
-#define SMB_SIZE_NO_CHANGE_HI 0xFFFFFFFF
-
-#define SMB_TIME_NO_CHANGE_LO 0xFFFFFFFF
-#define SMB_TIME_NO_CHANGE_HI 0xFFFFFFFF
-
-/*
-Offset Size Name
-0 LARGE_INTEGER EndOfFile File size
-8 LARGE_INTEGER Blocks Number of bytes used on disk (st_blocks).
-16 LARGE_INTEGER CreationTime Creation time
-24 LARGE_INTEGER LastAccessTime Last access time
-32 LARGE_INTEGER LastModificationTime Last modification time
-40 LARGE_INTEGER Uid Numeric user id for the owner
-48 LARGE_INTEGER Gid Numeric group id of owner
-56 ULONG Type Enumeration specifying the pathname type:
- 0 -- File
- 1 -- Directory
- 2 -- Symbolic link
- 3 -- Character device
- 4 -- Block device
- 5 -- FIFO (named pipe)
- 6 -- Unix domain socket
-
-60 LARGE_INTEGER devmajor Major device number if type is device
-68 LARGE_INTEGER devminor Minor device number if type is device
-76 LARGE_INTEGER uniqueid This is a server-assigned unique id for the file. The client
- will typically map this onto an inode number. The scope of
- uniqueness is the share.
-84 LARGE_INTEGER permissions Standard UNIX file permissions - see below.
-92 LARGE_INTEGER nlinks The number of directory entries that map to this entry
- (number of hard links)
-
-100 - end.
-*/
-
-/* UNIX filetype mappings. */
-
-#define UNIX_TYPE_FILE 0
-#define UNIX_TYPE_DIR 1
-#define UNIX_TYPE_SYMLINK 2
-#define UNIX_TYPE_CHARDEV 3
-#define UNIX_TYPE_BLKDEV 4
-#define UNIX_TYPE_FIFO 5
-#define UNIX_TYPE_SOCKET 6
-#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF
-
-/*
- * Oh this is fun. "Standard UNIX permissions" has no
- * meaning in POSIX. We need to define the mapping onto
- * and off the wire as this was not done in the original HP
- * spec. JRA.
- */
-
-#define UNIX_X_OTH 0000001
-#define UNIX_W_OTH 0000002
-#define UNIX_R_OTH 0000004
-#define UNIX_X_GRP 0000010
-#define UNIX_W_GRP 0000020
-#define UNIX_R_GRP 0000040
-#define UNIX_X_USR 0000100
-#define UNIX_W_USR 0000200
-#define UNIX_R_USR 0000400
-#define UNIX_STICKY 0001000
-#define UNIX_SET_GID 0002000
-#define UNIX_SET_UID 0004000
-
-/* Masks for the above */
-#define UNIX_OTH_MASK 0000007
-#define UNIX_GRP_MASK 0000070
-#define UNIX_USR_MASK 0000700
-#define UNIX_PERM_MASK 0000777
-#define UNIX_EXTRA_MASK 0007000
-#define UNIX_ALL_MASK 0007777
-
-#define SMB_QFILEINFO_UNIX_LINK 0x201
-#define SMB_SFILEINFO_UNIX_LINK 0x201
-#define SMB_SFILEINFO_UNIX_HLINK 0x203
-
-#define SMB_FIND_FILE_UNIX 0x202
-
-/*
- Info level for QVOLINFO - returns version of CIFS UNIX extensions, plus
- 64-bits worth of capability fun :-).
-*/
-
-#define SMB_QUERY_CIFS_UNIX_INFO 0x200
-
-/* Returns the following.
-
- UINT16 major version number
- UINT16 minor version number
- LARGE_INTEGER capability bitfield
-
-*/
-
-#define CIFS_UNIX_MAJOR_VERSION 1
-#define CIFS_UNIX_MINOR_VERSION 0
-
-#define CIFS_UNIX_FCNTL_LOCKS_CAP 0x1
-#define CIFS_UNIX_POSIX_ACLS_CAP 0x2
-
-/* ... more as we think of them :-). */
-
-#endif