URL: https://github.com/SSSD/sssd/pull/722 Author: jhrozek Title: #722: KCM: Deleting a non-existent ccache should not yield an error Action: synchronized
To pull the PR as Git branch: git remote add ghsssd https://github.com/SSSD/sssd git fetch ghsssd pull/722/head:pr722 git checkout pr722
From 902cbbb071d8549473d131d21b18043311ccd5c4 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek <jhro...@redhat.com> Date: Thu, 3 Jan 2019 15:07:59 +0100 Subject: [PATCH 1/2] KCM: Deleting a non-existent ccache should not yield an error Resolves: https://pagure.io/SSSD/sssd/issue/3910 When the KCM destroy operation is called, it receives a name as an input. If the name cannot be found, we would currently return KRB5_CC_NOTFOUND. But other ccache types return KRB5_FCC_NOFILE in that case and e.g. utilities like kdestroy special case KRB5_FCC_NOFILE to be non-fatal. --- src/responder/kcm/kcmsrv_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/responder/kcm/kcmsrv_ops.c b/src/responder/kcm/kcmsrv_ops.c index 1e229adc4..9352909f4 100644 --- a/src/responder/kcm/kcmsrv_ops.c +++ b/src/responder/kcm/kcmsrv_ops.c @@ -698,9 +698,10 @@ static void kcm_op_destroy_getbyname_done(struct tevent_req *subreq) ret = kcm_ccdb_uuid_by_name_recv(subreq, state, uuid); talloc_zfree(subreq); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, + DEBUG(SSSDBG_MINOR_FAILURE, "Cannot get matching ccache [%d]: %s\n", ret, sss_strerror(ret)); + ret = ERR_NO_MATCHING_CREDS; tevent_req_error(req, ret); return; } From 825e19c77cbe021853b9c160c6aac9417dc51fee Mon Sep 17 00:00:00 2001 From: Jakub Hrozek <jhro...@redhat.com> Date: Thu, 3 Jan 2019 15:08:28 +0100 Subject: [PATCH 2/2] TESTS: Add a test for deleting a non-existent ccache with KCM --- src/tests/multihost/basic/test_kcm.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tests/multihost/basic/test_kcm.py b/src/tests/multihost/basic/test_kcm.py index 87e325bd7..7202dcb4a 100644 --- a/src/tests/multihost/basic/test_kcm.py +++ b/src/tests/multihost/basic/test_kcm.py @@ -122,3 +122,20 @@ def test_kcm_debug_level_set(self, multihost, enable_kcm): log_lines_debug = self._kcm_log_length(multihost) assert log_lines_debug > log_lines_pre + 100 + + def test_kdestroy_retval(self, multihost, enable_kcm): + """ + Test that destroying an empty cache does not return a non-zero + return code. + """ + ssh = SSHClient(multihost.master[0].sys_hostname, + username='foo3', password='Secret123') + + (_, _, exit_status) = ssh.execute_cmd('kdestroy') + assert exit_status == 0 + # Run the command again in case there was something in the ccache + # previously + (_, _, exit_status) = ssh.execute_cmd('kdestroy') + assert exit_status == 0 + + ssh.close()
_______________________________________________ sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org