summaryrefslogtreecommitdiffstats
path: root/libexec/tftpd
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2012-10-22 03:07:05 +0000
committereadler <eadler@FreeBSD.org>2012-10-22 03:07:05 +0000
commita603c87b0251c5b6077c28864b1aeb21c40f4086 (patch)
tree90ec7fe4bf0dae506d699603babb4917082f098a /libexec/tftpd
parentb55c76b1b0ad13886a22eb6abb2363bb324bc7cb (diff)
downloadFreeBSD-src-a603c87b0251c5b6077c28864b1aeb21c40f4086.zip
FreeBSD-src-a603c87b0251c5b6077c28864b1aeb21c40f4086.tar.gz
Check the return error of set[e][ug]id. While this can never fail in the
current version of FreeBSD, this isn't guarenteed by the API. Custom security modules, or future implementations of the setuid and setgid may fail. Submitted by: Erik Cederstrand Approved by: cperciva MFC after: 3 days
Diffstat (limited to 'libexec/tftpd')
-rw-r--r--libexec/tftpd/tftpd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 7363abf..a0010b3 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -371,7 +371,10 @@ main(int argc, char *argv[])
}
chdir("/");
setgroups(1, &nobody->pw_gid);
- setuid(nobody->pw_uid);
+ if (setuid(nobody->pw_uid) != 0) {
+ tftp_log(LOG_ERR, "setuid failed");
+ exit(1);
+ }
}
len = sizeof(me_sock);
OpenPOWER on IntegriCloud