diff options
| author | Eitan Adler <eadler@FreeBSD.org> | 2012-10-27 01:20:48 +0000 |
|---|---|---|
| committer | Eitan Adler <eadler@FreeBSD.org> | 2012-10-27 01:20:48 +0000 |
| commit | bd8bbd99ee83fc40a8dfc0ba1863f4f0a60551ce (patch) | |
| tree | 8217da9bd2248b4d8f7c616b0c76a62eaf1d06d7 /libexec | |
| parent | d4412219467728c6f3ba3417cddb6ec91d7c4bdd (diff) | |
MFC r241848:
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.
Approved by: cperciva (implicit)
Notes
svn path=/stable/9/; revision=242166
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/tftpd/tftpd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index 16702b70cb1f..634e0f821276 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); |
