summaryrefslogtreecommitdiffstats
path: root/libexec/tftpd/tftpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/tftpd/tftpd.c')
-rw-r--r--libexec/tftpd/tftpd.c10
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)) {
OpenPOWER on IntegriCloud