This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[sfrench/samba-autobuild/.git] / source3 / include / smb.h
index c6045991800a1ac1bf0d484bfb31e8edf09c4ab5..5bf79b75fe6462446ef81a2b26c500b669f4d18f 100644 (file)
@@ -3,7 +3,7 @@
    SMB parameters and setup, plus a whole lot more.
    
    Copyright (C) Andrew Tridgell              1992-2000
-   Copyright (C) John H Terpstra              1996-2000
+   Copyright (C) John H Terpstra              1996-2002
    Copyright (C) Luke Kenneth Casson Leighton 1996-2000
    Copyright (C) Paul Ashton                  1998-2000
    Copyright (C) Simo Sorce                   2001-2002
@@ -38,7 +38,9 @@
 
 #define NMB_PORT 137
 #define DGRAM_PORT 138
-#define SMB_PORT 139
+#define SMB_PORT1 445
+#define SMB_PORT2 139
+#define SMB_PORTS "445 139"
 
 #define False (0)
 #define True (1)
@@ -159,6 +161,8 @@ typedef uint16 smb_ucs2_t;
 typedef smb_ucs2_t wpstring[PSTRING_LEN];
 typedef smb_ucs2_t wfstring[FSTRING_LEN];
 
+/* This error code can go into the client smb_rw_error. */
+#define WRITE_ERROR 4
 
 #ifdef WORDS_BIGENDIAN
 #define UCS2_SHIFT 8
@@ -183,6 +187,17 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN];
 #define PIPE_SPOOLSS  "\\PIPE\\spoolss"
 #define PIPE_NETDFS   "\\PIPE\\netdfs"
 
+#define PI_LSARPC              0
+#define PI_LSARPC_V2           1
+#define PI_SAMR                        2
+#define PI_NETLOGON            3
+#define PI_SRVSVC              4
+#define PI_WKSSVC              5
+#define PI_WINREG              6
+#define PI_SPOOLSS             7
+#define PI_NETDFS              8
+#define PI_MAX_PIPES           9
+
 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
 typedef struct nttime_info
 {
@@ -191,44 +206,6 @@ typedef struct nttime_info
 } NTTIME;
 
 
-/* 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 v;} NTSTATUS;
-#define NT_STATUS(x) ((NTSTATUS) { x })
-#define NT_STATUS_V(x) ((x).v)
-#else
-typedef uint32 NTSTATUS;
-#define NT_STATUS(x) (x)
-#define NT_STATUS_V(x) (x)
-#endif
-
-#if defined(HAVE_IMMEDIATE_STRUCTURES)
-typedef struct {uint32 v;} WERROR;
-#define W_ERROR(x) ((WERROR) { x })
-#define W_ERROR_V(x) ((x).v)
-#else
-typedef uint32 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)
-#define NT_STATUS_EQUAL(x,y) (NT_STATUS_V(x) == NT_STATUS_V(y))
-#define W_ERROR_IS_OK(x) (W_ERROR_V(x) == 0)
-
-
 /* Allowable account control bits */
 #define ACB_DISABLED   0x0001  /* 1 = User account disabled */
 #define ACB_HOMDIRREQ  0x0002  /* 1 = Home directory required */
@@ -248,6 +225,20 @@ typedef uint32 WERROR;
 #define MAXSUBAUTHS 15 /* max sub authorities in a SID */
 #endif
 
+/* SID Types */
+enum SID_NAME_USE
+{
+       SID_NAME_USE_NONE = 0,/* NOTUSED */
+       SID_NAME_USER    = 1, /* user */
+       SID_NAME_DOM_GRP = 2, /* domain group */
+       SID_NAME_DOMAIN  = 3, /* domain: don't know what this is */
+       SID_NAME_ALIAS   = 4, /* local group */
+       SID_NAME_WKN_GRP = 5, /* well-known group */
+       SID_NAME_DELETED = 6, /* deleted account: needed for c2 rating */
+       SID_NAME_INVALID = 7, /* invalid account */
+       SID_NAME_UNKNOWN = 8  /* oops. */
+};
+
 /**
  * @brief Security Identifier
  *
@@ -369,12 +360,13 @@ typedef struct files_struct
        int fnum;
        struct connection_struct *conn;
        int fd;
-       int print_jobid;
+       uint32 print_jobid;
        SMB_DEV_T dev;
        SMB_INO_T inode;
        BOOL delete_on_close;
        SMB_OFF_T pos;
        SMB_OFF_T size;
+       SMB_OFF_T initial_allocation_size; /* Faked up initial allocation on disk. */
        mode_t mode;
        uint16 vuid;
        write_bmpx_struct *wbmpx_ptr;
@@ -414,9 +406,9 @@ typedef struct
   time_t status_time;
 } dir_status_struct;
 
-struct uid_cache {
-  int entries;
-  uid_t list[UID_CACHE_SIZE];
+struct vuid_cache {
+  unsigned int entries;
+  uint16 list[VUID_CACHE_SIZE];
 };
 
 typedef struct
@@ -430,13 +422,23 @@ typedef struct
 #include "smb_acls.h"
 #include "vfs.h"
 
+typedef struct smb_vfs_handle_struct
+{
+    void *data;
+    /* Handle on dlopen() call */
+    void *handle;
+    struct smb_vfs_handle_struct  *next, *prev;
+    
+} smb_vfs_handle_struct;
+
 typedef struct connection_struct
 {
        struct connection_struct *next, *prev;
        unsigned cnum; /* an index passed over the wire */
        int service;
        BOOL force_user;
-       struct uid_cache uid_cache;
+       BOOL force_group;
+       struct vuid_cache vuid_cache;
        void *dirptr;
        BOOL printer;
        BOOL ipc;
@@ -447,9 +449,7 @@ typedef struct connection_struct
        char *origpath;
 
        struct vfs_ops vfs_ops;                   /* Filesystem operations */
-       /* Handle on dlopen() call */
-       void *dl_handle;
-       void *vfs_private;
+       struct smb_vfs_handle_struct *vfs_private;
 
        char *user; /* name of user who *opened* this connection */
        uid_t uid; /* uid of user who *opened* this connection */
@@ -624,12 +624,12 @@ typedef struct sam_passwd
                
                uid_t uid;          /* this is a unix uid_t */
                gid_t gid;          /* this is a unix gid_t */
-               uint32 user_rid;    /* Primary User ID */
-               uint32 group_rid;   /* Primary Group ID */
+               DOM_SID user_sid;    /* Primary User SID */
+               DOM_SID group_sid;   /* Primary Group SID */
                
                DATA_BLOB lm_pw; /* .data is Null if no password */
                DATA_BLOB nt_pw; /* .data is Null if no password */
-               DATA_BLOB plaintext_pw; /* .data is Null if not available */
+               char* plaintext_pw; /* is Null if not available */
                
                uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
                uint32 unknown_3; /* 0x00ff ffff */
@@ -693,6 +693,7 @@ struct connections_data {
        char addr[24];
        char machine[FSTRING_LEN];
        time_t start;
+       uint32 bcast_msg_flags;
 };
 
 
@@ -765,12 +766,16 @@ struct bitmap {
        int n;
 };
 
-#define FLAG_BASIC     0x01 /* fundamental options */
-#define FLAG_SHARE     0x02 /* file sharing options */
-#define FLAG_PRINT     0x04 /* printing options */
-#define FLAG_GLOBAL    0x08 /* local options that should be globally settable in SWAT */
-#define FLAG_DEPRECATED 0x10 /* options that should no longer be used */
-#define FLAG_HIDE      0x20 /* options that should be hidden in SWAT */
+#define FLAG_BASIC     0x0001 /* fundamental options */
+#define FLAG_SHARE     0x0002 /* file sharing options */
+#define FLAG_PRINT     0x0004 /* printing options */
+#define FLAG_GLOBAL    0x0008 /* local options that should be globally settable in SWAT */
+#define FLAG_WIZARD    0x0010 /* Parameters that the wizard will operate on */
+#define FLAG_ADVANCED  0x0020 /* Parameters that the wizard will operate on */
+#define FLAG_DEVELOPER         0x0040 /* Parameters that the wizard will operate on */
+#define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
+#define FLAG_HIDE      0x2000 /* options that should be hidden in SWAT */
+#define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */
 
 #ifndef LOCKING_VERSION
 #define LOCKING_VERSION 4
@@ -787,7 +792,8 @@ struct bitmap {
 #define smb_err 11
 #define smb_flg 13
 #define smb_flg2 14
-#define smb_reb 13
+#define smb_pidhigh 16
+#define smb_ss_field 18
 #define smb_tid 28
 #define smb_pid 30
 #define smb_uid 32
@@ -1123,17 +1129,17 @@ struct bitmap {
 #define FILE_SHARE_DELETE 4
 
 /* FileAttributesField */
-#define FILE_ATTRIBUTE_READONLY aRONLY
-#define FILE_ATTRIBUTE_HIDDEN aHIDDEN
-#define FILE_ATTRIBUTE_SYSTEM aSYSTEM
-#define FILE_ATTRIBUTE_DIRECTORY aDIR
-#define FILE_ATTRIBUTE_ARCHIVE aARCH
-#define FILE_ATTRIBUTE_NORMAL 0x80L
-#define FILE_ATTRIBUTE_TEMPORARY 0x100L
-#define FILE_ATTRIBUTE_SPARSE 0x200L
-#define FILE_ATTRIBUTE_COMPRESSED 0x800L
-#define FILE_ATTRIBUTE_NONINDEXED 0x2000L
-#define SAMBA_ATTRIBUTES_MASK 0x7F
+#define FILE_ATTRIBUTE_READONLY                0x001L
+#define FILE_ATTRIBUTE_HIDDEN          0x002L
+#define FILE_ATTRIBUTE_SYSTEM          0x004L
+#define FILE_ATTRIBUTE_DIRECTORY       0x010L
+#define FILE_ATTRIBUTE_ARCHIVE         0x020L
+#define FILE_ATTRIBUTE_NORMAL          0x080L
+#define FILE_ATTRIBUTE_TEMPORARY       0x100L
+#define FILE_ATTRIBUTE_SPARSE          0x200L
+#define FILE_ATTRIBUTE_COMPRESSED      0x800L
+#define FILE_ATTRIBUTE_NONINDEXED      0x2000L
+#define SAMBA_ATTRIBUTES_MASK          0x7F
 
 /* Flags - combined with attributes. */
 #define FILE_FLAG_WRITE_THROUGH    0x80000000L
@@ -1161,8 +1167,10 @@ struct bitmap {
 #define FILE_EIGHT_DOT_THREE_ONLY 0x0400
 #define FILE_RANDOM_ACCESS        0x0800
 #define FILE_DELETE_ON_CLOSE      0x1000
+#define FILE_OPEN_BY_FILE_ID     0x2000
 
 /* Responses when opening a file. */
+#define FILE_WAS_SUPERSEDED 0
 #define FILE_WAS_OPENED 1
 #define FILE_WAS_CREATED 2
 #define FILE_WAS_OVERWRITTEN 3
@@ -1275,7 +1283,7 @@ char *strdup(char *s);
  */
  
 #define DEFAULT_MAJOR_VERSION 0x04
-#define DEFAULT_MINOR_VERSION 0x05
+#define DEFAULT_MINOR_VERSION 0x09
 
 /* Browser Election Values */
 #define BROWSER_ELECTION_VERSION       0x010f
@@ -1289,17 +1297,17 @@ char *strdup(char *s);
 
 /* NT Flags2 bits - cifs6.txt section 3.1.2 */
    
-#define FLAGS2_LONG_PATH_COMPONENTS   0x0001
-#define FLAGS2_EXTENDED_ATTRIBUTES    0x0002
-#define FLAGS2_SMB_SECUIRTY_SIGNITURES 0x0004
-#define FLAGS2_IS_LONG_NAME           0x0040
-#define FLAGS2_EXTENDED_SECURITY      0x0800 
-#define FLAGS2_DFS_PATHNAMES          0x1000
-#define FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000
-#define FLAGS2_32_BIT_ERROR_CODES     0x4000 
-#define FLAGS2_UNICODE_STRINGS        0x8000
-
-#define FLAGS2_WIN2K_SIGNATURE        0xC852 /* Hack alert ! For now... JRA. */
+#define FLAGS2_LONG_PATH_COMPONENTS    0x0001
+#define FLAGS2_EXTENDED_ATTRIBUTES     0x0002
+#define FLAGS2_SMB_SECURITY_SIGNATURES 0x0004
+#define FLAGS2_IS_LONG_NAME            0x0040
+#define FLAGS2_EXTENDED_SECURITY       0x0800 
+#define FLAGS2_DFS_PATHNAMES           0x1000
+#define FLAGS2_READ_PERMIT_NO_EXECUTE  0x2000
+#define FLAGS2_32_BIT_ERROR_CODES      0x4000 
+#define FLAGS2_UNICODE_STRINGS         0x8000
+
+#define FLAGS2_WIN2K_SIGNATURE         0xC852 /* Hack alert ! For now... JRA. */
 
 /* Capabilities.  see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
 
@@ -1351,6 +1359,9 @@ enum schema_types {SCHEMA_COMPAT, SCHEMA_AD, SCHEMA_SAMBA};
 /* LDAP SSL options */
 enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS};
 
+/* LDAP PASSWD SYNC methods */
+enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};
+
 /* Remote architectures we know about. */
 enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_SAMBA};
 
@@ -1365,30 +1376,6 @@ enum case_handling {CASE_LOWER,CASE_UPPER};
 #define UID_FIELD_INVALID 0
 #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */
 
-/* Defines needed for multi-codepage support. */
-#define MSDOS_LATIN_1_CODEPAGE 850
-#define KANJI_CODEPAGE 932
-#define HANGUL_CODEPAGE 949
-#define BIG5_CODEPAGE 950
-#define SIMPLIFIED_CHINESE_CODEPAGE 936
-
-#ifdef KANJI
-/* 
- * Default client code page - Japanese 
- */
-#define DEFAULT_CLIENT_CODE_PAGE KANJI_CODEPAGE
-#else /* KANJI */
-/* 
- * Default client code page - 850 - Western European 
- */
-#define DEFAULT_CLIENT_CODE_PAGE MSDOS_LATIN_1_CODEPAGE
-#endif /* KANJI */
-
-/* Global val set if multibyte codepage. */
-extern int global_is_multibyte_codepage;
-
-#define get_character_len(x) (global_is_multibyte_codepage ? skip_multibyte_char((x)) : 0)
-
 /* 
  * Size of buffer to use when moving files across filesystems. 
  */
@@ -1603,7 +1590,10 @@ typedef struct user_struct
 
        uint8 session_key[16];
 
-       int session_id; /* used by utmp and pam session code */
+       char *session_keystr; /* used by utmp and pam session code.  
+                                TDB key string */
+       int homes_snum;
+
 } user_struct;
 
 
@@ -1653,8 +1643,6 @@ struct unix_error_map {
 
 #define SAFE_NETBIOS_CHARS ". -_"
 
-#include "nsswitch/winbindd_nss.h"
-
 /* generic iconv conversion structure */
 typedef struct {
        size_t (*direct)(void *cd, char **inbuf, size_t *inbytesleft,
@@ -1673,4 +1661,8 @@ typedef struct {
 
 #define DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH 14
 
+/* Common popt structures */
+
+extern struct poptOption popt_common_debug[];
+
 #endif /* _SMB_H */