[SSSD] [PATCH] check_cc_validity: make sure _valid is always set
Sumit Bose
sbose at redhat.com
Fri Aug 23 13:04:58 UTC 2013
On Fri, Aug 23, 2013 at 08:42:23AM -0400, Stephen Gallagher wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Fri 23 Aug 2013 04:19:33 AM EDT, Sumit Bose wrote:
> > Hi,
> >
> > this patch fixes a compiler warning in the latest master.
> >
>
> I made that change intentionally so that it would point out if there
> was any place in the code that was using _valid when the function
> returned anything other than EOK. If you're getting that warning, it
> probably means that some consuming function is misbehaving. Could you
> fix the bug there instead?
from check_cc_validity():
krberr = krb5_cc_resolve(context, location, &ccache);
if (krberr == KRB5_FCC_NOFILE || ccache == NULL) {
/* KRB5_FCC_NOFILE would be returned if the directory components
* of the DIR cache do not exist, which is the case in /run
* after a reboot
*/
DEBUG(SSSDBG_TRACE_FUNC,
("ccache %s is missing or empty\n", location));
valid = false;
ret = EOK;
goto done;
} else if (krberr != 0) {
....
ret = EOK;
*_valid = valid;
done:
if (ccache) krb5_cc_close(context, ccache);
krb5_free_context(context);
return ret;
In the KRB5_FCC_NOFILE case ret = EOK but _valid is not set. I think the
new patch might meet your intension.
bye,
Sumit
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.14 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEARECAAYFAlIXWK8ACgkQeiVVYja6o6O8fgCgpITIkuCoH3HaYEepcOx1FBQt
> h/8An1QdUMOYqDtsJmAeQiT2I5kNLTaH
> =WBIq
> -----END PGP SIGNATURE-----
-------------- next part --------------
From 572dd7a14e16a9776c288a909ef56f1526e5d3fa Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Fri, 23 Aug 2013 10:13:02 +0200
Subject: [PATCH] check_cc_validity: make sure _valid is always set
In the KRB5_FCC_NOFILE code path _valid is not set leading to 'may be
used uninitialized' compiler warnings.
---
src/providers/krb5/krb5_utils.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c
index 13ba9b5..7a4d287 100644
--- a/src/providers/krb5/krb5_utils.c
+++ b/src/providers/krb5/krb5_utils.c
@@ -750,12 +750,14 @@ check_cc_validity(const char *location,
}
ret = EOK;
- *_valid = valid;
- done:
- if (ccache) krb5_cc_close(context, ccache);
- krb5_free_context(context);
- return ret;
+done:
+ if (ret == EOK) {
+ *_valid = valid;
+ }
+ if (ccache) krb5_cc_close(context, ccache);
+ krb5_free_context(context);
+ return ret;
}
/*======== ccache back end utilities ========*/
--
1.7.7.6
More information about the sssd-devel
mailing list