summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0f899e6)
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
As suggested by Olaf Kirch <okir@suse.de>, use setfsuid() rather than
seteuid() when creating a gss context. This prevents users from using
credentials that do not belong to them, while also preventing them from
doing things like killing, renicing, or changing the priority of the
gssd process while it is processing the context creation.
/* Create the context as the user (not as root) */
save_uid = geteuid();
/* Create the context as the user (not as root) */
save_uid = geteuid();
- if (seteuid(uid) != 0) {
- printerr(0, "WARNING: Failed to seteuid for "
+ if (setfsuid(uid) != 0) {
+ printerr(0, "WARNING: Failed to setfsuid for "
"user with uid %d\n", uid);
goto out_fail;
}
"user with uid %d\n", uid);
goto out_fail;
}
- printerr(2, "creating context using euid %d (save_uid %d)\n",
- geteuid(), save_uid);
+ printerr(2, "creating context using fsuid %d (save_uid %d)\n",
+ uid, save_uid);
sec.qop = GSS_C_QOP_DEFAULT;
sec.svc = RPCSEC_GSS_SVC_NONE;
sec.qop = GSS_C_QOP_DEFAULT;
sec.svc = RPCSEC_GSS_SVC_NONE;
gss_release_cred(&min_stat, &sec.cred);
if (a != NULL) freeaddrinfo(a);
/* Restore euid to original value */
gss_release_cred(&min_stat, &sec.cred);
if (a != NULL) freeaddrinfo(a);
/* Restore euid to original value */
- if ((save_uid != -1) && (seteuid(save_uid) != 0)) {
- printerr(0, "WARNING: Failed to restore euid"
- " to uid %d\n", save_uid);
+ if ((save_uid != -1) && (setfsuid(save_uid) != uid)) {
+ printerr(0, "WARNING: Failed to restore fsuid"
+ " to uid %d from %d\n", save_uid, uid);