From b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 20 Mar 2002 00:46:53 +0000 Subject: 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) --- source3/smbd/dir.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'source3/smbd/dir.c') 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; ingroups; 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 } /******************************************************************* -- cgit