summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-04-22 00:33:16 +0000
committerJeremy Allison <jra@samba.org>2000-04-22 00:33:16 +0000
commit6259f51dd9918eccc9697f3763d918f7c9b82b50 (patch)
tree1bbfa0d6eb5767f713b290743dd9fa9fb9f62ce9 /source3/include
parentb7a1d19d114288ac3292a26d2d42825e26884d36 (diff)
downloadsamba-6259f51dd9918eccc9697f3763d918f7c9b82b50.tar.gz
samba-6259f51dd9918eccc9697f3763d918f7c9b82b50.tar.bz2
samba-6259f51dd9918eccc9697f3763d918f7c9b82b50.zip
This is a *big* checkin that may break some things, but implements the
new open mechanism Andrew & I discussed. config.sub: configure: Included the QNX patch. include/vfs.h: smbd/vfs-wrap.c: smbd/vfs.c: Added ftruncate vfs call (needed). Note that we will also need locking calls in the vfs (to be added). lib/util_unistr.c: nmbd/nmbd_processlogon.c: Fix for NT domain logons causing nmbd to core dump. Also fix for sidsize DOS bug. locking/locking.c: Check value of ret before using it for memdup. printing/printing.c: Convert print_fsp_open to return an allocated fsp. rpc_server/srv_lsa.c: Fix for NT domain logons. I have removed all use of lp_share_modes() from the code (although I left the parameter in the table for backwards compatibility). It no longer makes sense for this to exist. smbd/close.c: Removed lp_share_modes(). smbd/fileio.c: Fixed parameters to unlock_share_entry call in panic code. smbd/files.c: Correctly set the unix_ERR_code to ERRnofids on fsp allocation fail. smbd/nttrans.c: smbd/reply.c: smbd/trans2.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. smbd/open.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. In addition I have fixed a long standing race condition in the deny mode processing w.r.t. two smbd's creating a file. Andrew, please note that your original idea of using open with O_EXCL in this case would not work (I went over the races very carefully) and so we must re-check deny modes *after* the open() call returns. This is because there is a race between the open with O_EXCL and the lock of the share mode entry. Imagine the case where the first smbd does the open with O_EXCL and a deny mode of DENY_ALL, but is pre-empted before it locks the share modes and creates the deny mode entry for DENY_ALL. A second smbd could then come in with O_RDONLY and a deny mode of DENY_NONE and the two opens would be allowed. The *only* way to fix this race is to lock the share modes after the open and then do the deny mode checks *after* this lock in the case where the file did not originally exist. This code will need extensive testing but seems to initially work. Jeremy. (This used to be commit ab0ecc39d688f16b9692fe90b991f0b89287070a)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/proto.h13
-rw-r--r--source3/include/vfs.h1
2 files changed, 8 insertions, 6 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 4e5b614f56..dfa76b3995 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -493,8 +493,7 @@ char *string_truncate(char *s, int length);
int dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate);
void ascii_to_unistr(uint16 *dest, const char *src, int maxlen);
void unistr_to_ascii(char *dest, const uint16 *src, int len);
-char *skip_unibuf(char *src, int len);
-char *skip_unicode_string(char *buf,int n);
+char *skip_unibuf(char *src, size_t len);
char *dos_unistrn2(uint16 *src, int len);
char *dos_unistr2(uint16 *src);
char *dos_unistr2_to_str(UNISTR2 *str);
@@ -1602,7 +1601,7 @@ int print_queue_snum(char *qname);
BOOL print_queue_pause(int snum);
BOOL print_queue_resume(int snum);
BOOL print_queue_purge(int snum);
-void print_fsp_open(files_struct *fsp,connection_struct *conn,char *jobname);
+files_struct *print_fsp_open(connection_struct *conn,char *jobname);
void print_fsp_end(files_struct *fsp);
/*The following definitions come from profile/profile.c */
@@ -2928,6 +2927,7 @@ BOOL check_plaintext_password(char *user, char *old_passwd,
/*The following definitions come from smbd/close.c */
+void close_filestruct(files_struct *fsp);
int close_file(files_struct *fsp, BOOL normal_close);
/*The following definitions come from smbd/conn.c */
@@ -3092,11 +3092,11 @@ int reply_nttrans(connection_struct *conn,
/*The following definitions come from smbd/open.c */
int fd_close(struct connection_struct *conn, files_struct *fsp);
-void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int share_mode,int ofun,
+files_struct *open_file_shared(connection_struct *conn,char *fname,int share_mode,int ofun,
mode_t mode,int oplock_request, int *Access,int *action);
-int open_file_stat(files_struct *fsp,connection_struct *conn,
+files_struct *open_file_stat(connection_struct *conn,
char *fname, int smb_ofun, SMB_STRUCT_STAT *pst, int *action);
-int open_directory(files_struct *fsp,connection_struct *conn,
+files_struct *open_directory(connection_struct *conn,
char *fname, int smb_ofun, mode_t unixmode, int *action);
BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op);
@@ -3311,6 +3311,7 @@ int vfswrap_lstat(char *path,
int vfswrap_unlink(char *path);
int vfswrap_chmod(char *path, mode_t mode);
int vfswrap_utime(char *path, struct utimbuf *times);
+int vfswrap_ftruncate(int fd, SMB_OFF_T offset);
/*The following definitions come from smbd/vfs.c */
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index fca9f7da84..a09991a0e7 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -136,6 +136,7 @@ struct vfs_ops {
int (*unlink)(char *path);
int (*chmod)(char *path, mode_t mode);
int (*utime)(char *path, struct utimbuf *times);
+ int (*ftruncate)(int fd, SMB_OFF_T offset);
};
struct vfs_options {