Ignore:
Timestamp:
Nov 25, 2016, 8:04:54 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/smbd/dosmode.c

    r988 r989  
    258258****************************************************************************/
    259259
    260 static bool get_ea_dos_attribute(connection_struct *conn,
    261                                 struct smb_filename *smb_fname,
    262                                 uint32_t *pattr)
     260bool get_ea_dos_attribute(connection_struct *conn,
     261                          struct smb_filename *smb_fname,
     262                          uint32_t *pattr)
    263263{
    264264        struct xattr_DOSATTRIB dosattrib;
     
    553553}
    554554
     555static uint32_t dos_mode_from_name(connection_struct *conn,
     556                                   const struct smb_filename *smb_fname,
     557                                   uint32_t dosmode)
     558{
     559        const char *p = NULL;
     560        uint32_t result = dosmode;
     561
     562        if (!(result & FILE_ATTRIBUTE_HIDDEN) &&
     563            lp_hide_dot_files(SNUM(conn)))
     564        {
     565                p = strrchr_m(smb_fname->base_name, '/');
     566                if (p) {
     567                        p++;
     568                } else {
     569                        p = smb_fname->base_name;
     570                }
     571
     572                /* Only . and .. are not hidden. */
     573                if ((p[0] == '.') &&
     574                    !((p[1] == '\0') || (p[1] == '.' && p[2] == '\0')))
     575                {
     576                        result |= FILE_ATTRIBUTE_HIDDEN;
     577                }
     578        }
     579
     580        if (!(result & FILE_ATTRIBUTE_HIDDEN) &&
     581            IS_HIDDEN_PATH(conn, smb_fname->base_name))
     582        {
     583                result |= FILE_ATTRIBUTE_HIDDEN;
     584        }
     585
     586        return result;
     587}
     588
    555589/****************************************************************************
    556590 Change a unix mode to a dos mode.
     
    568602        if (!VALID_STAT(smb_fname->st)) {
    569603                return 0;
    570         }
    571 
    572         /* First do any modifications that depend on the path name. */
    573         /* hide files with a name starting with a . */
    574         if (lp_hide_dot_files(SNUM(conn))) {
    575                 const char *p = strrchr_m(smb_fname->base_name,'/');
    576                 if (p) {
    577                         p++;
    578                 } else {
    579                         p = smb_fname->base_name;
    580                 }
    581 
    582                 /* Only . and .. are not hidden. */
    583                 if (p[0] == '.' && !((p[1] == '\0') ||
    584                                 (p[1] == '.' && p[2] == '\0'))) {
    585                         result |= FILE_ATTRIBUTE_HIDDEN;
    586                 }
    587604        }
    588605
     
    606623        }
    607624
    608         /* Optimization : Only call is_hidden_path if it's not already
    609            hidden. */
    610         if (!(result & FILE_ATTRIBUTE_HIDDEN) &&
    611             IS_HIDDEN_PATH(conn, smb_fname->base_name)) {
    612                 result |= FILE_ATTRIBUTE_HIDDEN;
    613         }
     625        result |= dos_mode_from_name(conn, smb_fname, result);
    614626
    615627        if (result == 0) {
    616                 result = FILE_ATTRIBUTE_NORMAL;
     628                if (S_ISDIR(smb_fname->st.st_ex_mode)) {
     629                        result = FILE_ATTRIBUTE_DIRECTORY;
     630                } else {
     631                        result = FILE_ATTRIBUTE_NORMAL;
     632                }
    617633        }
    618634
Note: See TracChangeset for help on using the changeset viewer.