aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2012-10-27 01:20:48 +0000
committerEitan Adler <eadler@FreeBSD.org>2012-10-27 01:20:48 +0000
commitbd8bbd99ee83fc40a8dfc0ba1863f4f0a60551ce (patch)
tree8217da9bd2248b4d8f7c616b0c76a62eaf1d06d7 /libexec
parentd4412219467728c6f3ba3417cddb6ec91d7c4bdd (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.c5
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);