diff options
author | wollman <wollman@FreeBSD.org> | 2000-09-14 19:08:29 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 2000-09-14 19:08:29 +0000 |
commit | fd6ae2da94ab1c8fd1b66fb552185f0cf0c1f218 (patch) | |
tree | 3c1bae6ff3bb80ae6f3800406e614394851403c6 /libexec/tftpd/tftpd.c | |
parent | eeb064d69ce03414f67fa4bfbc006e2187f8ca07 (diff) | |
download | FreeBSD-src-fd6ae2da94ab1c8fd1b66fb552185f0cf0c1f218.zip FreeBSD-src-fd6ae2da94ab1c8fd1b66fb552185f0cf0c1f218.tar.gz |
Allow tftpd to run as a specified user, not just `nobody'.
Update documentation to reflect new option. Also fix documentation
style and add missing references.
PR: 21268
Submitted by: "Aleksandr A. Babaylov" <babolo@links.ru>
Reviewed by: imp
Diffstat (limited to 'libexec/tftpd/tftpd.c')
-rw-r--r-- | libexec/tftpd/tftpd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index 07475a4..56c6c02 100644 --- a/libexec/tftpd/tftpd.c +++ b/libexec/tftpd/tftpd.c @@ -121,9 +121,10 @@ main(argc, argv) struct sockaddr_in sin; char *chroot_dir = NULL; struct passwd *nobody; + char *chuser = "nobody"; openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_FTP); - while ((ch = getopt(argc, argv, "lns:")) != -1) { + while ((ch = getopt(argc, argv, "lns:u:")) != -1) { switch (ch) { case 'l': logging = 1; @@ -134,6 +135,9 @@ main(argc, argv) case 's': chroot_dir = optarg; break; + case 'u': + chuser = optarg; + break; default: syslog(LOG_WARNING, "ignoring unknown option -%c", ch); } @@ -226,8 +230,8 @@ main(argc, argv) */ if (chroot_dir) { /* Must get this before chroot because /etc might go away */ - if ((nobody = getpwnam("nobody")) == NULL) { - syslog(LOG_ERR, "nobody: no such user"); + if ((nobody = getpwnam(chuser)) == NULL) { + syslog(LOG_ERR, "%s: no such user", chuser); exit(1); } if (chroot(chroot_dir)) { |