summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-10-23 00:58:28 +0000
committerJeremy Allison <jra@samba.org>1998-10-23 00:58:28 +0000
commit5d6ed11ef3c860c95ae7b3a855b0ddb123bd9737 (patch)
tree13a6cba2591bcb12dfc838055d5cb80971574778 /source3/include
parent95056761c8137aa0d0d4f04e862efa7fa94e064c (diff)
downloadsamba-5d6ed11ef3c860c95ae7b3a855b0ddb123bd9737.tar.gz
samba-5d6ed11ef3c860c95ae7b3a855b0ddb123bd9737.tar.bz2
samba-5d6ed11ef3c860c95ae7b3a855b0ddb123bd9737.zip
include/smb.h: Added #defines for lots of things - makes our code a *lot* easier to read.
lib/util.c: Fixed Luke's set_first_token() function - should return void. smbd/close.c: Move delete_on_close into file_fd_struct structure. smbd/ipc.c: Changed local_machine back to fstring. smbd/nttrans.c: Use defines for mapping share modes. smbd/open.c: Move delete_on_close into file_fd_struct structure, added code for ALLOW_SHARE_DELETE. smbd/reply.c: Use defines for mapping share modes. smbd/trans2.c: Move delete_on_close into file_fd_struct structure. Jeremy. (This used to be commit 8e1ce307bd6a9056b4a95fe6f52ff42dc6e03a08)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/include/smb.h47
2 files changed, 45 insertions, 4 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6ec6f7e617..9b707adeef 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -231,7 +231,7 @@ BOOL user_in_list(char *user,char *list);
char *tmpdir(void);
BOOL is_a_socket(int fd);
-BOOL set_first_token(char *ptr);
+void set_first_token(char *ptr);
BOOL next_token(char **ptr,char *buff,char *sep, int bufsize);
char **toktocliplist(int *ctok, char *sep);
void set_socket_options(int fd, char *options);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index f755b81b92..d71d1cd1eb 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -186,6 +186,47 @@ 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)
+
+/* 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) ? 1 : 0)
+#define SET_ALLOW_SHARE_DELETE(x) ((x) ? ALLOW_SHARE_DELETE : 0)
+
+/* 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) ? 1 : 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 */
@@ -433,6 +474,7 @@ typedef struct file_fd_struct
int fd_readonly;
int fd_writeonly;
int real_open_flags;
+ BOOL delete_on_close;
} file_fd_struct;
/*
@@ -517,17 +559,16 @@ typedef struct files_struct
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;
BOOL sent_oplock_break;
BOOL is_directory;
- BOOL delete_on_close;
char *fsp_name;
} files_struct;
@@ -788,7 +829,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