summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-05-28 16:39:15 +0200
committerStephen Gallagher <sgallagh@redhat.com>2012-06-14 15:52:28 -0400
commit727937fb86cfb042063f02fa2a229d236d7f105f (patch)
tree55d0e8b73c838adad86ffc412df5355f04359343
parente3319541af46d8b0de7e0b865c37904cf6216b58 (diff)
downloadsssd-727937fb86cfb042063f02fa2a229d236d7f105f.tar.gz
sssd-727937fb86cfb042063f02fa2a229d236d7f105f.tar.bz2
sssd-727937fb86cfb042063f02fa2a229d236d7f105f.zip
Two small krb5_child fixes
* Allocation check was missing * a DEBUG statement overwrote errno
-rw-r--r--src/providers/krb5/krb5_child.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index 199ef67b..1a9d6552 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -262,13 +262,18 @@ static krb5_error_code create_ccache_file(krb5_context ctx,
goto done;
}
tmp_ccname = talloc_asprintf_append(tmp_ccname, "/.krb5cc_dummy_XXXXXX");
+ if (tmp_ccname == NULL) {
+ kerr = ENOMEM;
+ goto done;
+ }
old_umask = umask(077);
fd = mkstemp(tmp_ccname);
umask(old_umask);
if (fd == -1) {
- DEBUG(1, ("mkstemp failed [%d][%s].\n", errno, strerror(errno)));
kerr = errno;
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("mkstemp failed [%d][%s].\n", kerr, strerror(kerr)));
goto done;
}
@@ -315,15 +320,17 @@ static krb5_error_code create_ccache_file(krb5_context ctx,
if (ccname_len >= 6 && strcmp(cc_file_name + (ccname_len-6), "XXXXXX")==0 ) {
fd = mkstemp(cc_file_name);
if (fd == -1) {
- DEBUG(1, ("mkstemp failed [%d][%s].\n", errno, strerror(errno)));
kerr = errno;
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("mkstemp failed [%d][%s].\n", kerr, strerror(kerr)));
goto done;
}
}
kerr = rename(tmp_ccname, cc_file_name);
if (kerr == -1) {
- DEBUG(1, ("rename failed [%d][%s].\n", errno, strerror(errno)));
+ kerr = errno;
+ DEBUG(1, ("rename failed [%d][%s].\n", kerr, strerror(kerr)));
}
DEBUG(SSSDBG_TRACE_LIBS, ("Created ccache file: [%s]\n", cc_file_name));