aboutsummaryrefslogtreecommitdiff
path: root/libexec/tftpd
diff options
context:
space:
mode:
authorChristian S.J. Peron <csjp@FreeBSD.org>2004-06-30 18:58:19 +0000
committerChristian S.J. Peron <csjp@FreeBSD.org>2004-06-30 18:58:19 +0000
commit0c90b4887ef76d8909d955f46f6267d1a8f448a2 (patch)
tree90f050c277d9cbd4c8e4263b60afa2ba0ef54ea6 /libexec/tftpd
parentf5298929e3d5f034ec221d837925e90d1adb040d (diff)
downloadsrc-0c90b4887ef76d8909d955f46f6267d1a8f448a2.tar.gz
src-0c90b4887ef76d8909d955f46f6267d1a8f448a2.zip
The call to setuid(2) subsequently causes setgroups(2) to fail. setgroups(2)
requires super-user access in order to complete successfully. Move setgroups(2) to execute before setuid(2) so that it is successful.
Notes
Notes: svn path=/head/; revision=131358
Diffstat (limited to 'libexec/tftpd')
-rw-r--r--libexec/tftpd/tftpd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 29fe0e7533ce..d477d36f16b7 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -286,9 +286,9 @@ main(int argc, char *argv[])
syslog(LOG_ERR, "chroot: %s: %m", chroot_dir);
exit(1);
}
- chdir( "/" );
- setuid(nobody->pw_uid);
+ chdir("/");
setgroups(1, &nobody->pw_gid);
+ setuid(nobody->pw_uid);
}
len = sizeof(me);