summaryrefslogtreecommitdiff
path: root/src/providers
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-11-22 16:06:14 -0500
committerJakub Hrozek <jhrozek@redhat.com>2012-11-26 11:10:43 +0100
commitd5351fd908e78c7639c839853c737b96e048f95a (patch)
treec8b7dfc7611fe325c335d6536f0e445bd3152316 /src/providers
parent2e7a2bece1b00022f826d511a3eb87453e285862 (diff)
downloadsssd-d5351fd908e78c7639c839853c737b96e048f95a.tar.gz
sssd-d5351fd908e78c7639c839853c737b96e048f95a.tar.bz2
sssd-d5351fd908e78c7639c839853c737b96e048f95a.zip
Save errno before it might be modified.
The DEBUG() macro may, at any time, change and start calling functions that touch errno. Save errno before logging and then return the saved error.
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/krb5/krb5_become_user.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/providers/krb5/krb5_become_user.c b/src/providers/krb5/krb5_become_user.c
index cc4e6a58..082d1415 100644
--- a/src/providers/krb5/krb5_become_user.c
+++ b/src/providers/krb5/krb5_become_user.c
@@ -34,26 +34,34 @@ errno_t become_user(uid_t uid, gid_t gid)
DEBUG(SSSDBG_FUNC_DATA, ("Trying to become user [%d][%d].\n", uid, gid));
ret = setgid(gid);
if (ret == -1) {
- DEBUG(1, ("setgid failed [%d][%s].\n", errno, strerror(errno)));
- return errno;
+ ret = errno;
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("setgid failed [%d][%s].\n", ret, strerror(ret)));
+ return ret;
}
ret = setuid(uid);
if (ret == -1) {
- DEBUG(1, ("setuid failed [%d][%s].\n", errno, strerror(errno)));
- return errno;
+ ret = errno;
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("setuid failed [%d][%s].\n", ret, strerror(ret)));
+ return ret;
}
ret = setegid(gid);
if (ret == -1) {
- DEBUG(1, ("setegid failed [%d][%s].\n", errno, strerror(errno)));
- return errno;
+ ret = errno;
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("setegid failed [%d][%s].\n", ret, strerror(ret)));
+ return ret;
}
ret = seteuid(uid);
if (ret == -1) {
- DEBUG(1, ("seteuid failed [%d][%s].\n", errno, strerror(errno)));
- return errno;
+ ret = errno;
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("seteuid failed [%d][%s].\n", ret, strerror(ret)));
+ return ret;
}
return EOK;