@@ -2467,7 +2467,6 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
24672467#ifdef HAVE_SETATTRLIST
24682468int do_setattrlist_times (const char * path , STRUCT_STAT * stp )
24692469{
2470- extern int am_daemon , am_chrooted ;
24712470 struct attrlist attrList ;
24722471 struct timespec ts [2 ];
24732472
@@ -2477,7 +2476,7 @@ int do_setattrlist_times(const char *path, STRUCT_STAT *stp)
24772476
24782477 /* setattrlist() takes a raw path and follows parent symlinks
24792478 * (FSOPT_NOFOLLOW only blocks the final component). On a
2480- * daemon-no-chroot deployment , return ENOSYS so set_times()'
2479+ * confined receiver , return ENOSYS so set_times()'
24812480 * tier walk falls through to do_utimensat_at(), which routes
24822481 * the timestamp update through a secure parent dirfd. The
24832482 * macOS-specific attribute set this function would have used
@@ -2502,33 +2501,36 @@ int do_setattrlist_times(const char *path, STRUCT_STAT *stp)
25022501}
25032502
25042503#ifdef SUPPORT_CRTIMES
2505- int do_setattrlist_crtime (const char * path , time_t crtime )
2504+ int do_setattrlist_crtime (int dfd , const char * leaf , const char * path , time_t crtime )
25062505{
2507- extern int am_daemon , am_chrooted ;
25082506 struct attrlist attrList ;
25092507 struct timespec ts ;
25102508
25112509 if (dry_run ) return 0 ;
25122510 RETURN_ERROR_IF_RO_OR_LO ;
25132511
2514- /* Same path-follows-parent-symlinks concern as
2515- * do_setattrlist_times. There is no portable at-aware variant
2516- * of setattrlist that targets ATTR_CMN_CRTIME, so on a
2517- * daemon-no-chroot deployment we return -1 and accept that
2518- * crtime preservation is silently dropped for that file (the
2519- * caller treats this as "crtime not updated"). The transfer
2520- * itself continues normally. */
2521- if (secure_relpath_active ()) {
2522- errno = ENOSYS ;
2523- return -1 ;
2524- }
2525-
25262512 ts .tv_sec = crtime ;
25272513 ts .tv_nsec = 0 ;
25282514
25292515 memset (& attrList , 0 , sizeof attrList );
25302516 attrList .bitmapcount = ATTR_BIT_MAP_COUNT ;
25312517 attrList .commonattr = ATTR_CMN_CRTIME ;
2518+
2519+ #ifdef HAVE_SETATTRLISTAT
2520+ if (dfd >= 0 )
2521+ return setattrlistat (dfd , leaf , & attrList , & ts , sizeof ts , FSOPT_NOFOLLOW );
2522+ #else
2523+ (void )dfd ;
2524+ (void )leaf ;
2525+ #endif
2526+
2527+ /* The raw path form follows parent symlinks, so confined receivers need
2528+ * the held-parent form above. */
2529+ if (secure_relpath_active ()) {
2530+ errno = ENOSYS ;
2531+ return -1 ;
2532+ }
2533+
25322534 return setattrlist (path , & attrList , & ts , sizeof ts , FSOPT_NOFOLLOW );
25332535}
25342536#endif
@@ -2538,15 +2540,14 @@ int do_setattrlist_crtime(const char *path, time_t crtime)
25382540time_t get_create_time (const char * path , STRUCT_STAT * stp )
25392541{
25402542#ifdef HAVE_GETATTRLIST
2541- extern int am_daemon , am_chrooted ;
25422543 static struct create_time attrBuf ;
25432544 struct attrlist attrList ;
25442545
25452546 (void )stp ;
25462547 /* getattrlist() is also path-based and follows parent
2547- * symlinks. In daemon-no-chroot , refuse rather than read the
2548+ * symlinks. In a confined receiver , refuse rather than read the
25482549 * crtime of a file the parent-symlink chain might point at
2549- * outside the module . The caller's "no crtime available"
2550+ * outside the transfer root . The caller's "no crtime available"
25502551 * path returns 0; the file gets a fresh crtime instead of
25512552 * preserving the source's. */
25522553 if (secure_relpath_active ())
0 commit comments