specifying a list of files to transfer
wayned at users.sourceforge.net
Wed Jan 15 21:35:01 EST 2003
On Wed, Jan 15, 2003 at 02:48:05PM -0600, Lee Eakin wrote:
> Now if I can only figure out a way to intercept the list when I need to
> be real picky about which individual files are accessed ...
This should be possible with a filter process. Here's how the new,
slightly tweaked protocol works:
1. The normal startup exchange occurs up to the point just before where
the (normal) file info (names + attributes) starts to flow from the
sender to the receiver.
2a At this point IFF the sender is the remote process (i.e. we're
pulling files), the receiver begins to send file names (separated by
either newlines or nulls, as indicated by the --null option) over the
socket (normally there is no data being sent to the sender during
this stage). The end of the list is marked by an empty entry. (Note
that the receiver begins receiving file info from the sender during
this stage, so it must do both things at once without blocking.) If
the recursive flag is set, the receiver may get more names back than
it sends out.
2b Alternately, if the sender is the local process, the normal file info
transfer happens (without anything new occurring over the socket).
3. The rest of the transfer proceeds as normal.
So, if a filter understood the protocol enough to be able to pass
through all the initial rsync data, it could actually look at all the
names that go over the wire and allow/disallow/tweak them however it
desired. (It's sad that this filter would then have to continue to
relay all the data over the socket after its work was done, but that's
the price you pay.) You'd just have to look for the --null option on
the command-line to know if you're looking for a newline or a null EOL
character, and stop scanning at the first empty name.
Alternately, you could just disallow the --files-from option and not
worry about authorizing the data.
More information about the rsync