Another one we've had at iXsystems for a while -- although the code there uses a file in /etc, which did not strike me as the best way to do it. This allows us to switch between active and passive servers.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Looks ok to me. (I'll admit I don't understand when it is useful, but that's ok.;-)
The one change I might suggest is a sanity check for the strlen() of the "-V" optarg
being <= MAXHOSTNAMELEN.
I see that you use strlcpy(), so the code is safe w.r.t. not overflowing the buffer on
the stack, but it would result in a truncated hostname and confusion later, for the
case where "strlen(optarg) > MAXHOSTNAMELEN.
Fixed the date in the man page (although I guess it's already wrong :)), and don't set the virtual host if it's too long.
Thanks for adding the strlen() check. I am going to be nitpicky and suggest an
error message be printed (not sure if the nfsd should fail or just log an error?),
since silently ignoring the "-V" argument could cause confusion too, I think?
I didn't think it should fail, and since it's a daemon I'd have to have logging set up
to really have a meaningful error; that's why I just let it silently ignore it. I can
put out a warnx call easily enough.
Warn if the virtual hostname argument is too long. (Note that this is only a warning.)