From 884b1305806847e2e05a07988b77d3b5f77a37bc Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 15 Aug 2013 18:40:30 -0400 Subject: KRB5: Only set active and valid on success The FILE cache only sets the return values of _active and _bool if the entire function succeeds. The DIR cache was setting it even on failure. This patch makes both consistent. This will benefit static analysis tools which would be able to detect if the variable is ever used uninitialized anywhere. --- src/providers/krb5/krb5_utils.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/providers/krb5') diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c index 55f05f89..13ba9b5f 100644 --- a/src/providers/krb5/krb5_utils.c +++ b/src/providers/krb5/krb5_utils.c @@ -1006,9 +1006,9 @@ cc_dir_check_existing(const char *location, uid_t uid, const char *realm, const char *princ, const char *cc_template, bool *_active, bool *_valid) { - bool active = false; + bool active; bool active_primary = false; - bool valid = false; + bool valid; enum sss_krb5_cc_type type; const char *filename; const char *dir; @@ -1068,7 +1068,6 @@ cc_dir_check_existing(const char *location, uid_t uid, ("Could not check if ccache is active.\n")); } cc_check_template(cc_template); - active = false; goto done; } @@ -1087,7 +1086,6 @@ cc_dir_check_existing(const char *location, uid_t uid, DEBUG(SSSDBG_OP_FAILURE, ("Could not check if file 'primary' [%s] in dir ccache" " is active.\n", primary_file)); - active = false; goto done; } @@ -1096,11 +1094,12 @@ cc_dir_check_existing(const char *location, uid_t uid, goto done; } + *_active = active; + *_valid = valid; ret = EOK; + done: talloc_free(tmp_ctx); - *_active = active; - *_valid = valid; return ret; } -- cgit