[OpenAFS-devel] Re: patches for afs-krb5 (fix 64-bit bug, etc)

Christopher Allen Wing wingc@engin.umich.edu
Thu, 20 May 2004 14:04:18 -0400 (EDT)


Thanks for writing back.

Is there a better place to find the afs-krb5 source code other than
central.org? Is afs-krb5 the 'canonical' source code to aklog these days?



On Thu, 20 May 2004, Ken Hornstein wrote:

> Hm, since we don't ever call res_search, I'm not even sure we need this
> test; might as well delete it alltogether.

Sounds good.

> >	http://www-personal.engin.umich.edu/~wingc/aklog/patches/2-com_err.patch
>
> Sigh, the whole com_err mess is neverending.

On Red Hat, it's provided as a base library for the system. The best thing
to do is probably to just see if it's already there when doing a test link
with the Kerberos libraries?

> >5. And finally, here's an actual bug. krb5_build_principal() is a varargs
> >function that expects a list of string pointers, terminated by a final
> >NULL. The original aklog code used '0' instead, which is passed as an int
> >and not automatically promoted to a pointer (as would be the case if it
> >was specified for a fixed argument). On a 64-bit machine, this results in
> >pushing a 32-bit value onto the stack instead of the expected 64-bit
> >pointer. So krb5_build_principal() never finds the terminating null and
> >starts following invalid pointers.
>
> Turns out you learn something new every day.  However ... I'm not sure
> this is necessarily the correct approach.  From what I've read, NULL is
> not guaranteed to be ((void *) 0) (or something similar).  I think
> the best solution is to have an explicit cast in that statement.

Garrett Wollman already wrote me about this. I guess it should be replaced
with (char *)NULL or something like that.

NULL gets redefined in various header files, and lots of systems do things
like:

	#ifdef __cplusplus
	#define NULL 0
	#else
	#define NULL 0L
	#endif


so the cast would be safest.

I'm just used to seeing code like:

	execl("blah", arg, arg, arg, NULL);


I didn't try to compile the rest of afs-krb5. What parts are still
relevant with MIT krb5-1.3? fakeka is now integrated, but I don't know
offhand about the rest.


Thanks,

Chris
wingc@engin.umich.edu