summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-01-08 10:15:53 +0000
committerAndrew Tridgell <tridge@samba.org>2000-01-08 10:15:53 +0000
commite8b5cb45155536107a71e1106ad4a624eb559496 (patch)
treea74e7b8a64372daf2ea6075a29b7dcaaf2c9120a /source3/libsmb
parent6ba295ce0bde0aa8f64f60b1e72d6afec33bfece (diff)
downloadsamba-e8b5cb45155536107a71e1106ad4a624eb559496.tar.gz
samba-e8b5cb45155536107a71e1106ad4a624eb559496.tar.bz2
samba-e8b5cb45155536107a71e1106ad4a624eb559496.zip
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)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clientgen.c11
1 files changed, 5 insertions, 6 deletions
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);