summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-20 00:46:53 +0000
committerJeremy Allison <jra@samba.org>2002-03-20 00:46:53 +0000
commitb9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329 (patch)
treebd74664377abf0b1d0745476d88f6668d06c5718 /source3/smbd/dir.c
parent0cd5dd67ce12f02d3d20568e901ef7666caa8472 (diff)
downloadsamba-b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329.tar.gz
samba-b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329.tar.bz2
samba-b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329.zip
Remove the "stat open" code - make it inline. This should fix the
bugs with opening and renaming mp3 files, also the word rename problems that people have had for a while. Needs a make clean :-) make. Also added JohnR's printing fix. Jeremy. (This used to be commit 504e5ef0494c54efbd0357e334cb2aa5a9eb9c14)
Diffstat (limited to 'source3/smbd/dir.c')
-rw-r--r--source3/smbd/dir.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 2b2683caa5..3a7b697d75 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -674,6 +674,7 @@ static BOOL user_can_read_file(connection_struct *conn, char *name)
size_t sd_size;
files_struct *fsp;
int smb_action;
+ int access_mode;
NTSTATUS status;
uint32 access_granted;
@@ -686,10 +687,12 @@ static BOOL user_can_read_file(connection_struct *conn, char *name)
/* Pseudo-open the file (note - no fd's created). */
if(S_ISDIR(ste.st_mode))
- fsp = open_directory(conn, name, &ste, SET_DENY_MODE(DENY_NONE), FILE_OPEN,
+ fsp = open_directory(conn, name, &ste, SET_DENY_MODE(DENY_NONE), (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN),
unix_mode(conn,aRONLY|aDIR, name), &smb_action);
else
- fsp = open_file_stat(conn,name,&ste,DOS_OPEN_RDONLY,&smb_action);
+ fsp = open_file_shared1(conn, name, &ste, FILE_READ_ATTRIBUTES, SET_DENY_MODE(DENY_NONE),
+ (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, 0, &access_mode, &smb_action);
+
if (!fsp)
return False;
@@ -703,26 +706,6 @@ static BOOL user_can_read_file(connection_struct *conn, char *name)
return se_access_check(psd, current_user.nt_user_token, FILE_READ_DATA,
&access_granted, &status);
-
-#if 0
- /* Old - crappy check :-). JRA */
-
- if (ste.st_uid == conn->uid) {
- return (ste.st_mode & S_IRUSR) == S_IRUSR;
- } else {
- int i;
- if (ste.st_gid == conn->gid) {
- return (ste.st_mode & S_IRGRP) == S_IRGRP;
- }
- for (i=0; i<conn->ngroups; i++) {
- if (conn->groups[i] == ste.st_gid) {
- return (ste.st_mode & S_IRGRP) == S_IRGRP;
- }
- }
- }
-
- return (ste.st_mode & S_IROTH) == S_IROTH;
-#endif
}
/*******************************************************************