On Wed, Mar 30, 2016 at 1:57 PM, Todd C. Miller
<[email protected]> wrote:
> The file mode is passed from client to server as a printf string
> formatted with %04o (unsigned) so use strtoul() not strtol() to
> parse it.  Error out on modes > 07777.
>
> There is no way that the mode can ever be -1 so remove those checks.

Uh, yes there is: recvdir() passes mode=-1 to fchog(), which passes it
through to setfilemode().

I'm not sure fchog() is a great abstraction, with fd sometimes -1 and
mode sometimes -1.  Maybe the owner/group -> uid/gid mapping bit
should be broken out into a routine which can be shared by two
routines, one for the fd!=-1 case and one for the fd==-1 case?
Inlining and simplifying the setfilemode() and setownership() bits is
then easy.  I.e., more like how pax was written to do it.  :-)

Also dislike the lack of getpwnam()/getgrnam() caching.  Even a single
entry cache would be a big win for the common case.


Philip Guenther

Reply via email to