Bug 3684 - Sharing incoherence while creating file ( smbc_open_ctx() )
Summary: Sharing incoherence while creating file ( smbc_open_ctx() )
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.0.22
Hardware: x86 Linux
: P3 enhancement
Target Milestone: none
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
Depends on:
Reported: 2006-04-14 10:06 UTC by Eric Trinh
Modified: 2006-09-18 17:11 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Eric Trinh 2006-04-14 10:06:04 UTC
In smbc_open_ctx(), the call to cli_open() always use the parameter DENY_NONE, which makes possible to an other program to open a writing in progress file, which might result to strange behaviours...
Maybe, DENY_DOS should be a better choice: if the file is opened for reading, others can read but cannot write and if the file is opened for writing, others cannot open the file at all.
Comment 1 Derrell Lipman 2006-04-14 10:46:22 UTC
The libsmbclient library is providing a POSIX-like interface.  If the file being opened were a local Unix/Linux file, no automatic locking would occur.  This behavior is emulated in smbc_open_ctx().  In fact, changing that now would create backwards compatibility issues.

I can see one wanting the behavior you describe, however.  As I have some time (probably not in the next few weeks), I'll look into adding an option that allows the user to specify the deny mode for smbc_open_ctx().
Comment 2 Derrell Lipman 2006-09-02 21:13:43 UTC
The new option "open_share_mode" (as of check-in 18013) may now be used to set the share mode value that will be passed to cli_open().  To use this, after obtaining your context but before issuing the cli_open() call, do:

  smbc_option_set(context, "open_share_mode", share_mode);

where share_mode is one of the values in the enum smbc_share_mode, now in libsmbclient.h.

To maintain POSIX functionality and backward compatibility, the default is still DENY_NONE (SMBC_SHAREMODE_DENY_NONE).

Please let me know how this works for you.

Comment 3 Derrell Lipman 2006-09-18 17:11:13 UTC
No reply from OP.  Assuming it's fixed.  Closing.