summaryrefslogtreecommitdiffstats
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:34:07 +0200
commit9ac2585a2bb368093312309f103449e435162cc6 (patch)
tree98832caae783e477490a6cb1e81dc958e0099ca3
parentab5a1c26df2d81edc4638da53743427635b8c1ae (diff)
downloadsssd-9ac2585a2bb368093312309f103449e435162cc6.tar.gz
sssd-9ac2585a2bb368093312309f103449e435162cc6.tar.xz
sssd-9ac2585a2bb368093312309f103449e435162cc6.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 65bbfab10..c6967ea58 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;
}