summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2013-08-15 18:40:30 -0400
committerJakub Hrozek <jhrozek@redhat.com>2013-08-22 19:29:08 +0200
commit884b1305806847e2e05a07988b77d3b5f77a37bc (patch)
tree4e4a78930871bb2c0841134a15adfc3cb9c599ca
parent18dff5d8bb4081af4c94339db9342b8a5b7d121e (diff)
downloadsssd-884b1305806847e2e05a07988b77d3b5f77a37bc.tar.gz
sssd-884b1305806847e2e05a07988b77d3b5f77a37bc.tar.bz2
sssd-884b1305806847e2e05a07988b77d3b5f77a37bc.zip
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.
-rw-r--r--src/providers/krb5/krb5_utils.c11
1 files changed, 5 insertions, 6 deletions
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;
}