From faa302c7688eeb03f543d6dac817b5a80753a9f5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 8 Jan 2000 01:23:13 +0000 Subject: Fixed deny mode bug : : If a file is resident on NT and the first user opens it read/write with DENY_READ then a subsequent : attempt by a second user (running under Windows 95) to open it read/write DENY_NONE fails. : Under samba 2.0.5a the second open succeeds but the file is write only. Jeremy. (This used to be commit 974af581fe428fd0233c2516b16a5132b0e1b583) --- source3/smbd/open.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source3/smbd/open.c') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index a940eda85d..2e4f54e40f 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -631,7 +631,7 @@ static int access_table(int new_deny,int old_deny,int old_mode, if (old_deny == new_deny && share_pid == pid) return(AALL); - if (old_mode == 0) return(AREAD); + if (old_mode == DOS_OPEN_RDONLY) return(AREAD); /* the new smbpub.zip spec says that if the file extension is .com, .dll, .exe or .sym then allow the open. I will force @@ -651,14 +651,14 @@ static int access_table(int new_deny,int old_deny,int old_mode, switch (new_deny) { case DENY_WRITE: - if (old_deny==DENY_WRITE && old_mode==0) return(AREAD); - if (old_deny==DENY_READ && old_mode==0) return(AWRITE); - if (old_deny==DENY_NONE && old_mode==0) return(AALL); + if (old_deny==DENY_WRITE && old_mode==DOS_OPEN_RDONLY) return(AREAD); + if (old_deny==DENY_READ && old_mode==DOS_OPEN_RDONLY) return(AWRITE); + if (old_deny==DENY_NONE && old_mode==DOS_OPEN_RDONLY) return(AALL); return(AFAIL); case DENY_READ: - if (old_deny==DENY_WRITE && old_mode==1) return(AREAD); - if (old_deny==DENY_READ && old_mode==1) return(AWRITE); - if (old_deny==DENY_NONE && old_mode==1) return(AALL); + if (old_deny==DENY_WRITE && old_mode==DOS_OPEN_WRONLY) return(AREAD); + if (old_deny==DENY_READ && old_mode==DOS_OPEN_WRONLY) return(AWRITE); + if (old_deny==DENY_NONE && old_mode==DOS_OPEN_WRONLY) return(AALL); return(AFAIL); case DENY_NONE: if (old_deny==DENY_WRITE) return(AREAD); @@ -711,8 +711,8 @@ static int check_share_mode( share_mode_entry *share, int deny_mode, if ((access_allowed == AFAIL) || (!fcbopen && (access_allowed == AREAD && *flags == O_RDWR)) || - (access_allowed == AREAD && *flags == O_WRONLY) || - (access_allowed == AWRITE && *flags == O_RDONLY)) + (access_allowed == AREAD && *flags != O_RDONLY) || + (access_allowed == AWRITE && *flags != O_WRONLY)) { DEBUG(2,("Share violation on file (%d,%d,%d,%d,%s,fcbopen = %d, flags = %d) = %d\n", deny_mode,old_deny_mode,old_open_mode, -- cgit