[33069] in Kerberos
Re: Clearing credentials question
daemon@ATHENA.MIT.EDU (Russ Allbery)
Fri Jan 7 12:49:26 2011
From: Russ Allbery <rra@stanford.edu>
To: kerberos@mit.edu
In-Reply-To: <ig667i$6as$1@grapevine.csail.mit.edu> (Garrett Wollman's message
of "Fri, 7 Jan 2011 04:53:06 +0000 (UTC)")
Date: Fri, 07 Jan 2011 09:49:20 -0800
Message-ID: <871v4ohae7.fsf@windlord.stanford.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: kerberos-bounces@mit.edu
wollman@bimajority.org (Garrett Wollman) writes:
> Well, technically, Standard C says you're supposed to:
> static const krb5_creds zero_initialized_creds;
> krb5_creds creds = zero_initialized_creds;
> Nobody ever does this.
Yeah, I always cringe when I write the memset() code, since there's no
guarantee whatsoever that all-bits-zero is a NULL pointer. But of course
in practice every platform on which MIT Kerberos could conceivably compile
(for unrelated reasons) uses all-bits-zero as a NULL pointer, so as you
mention it's only a pedantic concern.
> Kerberos developers could follow the example of POSIX threads and
> provide a manifest constant so that clients could do:
> krb5_creds creds = KRB5_CREDS_INITIALIZER;
> ...to give some additional clarity. A good compiler will optimize
> this initializer (which in C99 but not C89/C90 could be made a real
> rvalue) into the memset call, whereas it may not be able to do the
> same for the zero_initialized_creds version.
That would be nice, actually, although only for satisfying my feelings of
strict standards compliance. :)
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
________________________________________________
Kerberos mailing list Kerberos@mit.edu
https://mailman.mit.edu/mailman/listinfo/kerberos