Bug 2868 - Allow fifos to be copied by normal users
Allow fifos to be copied by normal users
Product: rsync
Classification: Unclassified
Component: core
x86 FreeBSD
: P3 enhancement
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on:
  Show dependency treegraph
Reported: 2005-07-09 04:10 UTC by Christian Recktenwald
Modified: 2006-03-12 02:56 UTC (History)
0 users

See Also:

patch, tweak to taste per comment (1.16 KB, patch)
2005-08-04 22:01 UTC, hoffa
no flags Details
Make special files copyable by non-root (11.44 KB, patch)
2005-09-03 09:49 UTC, Wayne Davison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Recktenwald 2005-07-09 04:10:04 UTC
the creation of a fifo (named pipe) is not a privileged function - at least on
freebsd, linux and solaris.
so it should not require root-privileges to be done.
instead they should be copied like ordinary files, too.
Comment 1 rsync user 2005-07-23 23:36:56 UTC
this should apply to both fifos and sockets.
creation of both are unprivileged operations,
see mkfifo(2), socket(2)/bind(2) on freebsd.
suggest moving/modifying do_mknod in these sections
to run regardles of uid and simply complain and continue
on platforms where those syscalls are restricted. just
like if a regular file can't be read due to perm/uid:
 rsync: send_files failed to open "/tmp/a.out": Permission denied (13)

any other eyes looking at this feature may wish to see related:

reply to bugzilla/samba list only, thx.
Comment 2 hoffa 2005-08-04 22:01:54 UTC
Created attachment 1356 [details]
patch, tweak to taste per comment

allow nonroot to try do_mknod() for fifo/sock/block/char. if block/char failed
due to nonroot perm denied [EPERM] in mknod(2):
 without -v, continue quietly, exit 0
 with -v, continue verbosely, exit 0
printing for both is the official pre-patch behavior, so the user may wish to
extend non-v with rsyserr(FINFO...) to match. actually, do_mknod's mknod()
should be wrapped with similar if and rsyserr 'skipping' statements before call
instead. applies to: cvs -D '2005-08-02 00:00:00-0000'. a little give back
against the debt, enjoy;-]
Comment 3 Wayne Davison 2005-09-03 09:49:33 UTC
Created attachment 1412 [details]
Make special files copyable by non-root

This patch divides what rsync considered "devices" into devices and specials,
making it possible to control the copying of each category via options.  For
full compatibility when copying to/from an older rsync, the -D option still
means "copy device-files and special-files".  Also, the -a option still turns
on the copying of both categories of files.  However, since specials are now
copied by non-root, this means that a user would need to specify "-a
--no-specials" to turn this off (or "-a --no-D" as a non-root user would also
do the same thing).  Note that the --devices option now turns on just the
copying of devices, so the user should use -D or "--devices --specials" for
both.  Finally, itemized output was extended to output special files with the
letter "s" (separating them from devices, which output with the letter "D").

Comment 4 Wayne Davison 2006-01-29 01:19:09 UTC
The CVS version now has the separation of devices and special files as described earlier (with only minor tweaks from the aforementioned patch, such as specials being listed in the itemized output as "S", not "s" to help avoid confusion with the the size-is-different flag).