From e8b5cb45155536107a71e1106ad4a624eb559496 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 8 Jan 2000 10:15:53 +0000 Subject: cli_open() wasn't handling DENY_FCB or O_WRONLY correctly. After fixing that I needed to use O_RDWR instead of O_WRONLY in several places to avoid the silly bug in MS servers that doesn't allow getattrE on a file opened with O_WRONLY (This used to be commit e21aa4cb088f348139309d29c85c48c8b777cff5) --- source3/libsmb/clientgen.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source3/libsmb/clientgen.c') diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 0436fb9df5..e37974b570 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -1231,6 +1231,7 @@ int cli_nt_create(struct cli_state *cli, char *fname) /**************************************************************************** open a file +WARNING: if you open with O_WRONLY then getattrE won't work! ****************************************************************************/ int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode) { @@ -1238,12 +1239,6 @@ int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode) unsigned openfn=0; unsigned accessmode=0; - /* you must open for RW not just write - otherwise getattrE doesn't - work! */ - if ((flags & O_ACCMODE) == O_WRONLY && strncmp(cli->dev, "LPT", 3)) { - flags = (flags & ~O_ACCMODE) | O_RDWR; - } - if (flags & O_CREAT) openfn |= (1<<4); if (!(flags & O_EXCL)) { @@ -1267,6 +1262,10 @@ int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode) } #endif /* O_SYNC */ + if (share_mode == DENY_FCB) { + accessmode = 0xFF; + } + memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); -- cgit