r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
[tprouty/samba.git] / source / include / smb.h
index 722c34d9d3f99488cea62bc0e8d57581559aeaae..9db97243eaef5ed9a38338a3ff6138b3eaedbaa9 100644 (file)
@@ -11,7 +11,7 @@
    
    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
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -20,8 +20,7 @@
    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.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef _SMB_H
@@ -187,7 +186,7 @@ typedef uint32 codepoint_t;
 #define PIPE_NETDFS   "\\PIPE\\netdfs"
 #define PIPE_ECHO     "\\PIPE\\rpcecho"
 #define PIPE_SHUTDOWN "\\PIPE\\initshutdown"
-#define PIPE_EPM      "\\PIPE\\epmapper"
+#define PIPE_EPMAPPER "\\PIPE\\epmapper"
 #define PIPE_SVCCTL   "\\PIPE\\svcctl"
 #define PIPE_EVENTLOG "\\PIPE\\eventlog"
 #define PIPE_UNIXINFO    "\\PIPE\\unixinfo"
@@ -209,7 +208,8 @@ typedef uint32 codepoint_t;
 #define PI_EVENTLOG            12
 #define PI_UNIXINFO            13
 #define PI_NTSVCS              14
-#define PI_MAX_PIPES           15
+#define PI_EPMAPPER            15
+#define PI_MAX_PIPES           16
 
 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
 typedef uint64_t NTTIME;
@@ -246,12 +246,15 @@ typedef uint64_t NTTIME;
 
 #define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4)))
 
-#define LOOKUP_NAME_ISOLATED 1 /* Look up unqualified names */
-#define LOOKUP_NAME_REMOTE   2  /* Ask others */
-#define LOOKUP_NAME_ALL (LOOKUP_NAME_ISOLATED|LOOKUP_NAME_REMOTE)
-
-#define LOOKUP_NAME_GROUP    4  /* (unused) This is a NASTY hack for valid users = @foo
-                                * where foo also exists in as user. */
+#define LOOKUP_NAME_ISOLATED             0x00000001  /* Look up unqualified names */
+#define LOOKUP_NAME_REMOTE               0x00000002  /* Ask others */
+#define LOOKUP_NAME_GROUP                0x00000004  /* (unused) This is a NASTY hack for 
+                                                       valid users = @foo where foo also
+                                                       exists in as user. */
+#define LOOKUP_NAME_EXPLICIT             0x00000008  /* Only include
+                                                       explicitly mapped names and not 
+                                                       the Unix {User,Group} domain */
+#define LOOKUP_NAME_ALL                  (LOOKUP_NAME_ISOLATED|LOOKUP_NAME_REMOTE)
 
 /**
  * @brief Security Identifier
@@ -275,12 +278,14 @@ typedef struct dom_sid {
 #define dom_sid28 dom_sid
 
 enum id_mapping {
-       ID_UNKNOWN,
+       ID_UNKNOWN = 0,
        ID_MAPPED,
-       ID_UNMAPPED
+       ID_UNMAPPED,
+       ID_EXPIRED
 };
 
 enum id_type {
+       ID_TYPE_NOT_SPECIFIED = 0,
        ID_TYPE_UID,
        ID_TYPE_GID
 };
@@ -307,6 +312,8 @@ struct id_map {
 #include "librpc/gen_ndr/eventlog.h"
 #include "librpc/gen_ndr/srvsvc.h"
 #include "librpc/gen_ndr/wkssvc.h"
+#include "librpc/gen_ndr/echo.h"
+#include "librpc/gen_ndr/svcctl.h"
 
 struct lsa_dom_info {
        BOOL valid;
@@ -419,10 +426,9 @@ struct fd_handle {
                                 * DELETE_ON_CLOSE is not stored in the share
                                 * mode database.
                                 */
-       unsigned long file_id;
+       unsigned long gen_id;
 };
 
-struct messaging_context;
 struct event_context;
 struct fd_event;
 struct timed_event;
@@ -484,8 +490,7 @@ typedef struct files_struct {
        struct fd_handle *fh;
        unsigned int num_smb_operations;
        uint16 rap_print_jobid;
-       SMB_DEV_T dev;
-       SMB_INO_T inode;
+       struct file_id file_id;
        SMB_BIG_UINT initial_allocation_size; /* Faked up initial allocation on disk. */
        mode_t mode;
        uint16 file_pid;
@@ -529,12 +534,14 @@ typedef struct files_struct {
 #include "sysquotas.h"
 
 /* used to hold an arbitrary blob of data */
-typedef struct data_blob_ {
+typedef struct data_blob {
        uint8 *data;
        size_t length;
-       void (*free)(struct data_blob_ *data_blob);
+       void (*free)(struct data_blob *data_blob);
 } DATA_BLOB;
 
+extern const DATA_BLOB data_blob_null;
+
 /*
  * Structure used to keep directory state information around.
  * Used in NT change-notify code.
@@ -674,6 +681,13 @@ struct current_user {
        NT_USER_TOKEN *nt_user_token;
 };
 
+struct smb_request {
+       uint16 flags2;
+       uint16 smbpid;
+       uint16 mid;
+       uint16 vuid;
+};
+
 /* Defines for the sent_oplock_break field above. */
 #define NO_BREAK_SENT 0
 #define BREAK_TO_NONE_SENT 1
@@ -738,10 +752,11 @@ struct pending_message_list {
 };
 
 #define SHARE_MODE_FLAG_POSIX_OPEN     0x1
+#define SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE      0x2
 
 /* struct returned by get_share_modes */
 struct share_mode_entry {
-       struct process_id pid;
+       struct server_id pid;
        uint16 op_mid;
        uint16 op_type;
        uint32 access_mask;             /* NTCreateX access bits (FILE_READ_DATA etc.) */
@@ -751,17 +766,16 @@ struct share_mode_entry {
                                 * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB for
                                 * smbstatus and swat */
        struct timeval time;
-       SMB_DEV_T dev;
-       SMB_INO_T inode;
+       struct file_id id;
        unsigned long share_file_id;
        uint32 uid;             /* uid of file opener. */
-       uint16 flags;           /* POSIX_OPEN only defined so far... */
+       uint16 flags;           /* See SHARE_MODE_XX above. */
 };
 
 /* oplock break message definition - linearization of share_mode_entry.
 
 Offset  Data                   length.
-0      struct process_id pid   4
+0      struct server_id pid    4
 4      uint16 op_mid           2
 6      uint16 op_type          2
 8      uint32 access_mask      4
@@ -777,19 +791,23 @@ Offset  Data                      length.
 54
 
 */
+#ifdef CLUSTER_SUPPORT
+#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 58
+#else
 #define MSG_SMB_SHARE_MODE_ENTRY_SIZE 54
+#endif
 
 struct share_mode_lock {
        const char *servicepath; /* canonicalized. */
        const char *filename;
-       SMB_DEV_T dev;
-       SMB_INO_T ino;
+       struct file_id id;
        int num_share_modes;
        struct share_mode_entry *share_modes;
        UNIX_USER_TOKEN *delete_token;
        BOOL delete_on_close;
        BOOL fresh;
        BOOL modified;
+       struct db_record *record;
 };
 
 /*
@@ -819,7 +837,7 @@ struct locking_data {
 /* Used to store pipe open records for NetFileEnum() */
 
 struct pipe_open_rec {
-       struct process_id pid;
+       struct server_id pid;
        uid_t uid;
        int pnum;
        fstring name;
@@ -866,18 +884,18 @@ struct pipe_open_rec {
 
 /* key and data in the connections database - used in smbstatus and smbd */
 struct connections_key {
-       struct process_id pid;
+       struct server_id pid;
        int cnum;
        fstring name;
 };
 
 struct connections_data {
        int magic;
-       struct process_id pid;
+       struct server_id pid;
        int cnum;
        uid_t uid;
        gid_t gid;
-       char name[24];
+       char servicename[FSTRING_LEN];
        char addr[24];
        char machine[FSTRING_LEN];
        time_t start;
@@ -1241,17 +1259,24 @@ struct bitmap {
 
 /* Mapping of generic access rights for files to specific rights. */
 
+/* This maps to 0x1F01FF */
 #define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS| SYNCHRONIZE_ACCESS|FILE_ALL_ACCESS)
 
+/* This maps to 0x120089 */
 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ_ACCESS|FILE_READ_DATA|FILE_READ_ATTRIBUTES|\
                                                        FILE_READ_EA|SYNCHRONIZE_ACCESS)
 
+/* This maps to 0x120116 */
 #define FILE_GENERIC_WRITE (STD_RIGHT_READ_CONTROL_ACCESS|FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|\
                                                        FILE_WRITE_EA|FILE_APPEND_DATA|SYNCHRONIZE_ACCESS)
 
 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|\
                                                                FILE_EXECUTE|SYNCHRONIZE_ACCESS)
 
+/* Share specific rights. */
+#define SHARE_ALL_ACCESS      FILE_GENERIC_ALL
+#define SHARE_READ_ONLY       (FILE_GENERIC_READ|FILE_EXECUTE)
+
 /* Mapping of access rights to UNIX perms. */
 #define UNIX_ACCESS_RWX                FILE_GENERIC_ALL
 #define UNIX_ACCESS_R          FILE_GENERIC_READ
@@ -1479,6 +1504,9 @@ char *strdup(char *s);
 
 #define FLAGS2_WIN2K_SIGNATURE         0xC852 /* Hack alert ! For now... JRA. */
 
+/* TCONX Flag (smb_vwv2). */
+#define TCONX_FLAG_EXTENDED_RESPONSE   0x8
+
 /* Capabilities.  see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
 
 #define CAP_RAW_MODE         0x0001
@@ -1898,4 +1926,6 @@ enum usershare_err {
 /* Different reasons for closing a file. */
 enum file_close_type {NORMAL_CLOSE=0,SHUTDOWN_CLOSE,ERROR_CLOSE};
 
+#include "librpc/gen_ndr/epmapper.h"
+
 #endif /* _SMB_H */