security descriptors
[samba.git] / source3 / include / smb.h
index 90435b208e3115a95abc6d9eb1a86229eaebf474..9339cdda6f06e5c3e622613cfce6e776b039e685 100644 (file)
 #define IS_BITS_SET_SOME(var,bit) (((var)&(bit))!=0)
 #define IS_BITS_CLR_ALL(var,bit) (((var)&(~(bit)))==0)
 
-#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((char *)(p1)) - (char *)(p2)))
+#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
 
 typedef int BOOL;
 
 /* limiting size of ipc replies */
 #define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024))
 
-/*
-   Samba needs type definitions for int16, int32, uint16 and uint32.
-   
-   Normally these are signed and unsigned 16 and 32 bit integers, but
-   they actually only need to be at least 16 and 32 bits
-   respectively. Thus if your word size is 8 bytes just defining them
-   as signed and unsigned int will work.
-*/
-
-#ifndef uint8
-typedef unsigned char uint8;
-#endif
-
-#ifndef uint16
-typedef unsigned short uint16;
-#endif
-
-#ifndef uchar
-#define uchar unsigned char
-#endif
-
-#ifndef int16
-#define int16 short
-#endif
-
-#ifndef uint16
-#define uint16 unsigned short
-#endif
-
 #define SIZEOFWORD 2
 
 #ifndef DEF_CREATE_MASK
@@ -215,6 +186,52 @@ implemented */
 #define DENY_NONE 4
 #define DENY_FCB 7
 
+/* open modes */
+#define DOS_OPEN_RDONLY 0
+#define DOS_OPEN_WRONLY 1
+#define DOS_OPEN_RDWR 2
+#define DOS_OPEN_FCB 0xF
+
+/* define shifts and masks for share and open modes. */
+#define OPEN_MODE_MASK 0xF
+#define SHARE_MODE_SHIFT 4
+#define SHARE_MODE_MASK 0x7
+#define GET_OPEN_MODE(x) ((x) & OPEN_MODE_MASK)
+#define SET_OPEN_MODE(x) ((x) & OPEN_MODE_MASK)
+#define GET_DENY_MODE(x) (((x)>>SHARE_MODE_SHIFT) & SHARE_MODE_MASK)
+#define SET_DENY_MODE(x) ((x)<<SHARE_MODE_SHIFT)
+
+/* Sync on open file (not sure if used anymore... ?) */
+#define FILE_SYNC_OPENMODE (1<<14)
+#define GET_FILE_SYNC_OPENMODE(x) (((x) & FILE_SYNC_OPENMODE) ? True : False)
+
+/* allow delete on open file mode (used by NT SMB's). */
+#define ALLOW_SHARE_DELETE (1<<15)
+#define GET_ALLOW_SHARE_DELETE(x) (((x) & ALLOW_SHARE_DELETE) ? True : False)
+#define SET_ALLOW_SHARE_DELETE(x) ((x) ? ALLOW_SHARE_DELETE : 0)
+
+/* delete on close flag (used by NT SMB's). */
+#define DELETE_ON_CLOSE_FLAG (1<<16)
+#define GET_DELETE_ON_CLOSE_FLAG(x) (((x) & DELETE_ON_CLOSE_FLAG) ? True : False)
+#define SET_DELETE_ON_CLOSE_FLAG(x) ((x) ? DELETE_ON_CLOSE_FLAG : 0)
+
+/* open disposition values */
+#define FILE_EXISTS_FAIL 0
+#define FILE_EXISTS_OPEN 1
+#define FILE_EXISTS_TRUNCATE 2
+
+/* mask for open disposition. */
+#define FILE_OPEN_MASK 0x3
+
+#define GET_FILE_OPEN_DISPOSITION(x) ((x) & FILE_OPEN_MASK)
+#define SET_FILE_OPEN_DISPOSITION(x) ((x) & FILE_OPEN_MASK)
+
+/* The above can be OR'ed with... */
+#define FILE_CREATE_IF_NOT_EXIST 0x10
+#define FILE_FAIL_IF_NOT_EXIST 0
+
+#define GET_FILE_CREATE_DISPOSITION(x) ((x) & (FILE_CREATE_IF_NOT_EXIST|FILE_FAIL_IF_NOT_EXIST))
+
 /* share types */
 #define STYPE_DISKTREE  0      /* Disk drive */
 #define STYPE_PRINTQ    1      /* Spooler queue */
@@ -245,6 +262,7 @@ implemented */
 #define ERRfilexists 80 /* File in operation already exists */
 #define ERRcannotopen 110 /* Cannot open the file specified */
 #define ERRunknownlevel 124
+#define ERRrename 183
 #define ERRbadpipe 230 /* Named pipe invalid */
 #define ERRpipebusy 231 /* All instances of pipe are busy */
 #define ERRpipeclosing 232 /* named pipe close in progress */
@@ -319,10 +337,11 @@ implemented */
 typedef char pstring[1024];
 typedef char fstring[128];
 
-/* pipe strings */
+/* pipe string names */
 #define PIPE_LANMAN   "\\PIPE\\LANMAN"
 #define PIPE_SRVSVC   "\\PIPE\\srvsvc"
 #define PIPE_SAMR     "\\PIPE\\samr"
+#define PIPE_WINREG   "\\PIPE\\winreg"
 #define PIPE_WKSSVC   "\\PIPE\\wkssvc"
 #define PIPE_NETLOGON "\\PIPE\\NETLOGON"
 #define PIPE_NTLSA    "\\PIPE\\ntlsa"
@@ -374,8 +393,8 @@ struct sam_passwd
        char *unknown_str ; /* don't know what this is, yet. */
        char *munged_dial ; /* munged path name and dial-back tel number */
 
-       int smb_userid;       /* this is actually the unix uid_t */
-       int smb_grpid;        /* this is actually the unix gid_t */
+       uid_t smb_userid;       /* this is actually the unix uid_t */
+       gid_t smb_grpid;        /* this is actually the unix gid_t */
        uint32 user_rid;      /* Primary User ID */
        uint32 group_rid;     /* Primary Group ID */
 
@@ -395,7 +414,7 @@ struct sam_passwd
 
 struct smb_passwd
 {
-       int smb_userid;     /* this is actually the unix uid_t */
+       uid_t smb_userid;     /* this is actually the unix uid_t */
        char *smb_name;     /* username string */
 
        unsigned char *smb_passwd; /* Null if no password */
@@ -413,6 +432,66 @@ struct sam_disp_info
        char *full_name;    /* user's full name string */
 };
 
+#define MAXSUBAUTHS 15 /* max sub authorities in a SID */
+
+/* DOM_SID - security id */
+typedef struct sid_info
+{
+  uint8  sid_rev_num;             /* SID revision number */
+  uint8  num_auths;               /* number of sub-authorities */
+  uint8  id_auth[6];              /* Identifier Authority */
+  /*
+   * Note that the values in these uint32's are in *native* byteorder,
+   * not neccessarily little-endian...... JRA.
+   */
+  uint32 sub_auths[MAXSUBAUTHS];  /* pointer to sub-authorities. */
+
+} DOM_SID;
+
+
+/*** query a local group, get a list of these: shows who is in that group ***/
+
+/* local group member info */
+typedef struct local_grp_member_info
+{
+       DOM_SID sid    ; /* matches with name */
+       uint8   sid_use; /* usr=1 grp=2 dom=3 alias=4 wkng=5 del=6 inv=7 unk=8 */
+       fstring name   ; /* matches with sid: must be of the form "DOMAIN\account" */
+
+} LOCAL_GRP_MEMBER;
+
+/* enumerate these to get list of local groups */
+
+/* local group info */
+typedef struct local_grp_info
+{
+       fstring name;
+       fstring comment;
+
+} LOCAL_GRP;
+
+/*** enumerate these to get list of domain groups ***/
+
+/* domain group member info */
+typedef struct domain_grp_info
+{
+       fstring name;
+       fstring comment;
+       uint32  rid; /* group rid */
+       uint8   attr; /* attributes forced to be set to 0x7: SE_GROUP_xxx */
+
+} DOMAIN_GRP;
+
+/*** query a domain group, get a list of these: shows who is in that group ***/
+
+/* domain group info */
+typedef struct domain_grp_member_info
+{
+       fstring name;
+       uint8   attr; /* attributes forced to be set to 0x7: SE_GROUP_xxx */
+
+} DOMAIN_GRP_MEMBER;
+
 /* DOM_CHAL - challenge info */
 typedef struct chal_info
 {
@@ -432,62 +511,10 @@ typedef struct cred_info
   UTIME timestamp;    /* credential time-stamp */
 } DOM_CRED;
 
-struct cli_state {
-  int fd;
-  int cnum;
-  int pid;
-  int mid;
-  int uid;
-  int protocol;
-  int sec_mode;
-  int rap_error;
-  int privilages;
-  fstring eff_name;
-  fstring desthost;
-  char cryptkey[8];
-  uint32 sesskey;
-  int serverzone;
-  uint32 servertime;
-  int readbraw_supported;
-  int writebraw_supported;
-  int timeout;
-  int max_xmit;
-  char *outbuf;
-  char *inbuf;
-  int bufsize;
-  int initialised;
-  /*
-   * Only used in NT domain calls.
-   */
-  uint32 nt_error;                   /* NT RPC error code. */
-  uint16 nt_pipe_fnum;               /* Pipe handle. */
-  unsigned char sess_key[16];        /* Current session key. */
-  DOM_CRED clnt_cred;                /* Client credential. */
-  fstring mach_acct;                 /* MYNAME$. */
-  fstring srv_name_slash;            /* \\remote server. */
-  fstring clnt_name_slash;            /* \\local client. */
-};
-
-
-typedef struct
-{
-  int size;
-  int mode;
-  int uid;
-  int gid;
-  /* these times are normally kept in GMT */
-  time_t mtime;
-  time_t atime;
-  time_t ctime;
-  pstring name;
-
-} file_info;
-
-
 /* Structure used when SMBwritebmpx is active */
 typedef struct
 {
-  int   wr_total_written; /* So we know when to discard this */
+  size_t wr_total_written; /* So we know when to discard this */
   int32 wr_timeout;
   int32 wr_errclass;
   int32 wr_error; /* Cached errors */
@@ -507,13 +534,13 @@ typedef struct file_fd_struct
        uint16 ref_count;
        uint16 uid_cache_count;
        uid_t uid_users_cache[10];
-       uint32 dev;
-       uint32 inode;
+       SMB_DEV_T dev;
+       SMB_INO_T inode;
        int fd;
-       int fdnum;
        int fd_readonly;
        int fd_writeonly;
        int real_open_flags;
+       BOOL delete_on_close;
 } file_fd_struct;
 
 /*
@@ -529,7 +556,7 @@ typedef struct
 
 struct uid_cache {
   int entries;
-  int list[UID_CACHE_SIZE];
+  uid_t list[UID_CACHE_SIZE];
 };
 
 typedef struct
@@ -554,8 +581,8 @@ typedef struct connection_struct
        char *connectpath;
        char *origpath;
        char *user; /* name of user who *opened* this connection */
-       int uid; /* uid of user who *opened* this connection */
-       int gid; /* gid of user who *opened* this connection */
+       uid_t uid; /* uid of user who *opened* this connection */
+       gid_t gid; /* gid of user who *opened* this connection */
 
        uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
 
@@ -563,7 +590,7 @@ typedef struct connection_struct
 
        /* This groups info is valid for the user that *opened* the connection */
        int ngroups;
-       GID_T *groups;
+       gid_t *groups;
        
        time_t lastused;
        BOOL used;
@@ -571,15 +598,17 @@ typedef struct connection_struct
        name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
        name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
        name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */       
+
 } connection_struct;
 
 struct current_user
 {
        connection_struct *conn;
-       int vuid;
-       int uid, gid;
+       uint16 vuid;
+       uid_t uid;
+       gid_t gid;
        int ngroups;
-       GID_T *groups;
+       gid_t *groups;
 };
 
 typedef struct files_struct
@@ -588,19 +617,19 @@ typedef struct files_struct
        int fnum;
        connection_struct *conn;
        file_fd_struct *fd_ptr;
-       int pos;
-       uint32 size;
-       int mode;
-       int vuid;
+       SMB_OFF_T pos;
+       SMB_OFF_T size;
+       mode_t mode;
+       uint16 vuid;
        char *mmap_ptr;
-       uint32 mmap_size;
+       SMB_OFF_T mmap_size;
        write_bmpx_struct *wbmpx_ptr;
        struct timeval open_time;
+       int share_mode;
        BOOL open;
        BOOL can_lock;
        BOOL can_read;
        BOOL can_write;
-       BOOL share_mode;
        BOOL print_file;
        BOOL modified;
        BOOL granted_oplock;
@@ -623,8 +652,8 @@ struct dcinfo
 
 typedef struct
 {
-  int uid; /* uid of a validated user */
-  int gid; /* gid of a validated user */
+  uid_t uid; /* uid of a validated user */
+  gid_t gid; /* gid of a validated user */
 
   fstring requested_name; /* user name from the client */
   fstring name; /* unix user name of a validated user */
@@ -634,7 +663,7 @@ typedef struct
   /* following groups stuff added by ih */
   /* This groups info is needed for when we become_user() for this uid */
   int n_groups;
-  GID_T *groups;
+  gid_t *groups;
 
   int n_sids;
   int *sids;
@@ -701,12 +730,12 @@ typedef struct
    to support the following operations */
 struct share_ops {
        BOOL (*stop_mgmt)(void);
-       BOOL (*lock_entry)(connection_struct *, uint32 , uint32 , int *);
-       BOOL (*unlock_entry)(connection_struct *, uint32 , uint32 , int );
-       int (*get_entries)(connection_struct *, int , uint32 , uint32 , share_mode_entry **);
+       BOOL (*lock_entry)(connection_struct *, SMB_DEV_T , SMB_INO_T , int *);
+       BOOL (*unlock_entry)(connection_struct *, SMB_DEV_T , SMB_INO_T , int );
+       int (*get_entries)(connection_struct *, int , SMB_DEV_T , SMB_INO_T , share_mode_entry **);
        void (*del_entry)(int , files_struct *);
        BOOL (*set_entry)(int, files_struct *, uint16 , uint16 );
-       BOOL (*remove_oplock)(files_struct *, int);
+    BOOL (*mod_entry)(int, files_struct *, void (*)(share_mode_entry *, SMB_DEV_T, SMB_INO_T, void *), void *);
        int (*forall)(void (*)(share_mode_entry *, char *));
        void (*status)(FILE *);
 };
@@ -737,14 +766,15 @@ struct passdb_ops {
    */
   void *(*startsmbpwent)(BOOL);
   void (*endsmbpwent)(void *);
-  unsigned long (*getsmbpwpos)(void *);
-  BOOL (*setsmbpwpos)(void *, unsigned long);
+  SMB_BIG_UINT (*getsmbpwpos)(void *);
+  BOOL (*setsmbpwpos)(void *, SMB_BIG_UINT);
 
   /*
    * smb password database query functions.
    */
   struct smb_passwd *(*getsmbpwnam)(char *);
   struct smb_passwd *(*getsmbpwuid)(uid_t);
+  struct smb_passwd *(*getsmbpwrid)(uint32);
   struct smb_passwd *(*getsmbpwent)(void *);
 
   /*
@@ -795,8 +825,8 @@ struct connect_record
   int magic;
   int pid;
   int cnum;
-  int uid;
-  int gid;
+  uid_t uid;
+  gid_t gid;
   char name[24];
   char addr[24];
   char machine[128];
@@ -808,7 +838,7 @@ struct connection_options {
   int protocol;
   /* Connection-Options */
   uint32 max_xmit;
-  uint16 server_uid;
+  uint16 server_vuid;
   uint16 tid;
   /* The following are LANMAN 1.0 options */
   uint16 sec_mode;
@@ -865,7 +895,7 @@ struct bitmap {
 #define FLAG_HIDE  2 /* options that should be hidden in SWAT */
 #define FLAG_PRINT 4 /* printing options */
 #define FLAG_GLOBAL 8 /* local options that should be globally settable in SWAT */
-#define FLAG_DEPRECATED 16 /* options that should no longer be used */
+#define FLAG_DEPRECATED 0x10 /* options that should no longer be used */
 
 #ifndef LOCKING_VERSION
 #define LOCKING_VERSION 4
@@ -954,6 +984,15 @@ struct bitmap {
 #define smb_vwv16 69
 #define smb_vwv17 71
 
+/* flag defines. CIFS spec 3.1.1 */
+#define FLAG_SUPPORT_LOCKREAD       0x01
+#define FLAG_CLIENT_BUF_AVAIL       0x02
+#define FLAG_RESERVED               0x04
+#define FLAG_CASELESS_PATHNAMES     0x08
+#define FLAG_CANONICAL_PATHNAMES    0x10
+#define FLAG_REQUEST_OPLOCK         0x20
+#define FLAG_REQUEST_BATCH_OPLOCK   0x40
+#define FLAG_REPLY                  0x80
 
 /* the complete */
 #define SMBmkdir      0x00   /* create directory */
@@ -1144,7 +1183,7 @@ struct bitmap {
 /* these are for the NT create_and_X */
 #define smb_ntcreate_NameLength (smb_vwv0 + 5)
 #define smb_ntcreate_Flags (smb_vwv0 + 7)
-#define smb_ntcreate_RootDirectoryFid (smb_wvw0 + 11)
+#define smb_ntcreate_RootDirectoryFid (smb_vwv0 + 11)
 #define smb_ntcreate_DesiredAccess (smb_vwv0 + 15)
 #define smb_ntcreate_AllocationSize (smb_vwv0 + 19)
 #define smb_ntcreate_FileAttributes (smb_vwv0 + 27)
@@ -1154,6 +1193,9 @@ struct bitmap {
 #define smb_ntcreate_ImpersonationLevel (smb_vwv0 + 43)
 #define smb_ntcreate_SecurityFlags (smb_vwv0 + 47)
 
+/* this is used on a TConX. I'm not sure the name is very helpful though */
+#define SMB_SUPPORT_SEARCH_BITS        0x0001
+
 /* these are the constants used in the above call. */
 /* DesiredAccess */
 /* File Specific access rights. */
@@ -1216,6 +1258,16 @@ struct bitmap {
 #define FILE_OVERWRITE 4
 #define FILE_OVERWRITE_IF 5
 
+/* CreateOptions field. */
+#define FILE_DIRECTORY_FILE       0x0001
+#define FILE_WRITE_THROUGH        0x0002
+#define FILE_SEQUENTIAL_ONLY      0x0004
+#define FILE_NON_DIRECTORY_FILE   0x0040
+#define FILE_NO_EA_KNOWLEDGE      0x0200
+#define FILE_EIGHT_DOT_THREE_ONLY 0x0400
+#define FILE_RANDOM_ACCESS        0x0800
+#define FILE_DELETE_ON_CLOSE      0x1000
+
 /* Responses when opening a file. */
 #define FILE_WAS_OPENED 1
 #define FILE_WAS_CREATED 2
@@ -1443,6 +1495,10 @@ enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1};
 #define SMB_LPID_OFFSET(indx) (10 * (indx))
 #define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx)))
 #define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx)))
+#define SMB_LARGE_LKOFF_OFFSET_HIGH(indx) (4 + (20 * (indx)))
+#define SMB_LARGE_LKOFF_OFFSET_LOW(indx) (8 + (20 * (indx)))
+#define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx)))
+#define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx)))
 
 /* Macro to cache an error in a write_bmpx_struct */
 #define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \
@@ -1509,7 +1565,8 @@ extern int unix_ERR_code;
 /*
  * Core protocol.
  */
-#define CORE_OPLOCK_REQUEST(inbuf) ((CVAL(inbuf,smb_flg)&((1<<5)|(1<<6)))>>5)
+#define CORE_OPLOCK_REQUEST(inbuf) \
+    ((CVAL(inbuf,smb_flg)&(FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK))>>5)
 
 /*
  * Extended protocol.
@@ -1540,31 +1597,55 @@ extern int unix_ERR_code;
  * Loopback command offsets.
  */
 
-#define UDP_CMD_LEN_OFFSET 0
-#define UDP_CMD_PORT_OFFSET 4
-#define UDP_CMD_HEADER_LEN 6
+#define OPBRK_CMD_LEN_OFFSET 0
+#define OPBRK_CMD_PORT_OFFSET 4
+#define OPBRK_CMD_HEADER_LEN 6
 
-#define UDP_MESSAGE_CMD_OFFSET 0
+#define OPBRK_MESSAGE_CMD_OFFSET 0
 
 /*
  * Oplock break command code to send over the udp socket.
  * 
  * Form of this is :
  *
- *  0     2       6        10       14      18       22
+ *  0     2       6        10       14    14+devsize 14+devsize+inodesize
  *  +----+--------+--------+--------+-------+--------+
- *  | cmd| pid    | dev    | inode  | sec   |  usec  |
+ *  | cmd| pid    | sec    | usec   | dev   |  inode |
  *  +----+--------+--------+--------+-------+--------+
  */
 
 #define OPLOCK_BREAK_CMD 0x1
 #define OPLOCK_BREAK_PID_OFFSET 2
-#define OPLOCK_BREAK_DEV_OFFSET 6
-#define OPLOCK_BREAK_INODE_OFFSET 10
-#define OPLOCK_BREAK_SEC_OFFSET 14
-#define OPLOCK_BREAK_USEC_OFFSET 18
-#define OPLOCK_BREAK_MSG_LEN 22
+#define OPLOCK_BREAK_SEC_OFFSET 6
+#define OPLOCK_BREAK_USEC_OFFSET 10
+#define OPLOCK_BREAK_DEV_OFFSET 14
+#define OPLOCK_BREAK_INODE_OFFSET (OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T))
+#define OPLOCK_BREAK_MSG_LEN (OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T))
+
+/*
+ * Capabilities abstracted for different systems.
+ */
+
+#define KERNEL_OPLOCK_CAPABILITY 0x1
+
+#if defined(HAVE_KERNEL_OPLOCKS)
+/*
+ * Oplock break command code sent via the kernel interface.
+ *
+ * Form of this is :
+ *
+ *  0     2       2+devsize 2+devsize+inodesize
+ *  +----+--------+--------+
+ *  | cmd| dev    |  inode |
+ *  +----+--------+--------+
+ */
+
+#define KERNEL_OPLOCK_BREAK_CMD 0x2
+#define KERNEL_OPLOCK_BREAK_DEV_OFFSET 2
+#define KERNEL_OPLOCK_BREAK_INODE_OFFSET (KERNEL_OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T))
+#define KERNEL_OPLOCK_BREAK_MSG_LEN (KERNEL_OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T))
 
+#endif /* HAVE_KERNEL_OPLOCKS */
 
 #define CMD_REPLY 0x8000
 
@@ -1574,7 +1655,9 @@ extern int unix_ERR_code;
 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
 
 /* zero a structure given a pointer to the structure */
-#define ZERO_STRUCTP(x) memset((char *)(x), 0, sizeof(*(x)))
+#define ZERO_STRUCTP(x) { memset((char *)(x), 0, sizeof(*(x))); }
+
+#define ZERO_STRUCTPN(x) { if (x != NULL) ZERO_STRUCTP(x); }
 
 /* zero an array - note that sizeof(array) must work - ie. it must not be a 
    pointer */
@@ -1585,8 +1668,49 @@ extern int unix_ERR_code;
                 __FILE__, __LINE__)), smb_panic("assert failed")))
 #define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n))
 
-#endif /* _SMB_H */
-
 #include "ntdomain.h"
 
+/* A netbios name structure. */
+struct nmb_name {
+  char         name[17];
+  char         scope[64];
+  unsigned int name_type;
+};
+
+#include "client.h"
+#include "rpcclient.h"
+
+/*
+ * Size of new password account encoding string. DO NOT CHANGE.
+ */
+
+#define NEW_PW_FORMAT_SPACE_PADDED_LEN 14
+
+/*
+   Do you want session setups at user level security with a invalid
+   password to be rejected or allowed in as guest? WinNT rejects them
+   but it can be a pain as it means "net view" needs to use a password
+
+   You have 3 choices in the setting of map_to_guest:
+
+   "NEVER_MAP_TO_GUEST" means session setups with an invalid password
+   are rejected. This is the default.
+
+   "MAP_TO_GUEST_ON_BAD_USER" means session setups with an invalid password
+   are rejected, unless the username does not exist, in which case it
+   is treated as a guest login
+
+   "MAP_TO_GUEST_ON_BAD_PASSWORD" means session setups with an invalid password
+   are treated as a guest login
+
+   Note that map_to_guest only has an effect in user or server
+   level security.
+*/
+
+#define NEVER_MAP_TO_GUEST 0
+#define MAP_TO_GUEST_ON_BAD_USER 1
+#define MAP_TO_GUEST_ON_BAD_PASSWORD 2
+
+#endif /* _SMB_H */
+
 /* _SMB_H */