summaryrefslogtreecommitdiffstats
path: root/libexec/tftpd
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2004-06-30 18:58:19 +0000
committercsjp <csjp@FreeBSD.org>2004-06-30 18:58:19 +0000
commit78ac741f004465bd5a1884fdc92b8e9f15062d12 (patch)
tree90f050c277d9cbd4c8e4263b60afa2ba0ef54ea6 /libexec/tftpd
parente9ca4b8fb3f27fe746a18a95a7ed08cf0e2cd0d8 (diff)
downloadFreeBSD-src-78ac741f004465bd5a1884fdc92b8e9f15062d12.zip
FreeBSD-src-78ac741f004465bd5a1884fdc92b8e9f15062d12.tar.gz
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.
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 29fe0e7..d477d36 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);
OpenPOWER on IntegriCloud