diff options
author | Sumit Bose <sbose@redhat.com> | 2010-05-14 11:35:11 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-05-27 14:44:13 -0400 |
commit | d3e7cadfc9a09d6e3f7ae1f7f33c7dddd0bb1661 (patch) | |
tree | 0e5edc7d25cb6719951668b2d105ac6c397c63d4 | |
parent | 8eb2a35e3b180e76da4be5beab11cdb4038860b2 (diff) | |
download | sssd-d3e7cadfc9a09d6e3f7ae1f7f33c7dddd0bb1661.tar.gz sssd-d3e7cadfc9a09d6e3f7ae1f7f33c7dddd0bb1661.tar.xz sssd-d3e7cadfc9a09d6e3f7ae1f7f33c7dddd0bb1661.zip |
Refactor krb5_finalize()
-rw-r--r-- | src/providers/krb5/krb5_common.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c index f038557d9..dfcb50260 100644 --- a/src/providers/krb5/krb5_common.c +++ b/src/providers/krb5/krb5_common.c @@ -435,22 +435,19 @@ done: return ret; } -void krb5_finalize(struct tevent_context *ev, - struct tevent_signal *se, - int signum, - int count, - void *siginfo, - void *private_data) + +static errno_t remove_krb5_info_files(TALLOC_CTX *mem_ctx, const char *realm) { - char *realm = (char *)private_data; int ret; errno_t err; char *file; - file = talloc_asprintf(se, KDCINFO_TMPL, realm); + file = talloc_asprintf(mem_ctx, KDCINFO_TMPL, realm); if(file == NULL) { - sig_term(signum); + DEBUG(1, ("talloc_asprintf failed.\n")); + return ENOMEM; } + errno = 0; ret = unlink(file); if (ret == -1) { @@ -459,10 +456,10 @@ void krb5_finalize(struct tevent_context *ev, err, strerror(err))); } - errno = 0; - file = talloc_asprintf(se, KPASSWDINFO_TMPL, realm); + file = talloc_asprintf(mem_ctx, KPASSWDINFO_TMPL, realm); if(file == NULL) { - sig_term(signum); + DEBUG(1, ("talloc_asprintf failed.\n")); + return ENOMEM; } errno = 0; @@ -473,5 +470,23 @@ void krb5_finalize(struct tevent_context *ev, err, strerror(err))); } + return EOK; +} + +void krb5_finalize(struct tevent_context *ev, + struct tevent_signal *se, + int signum, + int count, + void *siginfo, + void *private_data) +{ + char *realm = (char *)private_data; + int ret; + + ret = remove_krb5_info_files(se, realm); + if (ret != EOK) { + DEBUG(1, ("remove_krb5_info_files failed.\n")); + } + sig_term(signum); } |