Setting 'x' flag

Tine Smukavec valentin.smukavec at
Mon Nov 13 13:03:49 GMT 2000

Hi "samba developers",

I need an opinion or explanation of following code fragment
taken from smbd/dosmode.c:unix_mode() function body:
  } else { 
    if (lp_map_archive(SNUM(conn)) && IS_DOS_ARCHIVE(dosmode))
      result |= S_IXUSR;

    if (lp_map_system(SNUM(conn)) && IS_DOS_SYSTEM(dosmode))
      result |= S_IXGRP;
    if (lp_map_hidden(SNUM(conn)) && IS_DOS_HIDDEN(dosmode))
      result |= S_IXOTH;  

    if (dir_mode) {
      /* Inherit 666 component of parent directory mode */
      result |= dir_mode
    } else {
      /* Apply mode mask */
      result &= lp_create_mask(SNUM(conn)); /* SUSPICIOUS!!!! */
      /* Add in force bits */
      result |= lp_force_create_mode(SNUM(conn));

This function translates dos flags into unix permissions flagword.
I can't persuade samba to set 'x' bit unless I have 'x' bit set in
'create mask' service parameter. I'm trying to set it in volume mounted
with Sharity tool using 'chmod' command. I see the problematic code in
the line marked with /* SUSPICIOUS !!!!*/. My opinion is that create mask
should be placed into result with 'or' operation instead with 'and'. Because
'and' overrides the settings derived from 'archive', 'system' and
'hiddedn' flags if correspondend mapping is turned on. My question is
would it bring potential undesired side effects if I change mantioned
'and' operation into 'or'? I'm asking that because this mapping from dos
flags into unix flags and vica verse seems quite complicated to me.

Thank you for any reply.


More information about the samba-technical mailing list