Changeset 580 for trunk/src


Ignore:
Timestamp:
Nov 2, 2023, 8:57:17 AM (13 months ago)
Author:
katerina
Message:

Fix for ticket #468 (file attributes). Also add option to switch off check.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_hash.c

    r570 r580  
    22572257                      _("mode_old=\"%s\" mode_new=\"%s\" attr_old=\"%s\" attr_new=\"%s\" imode_old=\"%ld\" imode_new=\"%ld\" iattr_old=\"%ld\" iattr_new=\"%ld\" "),
    22582258#else
    2259                       _("mode_old=<%s>, mode_new=<%s>, attr_old=<%s>, attr_new=<%s>, "),
     2259                      _("mode_old=<%s>, mode_new=<%s>, attr_old=<%s>, attr_new=<%s>, imode_old=<%ld>, imode_new=<%ld>, iattr_old=<%ld>, iattr_new=<%ld>, "),
    22602260#endif
    22612261                      p->theFile.c_mode, theFile->c_mode,
    2262                       p->theFile.c_attributes, theFile->c_attributes
    2263 #ifdef SH_USE_XML
    2264                       , (long) p->theFile.mode, (long) theFile->mode,
     2262                      p->theFile.c_attributes, theFile->c_attributes,
     2263
     2264                      (long) p->theFile.mode, (long) theFile->mode,
    22652265                      (long) p->theFile.attributes,
    22662266                      (long) theFile->attributes
    2267 #endif
    22682267                      );
    22692268#else
  • trunk/src/sh_readconf.c

    r577 r580  
    10111011  { N_("hardlinkoffset"),       SH_SECTION_MISC,   SH_SECTION_NONE,
    10121012    sh_files_hle_reg },
     1013#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
     1014  { N_("useattributescheck"),      SH_SECTION_MISC,   SH_SECTION_NONE,
     1015    sh_unix_setcheckattributes },
     1016#endif
    10131017#if defined(USE_XATTR)
    10141018  { N_("useselinuxcheck"),      SH_SECTION_MISC,   SH_SECTION_NONE,
  • trunk/src/sh_unix.c

    r579 r580  
    31393139 **************************************************************/
    31403140
    3141 #if (defined(__linux__) && (defined(HAVE_LINUX_EXT2_FS_H) || defined(HAVE_EXT2FS_EXT2_FS_H))) || defined(HAVE_STAT_FLAGS)
     3141#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
    31423142
    31433143#if defined(__linux__)
     
    31483148#if defined(HAVE_EXT2FS_EXT2_FS_H)
    31493149#include <ext2fs/ext2_fs.h>
    3150 #else
     3150#elif defined(HAVE_LINUX_EXT2_FS_H)
    31513151#include <linux/ext2_fs.h>
    31523152#endif
     
    32453245#ifdef HAVE_EXT2_IOCTLS
    32463246  int /* fd, */ r, f;
     3247  unsigned long keep_flags = 0;
    32473248 
    32483249  SL_ENTER(_("sh_unix_getinfo_attr"));
    32493250
    32503251  *flags = 0;
     3252 
    32513253  (void) buf;
    32523254
     
    32593261
    32603262 
    3261   r = ioctl (fd, EXT2_IOC_GETFLAGS, &f);
     3263  r = ioctl (fd, FS_IOC_GETFLAGS, &f);
    32623264  /* sl_close_fd (FIL__, __LINE__, fd); */
    32633265
     
    32703272  *flags = f;
    32713273
    3272 /* ! HAVE_EXT2_IOCTLS */
     3274/* ! HAVE_FS_IOCTLS */
    32733275#else
    32743276
     
    32773279  *flags = 0;                                     /* modified by R.Wichmann */
    32783280
    3279 /* ! HAVE_EXT2_IOCTLS */
     3281/* ! HAVE_FS_IOCTLS */
    32803282#endif
    32813283/*
     
    32883290    goto theend;
    32893291
    3290 #ifdef EXT2_SECRM_FL
    3291   if ( (*flags & EXT2_SECRM_FL) != 0  )   c_attr[0] = 's';
    3292 #endif
    3293 #ifdef EXT2_UNRM_FL
    3294   if ( (*flags & EXT2_UNRM_FL) != 0   )   c_attr[1] = 'u';
    3295 #endif
    3296 #ifdef EXT2_SYNC_FL
    3297   if ( (*flags & EXT2_SYNC_FL) != 0    )  c_attr[2] = 'S';
    3298 #endif
    3299 #ifdef EXT2_IMMUTABLE_FL
    3300   if ( (*flags & EXT2_IMMUTABLE_FL) != 0) c_attr[3] = 'i';
    3301 #endif
    3302 #ifdef EXT2_APPEND_FL
    3303   if ( (*flags & EXT2_APPEND_FL) != 0  )  c_attr[4] = 'a';
    3304 #endif
    3305 #ifdef EXT2_NODUMP_FL
    3306   if ( (*flags & EXT2_NODUMP_FL) != 0  )  c_attr[5] = 'd';
    3307 #endif
    3308 #ifdef EXT2_NOATIME_FL
    3309   if ( (*flags & EXT2_NOATIME_FL) != 0)   c_attr[6] = 'A';
    3310 #endif
    3311 #ifdef EXT2_COMPR_FL
    3312   if ( (*flags & EXT2_COMPR_FL) != 0   )  c_attr[7] = 'c';
    3313 #endif
    3314 
    3315 #ifdef EXT2_TOPDIR_FL
    3316   if ( (*flags & EXT2_TOPDIR_FL) != 0  )  c_attr[8] = 'T';
    3317 #endif
    3318 #ifdef EXT2_DIRSYNC_FL
    3319   if ( (*flags & EXT2_DIRSYNC_FL) != 0 )  c_attr[9] = 'D';
    3320 #endif
    3321 #ifdef EXT2_NOTAIL_FL
    3322   if ( (*flags & EXT2_NOTAIL_FL) != 0  )  c_attr[10] = 't';
    3323 #endif
    3324 #ifdef EXT2_JOURNAL_DATA_FL
    3325   if ( (*flags & EXT2_JOURNAL_DATA_FL) != 0)  c_attr[11] = 'j';
    3326 #endif
    3327 
     3292#ifdef FS_SECRM_FL
     3293  if ( (*flags & FS_SECRM_FL) != 0  )  { c_attr[0] = 's'; keep_flags |= FS_SECRM_FL; }
     3294#endif
     3295#ifdef FS_UNRM_FL
     3296  if ( (*flags & FS_UNRM_FL) != 0   )  { c_attr[1] = 'u'; keep_flags |= FS_UNRM_FL; }
     3297#endif
     3298#ifdef FS_SYNC_FL
     3299  if ( (*flags & FS_SYNC_FL) != 0    ) { c_attr[2] = 'S'; keep_flags |= FS_SYNC_FL; }
     3300#endif
     3301#ifdef FS_IMMUTABLE_FL
     3302  if ( (*flags & FS_IMMUTABLE_FL) != 0) { c_attr[3] = 'i'; keep_flags |= FS_IMMUTABLE_FL; }
     3303#endif
     3304#ifdef FS_APPEND_FL
     3305  if ( (*flags & FS_APPEND_FL) != 0  )  { c_attr[4] = 'a'; keep_flags |= FS_APPEND_FL; }
     3306#endif
     3307#ifdef FS_NODUMP_FL
     3308  if ( (*flags & FS_NODUMP_FL) != 0  )  { c_attr[5] = 'd'; keep_flags |= FS_NODUMP_FL; }
     3309#endif
     3310#ifdef FS_NOATIME_FL
     3311  if ( (*flags & FS_NOATIME_FL) != 0)   { c_attr[6] = 'A'; keep_flags |= FS_NOATIME_FL; }
     3312#endif
     3313#ifdef FS_COMPR_FL
     3314  if ( (*flags & FS_COMPR_FL) != 0   )  { c_attr[7] = 'c'; keep_flags |= FS_COMPR_FL; }
     3315#endif
     3316
     3317#ifdef FS_TOPDIR_FL
     3318  if ( (*flags & FS_TOPDIR_FL) != 0  )  { c_attr[8] = 'T'; keep_flags |= FS_TOPDIR_FL; }
     3319#endif
     3320#ifdef FS_DIRSYNC_FL
     3321  if ( (*flags & FS_DIRSYNC_FL) != 0 )  { c_attr[9] = 'D'; keep_flags |= FS_DIRSYNC_FL; }
     3322#endif
     3323#ifdef FS_NOTAIL_FL
     3324  if ( (*flags & FS_NOTAIL_FL) != 0  )  { c_attr[10] = 't'; keep_flags |= FS_NOTAIL_FL; }
     3325#endif
     3326#ifdef FS_JOURNAL_DATA_FL
     3327  if ( (*flags & FS_JOURNAL_DATA_FL) != 0)  { c_attr[11] = 'j'; keep_flags |= FS_JOURNAL_DATA_FL; }
     3328#endif
     3329
     3330  *flags = keep_flags;
     3331 
    33283332 theend:
    3329   /* ext2 */
    3330 #endif
    3331 
    3332   c_attr[12] = '\0';
     3333  /* !HAVE_STAT_FLAGS */
     3334#endif
     3335
     3336  c_attr[ATTRBUF_USED] = '\0';
    33333337
    33343338  SL_RETURN(0, _("sh_unix_getinfo_attr"));
     
    36143618int sh_unix_check_selinux = S_FALSE;
    36153619int sh_unix_check_acl     = S_FALSE;
     3620int sh_unix_check_attributes  = S_TRUE;
    36163621
    36173622#ifdef USE_ACL
     
    37743779
    37753780  SL_RETURN((collect),_("sh_unix_getinfo_xattr"));
     3781}
     3782#endif
     3783
     3784#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
     3785int sh_unix_setcheckattributes (const char * c)
     3786{
     3787  int i;
     3788  SL_ENTER(_("sh_unix_setcheckattributes"));
     3789  i = sh_util_flagval(c, &(sh_unix_check_attributes));
     3790
     3791  SL_RETURN(i, _("sh_unix_setcheckattributes"));
    37763792}
    37773793#endif
     
    42064222  theFile->attributes      =    0;
    42074223
    4208 #if (defined(__linux__) && (defined(HAVE_LINUX_EXT2_FS_H) || defined(HAVE_EXT2FS_EXT2_FS_H))) || defined(HAVE_STAT_FLAGS)
     4224#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
    42094225  if (theFile->c_mode[0] != 'c' && theFile->c_mode[0] != 'b' &&
    4210       theFile->c_mode[0] != 'l' )
    4211     sh_unix_getinfo_attr(theFile->fullpath,
    4212                          &theFile->attributes, theFile->c_attributes,
    4213                          fd, &buf);
     4226      theFile->c_mode[0] != 'l' ) {
     4227    if (sh_unix_check_attributes == S_TRUE)
     4228      sh_unix_getinfo_attr(theFile->fullpath,
     4229                           &theFile->attributes, theFile->c_attributes,
     4230                           fd, &buf);
     4231  }
    42144232#endif
    42154233#endif
Note: See TracChangeset for help on using the changeset viewer.