Recreate Kerberos ccache directory if it's missing

Resolves: rhbz#853558 - [sssd[krb5_child[PID]]]: Credential cache
                        directory /run/user/UID/ccdir does not exist
This commit is contained in:
Jakub Hrozek 2013-01-30 14:41:47 +01:00
parent e4c185bf07
commit 2da8f67cdb
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From cae3bf6af22855adc8dd7b270e11207f0a33c385 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Wed, 30 Jan 2013 13:45:27 +0100
Subject: [PATCH] krb: recreate ccache if it was deleted
https://fedorahosted.org/sssd/ticket/1512
If directory where a ccache file was stored was missing and user
was still logged in, we erroneously considered the ccache file
still active. Thus the ccache file was not recreated and user was
unable to login.
---
src/providers/krb5/krb5_utils.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c
index b770714be030076203b6578f90ef726226cb72f8..7b56be52497ae66fa536b76ca0561ec3cc3208ce 100644
--- a/src/providers/krb5/krb5_utils.c
+++ b/src/providers/krb5/krb5_utils.c
@@ -770,8 +770,15 @@ cc_residual_is_used(uid_t uid, const char *ccname,
ret = lstat(ccname, &stat_buf);
- if (ret == -1 && errno != ENOENT) {
+ if (ret == -1) {
ret = errno;
+ if (ret == ENOENT) {
+ DEBUG(SSSDBG_FUNC_DATA, ("Cache file [%s] does not exists, "
+ "it will be recreated\n", ccname));
+ *result = false;
+ return EOK;
+ }
+
DEBUG(SSSDBG_OP_FAILURE,
("stat failed [%d][%s].\n", ret, strerror(ret)));
return ret;
--
1.7.11.7

View File

@ -16,7 +16,7 @@
Name: sssd Name: sssd
Version: 1.9.4 Version: 1.9.4
Release: 2%{?dist} Release: 3%{?dist}
Group: Applications/System Group: Applications/System
Summary: System Security Services Daemon Summary: System Security Services Daemon
License: GPLv3+ License: GPLv3+
@ -25,6 +25,8 @@ Source0: https://fedorahosted.org/released/sssd/%{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
### Patches ### ### Patches ###
Patch0001: 0001-krb-recreate-ccache-if-it-was-deleted.patch
Patch0501: 0501-FEDORA-Switch-the-default-ccache-location.patch Patch0501: 0501-FEDORA-Switch-the-default-ccache-location.patch
### Dependencies ### ### Dependencies ###
@ -523,6 +525,11 @@ fi
%postun -n libsss_sudo -p /sbin/ldconfig %postun -n libsss_sudo -p /sbin/ldconfig
%changelog %changelog
* Wed Jan 30 2013 Jakub Hrozek <jhrozek@redhat.com> - 1.9.4-3
- Recreate Kerberos ccache directory if it's missing
- Resolves: rhbz#853558 - [sssd[krb5_child[PID]]]: Credential cache
directory /run/user/UID/ccdir does not exist
* Tue Jan 29 2013 Jakub Hrozek <jhrozek@redhat.com> - 1.9.4-2 * Tue Jan 29 2013 Jakub Hrozek <jhrozek@redhat.com> - 1.9.4-2
- Fix changelog dates to make F19 rpmbuild happy - Fix changelog dates to make F19 rpmbuild happy