Unix permission problems with 'attrib'

François Gouget gouget at metaintegration.net
Tue Feb 2 19:52:56 GMT 1999

	Looking at the source I found something suspicious in "sources/smbd/dosmode.c" in file_chmod.

  /* if we previously had any w bits set then leave them alone 
   if the new mode is not rdonly */
  if (!IS_DOS_READONLY(dosmode) &&
      (tmp = st->st_mode & (S_IWUSR|S_IWGRP|S_IWOTH))) {
    unixmode &= ~(S_IWUSR|S_IWGRP|S_IWOTH);
    unixmode |= tmp;

	So if we do an "attrib -r" I guess this function would get called (I did not check), IS_DOS_READONLY would be false and thus we would preserve the write permissions of the file. This means we would still not be able to write to it.

	Would that be it ? Why does it work the second time then ???

François Gouget
fgouget at multimania.com -- http://www.multimania.com/fgouget/

More information about the samba mailing list