[2432] in Kerberos_V5_Development
Unsigned ints and longs.... (sign expansion)
daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Mon Jul 14 21:25:10 1997
From: epeisach@MIT.EDU
Date: Mon, 14 Jul 1997 21:24:41 -0400
To: krbdev@MIT.EDU
This is a problem on the Alpha's using the current source tree
(krb51.0pl1 + changes):
The problem stems from the fact that we are trying to overload the
minor status return code from the gssapi level (which is an unsigned
interger) with a krb5 error, which is a long.
The following problem in from lib/gssapi/generic/disp_com_err_status.c
and with GCC 2.7.2.2 Dec OSF 4.0A. The native C compiler does not have
this problem. In the last release, I had patched the com_err library
to do something to I believe work around this problem which in
retrospect was not so kosher, which Richard has changed part of the NT
port. I believe that the com_err library is correct in its behavior at
the moment.
The problem:
We have:
OM_uint32
g_display_com_err_status(minor_status, status_value, status_string)
OM_uint32 *minor_status;
OM_uint32 status_value;
gss_buffer_t status_string;
So far so good, but then we have:
if (! g_make_string_buffer(((status_value == 0)?no_error:
error_message(status_value)),
status_string)) {
error_message is prototyped to take a long as an argument.
Now, if status is a negative value (i.e. any good ol fashioned krb5
error code), it appears that gcc is calling error_message with what
appears to be a positive long value (essentially positive of the krb5
error).
If the prototype for error_message is removed, then the negative value
is being passed on down. (I suspect gcc assumes that error_message
takes an unsigned int in absence of information).
What I believe is happening is that gcc being smart, expects an
unsigned int, and wants to convert it to a long. I may be wrong about
this. How do I track down if either gcc is wrong, cc is wrong, or we
are doing something wrong. I think this may be a difficiency in the C
binding for the gssapi layer, or in our use of it.
Any ideas? My hack fix is to bcopy the data into a long - and that
works - but is ugly....
Ezra