Re: [Samba] Re: Can not clear Read-only attribute - thank you

2009-03-18 Thread Jaroslav Fojtik
Dear Jeremy Allison,

 Logged it as bug #6186, I've attached the patch and described
 the workaround.
Thank you very much for this fix. I confirm that it works and I hope that 
it will be incorporated into a next Samba release.

You could also close this bug:
 https://bugzilla.samba.org/show_bug.cgi?id=4325


   Yes, you'll lose current DOS attribute mapping, but you'll
   be much happier in the long run :-).
I also do not want to loose existing attributes and rebuild reiserfs with 
support of extended attributes. I am interested only in Read Only attribute.

regards
   Jara


-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] Re: Can not clear Read-only attribute - thank you

2009-03-18 Thread Jeremy Allison
On Thu, Mar 19, 2009 at 12:23:55AM +0100, Jaroslav Fojtik wrote:
 Dear Jeremy Allison,
 
  Logged it as bug #6186, I've attached the patch and described
  the workaround.
 Thank you very much for this fix. I confirm that it works and I hope that 
 it will be incorporated into a next Samba release.

Yes, it's in the git trees so it will be in all future Samba releases.

 You could also close this bug:
  https://bugzilla.samba.org/show_bug.cgi?id=4325

Thanks, will do.

Jeremy.
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] Re: Can not clear Read-only attribute

2009-03-12 Thread Jeremy Allison
On Thu, Mar 12, 2009 at 02:56:59AM +0100, Günter Kukkukk wrote:
 Am Donnerstag, 12. März 2009 schrieb Jeremy Allison:
  On Thu, Mar 12, 2009 at 12:56:27AM +, tom m. wrote:
   
   I'm not against doing that, but does add some work: rebuild extended 
   attribute
   support in kernel, change fstab, etc.  But if I do this, what will be the 
   state
   of all the attribute bits of existing files?  That is, will files marked
   Read-only now suddenly be not Read-only?  How about System/Hidden files?
  
  Yes, you'll lose current DOS attribute mapping, but you'll
  be much happier in the long run :-).
  
  Jeremy.
 
 Hi Jeremy,
 but we have a bug here - the old wellknown map readonly = Yes stuff isn't 
 working
 anymore. Just did a test on latest v3-3-test.
 Digging deeper now ... it's related to (current) NTCreateAndX

Reproduced - here's the fix. Didn't make 3.3.2 unfortunately, but I'll
create the bug and attach the patch.

Jeremy.
diff --git a/source/smbd/open.c b/source/smbd/open.c
index c89a5f6..064e17c 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -425,8 +425,26 @@ static NTSTATUS open_file(files_struct *fsp,
access_granted);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status, 
NT_STATUS_ACCESS_DENIED)) {
+   /*
+* On NT_STATUS_ACCESS_DENIED, 
access_granted
+* contains the denied bits.
+*/
+
+   if ((access_mask  
FILE_WRITE_ATTRIBUTES) 
+   (access_granted  
FILE_WRITE_ATTRIBUTES) 
+   
(lp_map_readonly(SNUM(conn)) ||
+
lp_map_archive(SNUM(conn)) ||
+
lp_map_hidden(SNUM(conn)) ||
+
lp_map_system(SNUM(conn {
+   access_granted = 
~FILE_WRITE_ATTRIBUTES;
+
+   DEBUG(10,(open_file: overrode 
FILE_WRITE_ATTRIBUTES 
+   on file %s\n,
+   path ));
+   }
+
if ((access_mask  DELETE_ACCESS) 
-   (access_granted == 
DELETE_ACCESS) 
+   (access_granted  
DELETE_ACCESS) 

can_delete_file_in_directory(conn, path)) {
/* Were we trying to do a stat 
open
 * for delete and didn't get 
DELETE
@@ -436,10 +454,14 @@ static NTSTATUS open_file(files_struct *fsp,
 * 
http://blogs.msdn.com/oldnewthing/archive/2004/06/04/148426.aspx
 * for details. */
 
-   DEBUG(10,(open_file: overrode 
ACCESS_DENIED 
+   access_granted = 
~DELETE_ACCESS;
+
+   DEBUG(10,(open_file: overrode 
DELETE_ACCESS 
on file %s\n,
path ));
-   } else {
+   }
+
+   if (access_granted != 0) {
DEBUG(10, (open_file: Access 
denied on 
file %s\n,
path));
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] Re: Can not clear Read-only attribute

2009-03-12 Thread Jeremy Allison
On Thu, Mar 12, 2009 at 02:56:59AM +0100, Günter Kukkukk wrote:
 Am Donnerstag, 12. März 2009 schrieb Jeremy Allison:
  On Thu, Mar 12, 2009 at 12:56:27AM +, tom m. wrote:
   
   I'm not against doing that, but does add some work: rebuild extended 
   attribute
   support in kernel, change fstab, etc.  But if I do this, what will be the 
   state
   of all the attribute bits of existing files?  That is, will files marked
   Read-only now suddenly be not Read-only?  How about System/Hidden files?
  
  Yes, you'll lose current DOS attribute mapping, but you'll
  be much happier in the long run :-).
  
  Jeremy.
 
 Hi Jeremy,
 but we have a bug here - the old wellknown map readonly = Yes stuff isn't 
 working
 anymore. Just did a test on latest v3-3-test.
 Digging deeper now ... it's related to (current) NTCreateAndX

Logged it as bug #6186, I've attached the patch and described
the workaround.

Jeremy.
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] Re: Can not clear Read-only attribute

2009-03-11 Thread Jeremy Allison
On Thu, Mar 12, 2009 at 12:30:55AM +, tom m. wrote:
 If it were a permission problem, then it wouldn't be possible to set Read-only
 attribute in the first place, correct?
 
 Here's the result of creating an empty file called 'test.txt' via notepad, as
 viewed from the linux-side.  The 'create mask' is 711 and 'map archive' is 
 yes:
 
 -rwx-- 1 root root 0 Mar 11  2009 test.txt*
 
 Result after right-clicking test.txt and setting Read-only attribute:
 
 -r-x-- 1 root root 0 Mar 11 18:02 test.txt*
 
 Now if I right-click test.txt again and try to clear Read-only attribute,
 windows reports Access denied and permissions stay the same:
 
 -r-x-- 1 root root 0 Mar 11 18:02 test.txt*
 
 Now if I 'chmod 502 test.txt' we get:
 
 -r-xw- 1 root root 0 Mar 11 18:02 test.txt*
 
 Right-click 'test.txt' in explorer and file still shows as Read-only, but
 clearing Read-only now works and we get this:
 
 -rwxw- 1 root root 0 Mar 11 18:02 test.txt*
 
 
 Here is output of 'testparm':
 
 [global]
 workgroup = MSHOME
 server string = Samba server
 null passwords = Yes
 log level = 3
 log file = /var/log/sambalog
 unix extensions = No
 load printers = No
 printcap name = /dev/null
 disable spoolss = Yes
 show add printer wizard = No
 local master = No
 ldap ssl = no
 force user = root
 create mask = 0711
 directory mask = 0711
 use sendfile = Yes
 map hidden = Yes
 map system = Yes
 msdfs root = Yes

Ah, you're mapping attributes into file permissions.

That's not a good idea these days. Use extended attributes
and map DOS attributes into ea's instead.

ea support = yes
store dos attributes = yes
map system = no
map archive = no
map readonly = no

Jeremy.
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] Re: Can not clear Read-only attribute

2009-03-11 Thread Jeremy Allison
On Thu, Mar 12, 2009 at 12:56:27AM +, tom m. wrote:
 
 I'm not against doing that, but does add some work: rebuild extended attribute
 support in kernel, change fstab, etc.  But if I do this, what will be the 
 state
 of all the attribute bits of existing files?  That is, will files marked
 Read-only now suddenly be not Read-only?  How about System/Hidden files?

Yes, you'll lose current DOS attribute mapping, but you'll
be much happier in the long run :-).

Jeremy.
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] Re: Can not clear Read-only attribute

2009-03-11 Thread Günter Kukkukk
Am Donnerstag, 12. März 2009 schrieb Jeremy Allison:
 On Thu, Mar 12, 2009 at 12:56:27AM +, tom m. wrote:
  
  I'm not against doing that, but does add some work: rebuild extended 
  attribute
  support in kernel, change fstab, etc.  But if I do this, what will be the 
  state
  of all the attribute bits of existing files?  That is, will files marked
  Read-only now suddenly be not Read-only?  How about System/Hidden files?
 
 Yes, you'll lose current DOS attribute mapping, but you'll
 be much happier in the long run :-).
 
 Jeremy.

Hi Jeremy,
but we have a bug here - the old wellknown map readonly = Yes stuff isn't 
working
anymore. Just did a test on latest v3-3-test.
Digging deeper now ... it's related to (current) NTCreateAndX

Cheers, Günter
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] Re: Can not clear Read-only attribute

2009-03-11 Thread Miguel Medalha



Also, what is different from my config that is causing this problem vs. other
posters who report that it works ok for them?  (...)
  


I simply reported that it is working for me (as it is) because I assumed 
that you were using store dos attributes = yes as I am. I found this 
to be the reliable method.


And yes, like Jeremy says you'll be much happier in the long run if 
you use this method too.


It will not be difficult to write a script, or a DOS batch file, to 
reset the attributes your files now have, after you change the parameters.

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba