From: Ezra Peisach Date: Fri, 6 Oct 2000 16:24:32 +0000 (+0000) Subject: * krb524d.c (do_connection): Do not assume that sizeof(int) == 4 X-Git-Tag: krb5-1.3-alpha1~1854 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d80f58f8c649edbdc4f67fe9eece8388567c7552;p=krb5.git * krb524d.c (do_connection): Do not assume that sizeof(int) == 4 * encode.c (encode_int32, decode_int32): Do not assume sizeof(int) == 4. * conv_creds.c (krb524_convert_creds_kdc): Do not assume sizeof(int) == 4 in network packet. * cnv_tkt_skey.c (krb524int_krb_cr_tkt_int): Ensure that OTW flags is one byte long. An error was introduced when prototypes were widened. * Makefile.in (includes): When testing to see if krb524_err.h exists in the include directory, compare against the build trees version. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12725 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/krb524/ChangeLog b/src/krb524/ChangeLog index bb2bd42be..d8a7a6ab3 100644 --- a/src/krb524/ChangeLog +++ b/src/krb524/ChangeLog @@ -1,3 +1,21 @@ +2000-10-06 Ezra Peisach + + * krb524d.c (do_connection): Do not assume that sizeof(int) == 4. + + * encode.c (encode_int32, decode_int32): Do not assume + sizeof(int) == 4. + + * conv_creds.c (krb524_convert_creds_kdc): Do not assume + sizeof(int) == 4 in network packet. + + * cnv_tkt_skey.c (krb524int_krb_cr_tkt_int): Ensure that OTW flags + is one byte long. An error was introduced when prototypes were + widened. + + * Makefile.in (includes): When testing to see if krb524_err.h + exists in the include directory, compare against the build trees + version. + 2000-10-03 Ezra Peisach * Makefile.in: Install krb524.h and krb524_err.h header file so diff --git a/src/krb524/Makefile.in b/src/krb524/Makefile.in index 64c942de2..b49587b25 100644 --- a/src/krb524/Makefile.in +++ b/src/krb524/Makefile.in @@ -92,7 +92,7 @@ includes:: krb524.h krb524_err.h $(CP) $(srcdir)/krb524.h \ $(BUILDTOP)/include/krb524.h) ; \ fi - if cmp $(srcdir)/krb524_err.h \ + if cmp krb524_err.h \ $(BUILDTOP)/include/krb524_err.h >/dev/null 2>&1; then :; \ else \ (set -x; $(RM) $(BUILDTOP)/include/krb524_err.h; \ diff --git a/src/krb524/cnv_tkt_skey.c b/src/krb524/cnv_tkt_skey.c index b4fe386ff..deb2f2e20 100644 --- a/src/krb524/cnv_tkt_skey.c +++ b/src/krb524/cnv_tkt_skey.c @@ -322,10 +322,10 @@ krb524int_krb_cr_tkt_krb5(tkt, flags, pname, pinstance, prealm, paddress, } static int -krb524int_krb_cr_tkt_int(tkt, flags, pname, pinstance, prealm, paddress, +krb524int_krb_cr_tkt_int(tkt, flags_in, pname, pinstance, prealm, paddress, session, life, time_sec, sname, sinstance, key, k5key) KTEXT tkt; /* Gets filled in by the ticket */ - unsigned int flags; /* Various Kerberos flags */ + unsigned int flags_in; /* Various Kerberos flags */ char *pname; /* Principal's name */ char *pinstance; /* Principal's instance */ char *prealm; /* Principal's authentication domain */ @@ -341,6 +341,8 @@ krb524int_krb_cr_tkt_int(tkt, flags, pname, pinstance, prealm, paddress, Key_schedule key_s; register char *data; /* running index into ticket */ + unsigned char flags = flags_in & 0xFF; /* This must be one byte */ + tkt->length = 0; /* Clear previous data */ /* Check length of ticket */ diff --git a/src/krb524/conv_creds.c b/src/krb524/conv_creds.c index d5a9c3a79..68a80200f 100644 --- a/src/krb524/conv_creds.c +++ b/src/krb524/conv_creds.c @@ -63,14 +63,14 @@ krb524_convert_creds_kdc(context, v5creds, v4creds) p = reply.data; ret = ntohl(*((krb5_error_code *) p)); - p += sizeof(krb5_error_code); - reply.length -= sizeof(krb5_error_code); + p += sizeof(krb5_int32); + reply.length -= sizeof(krb5_int32); if (ret) goto fail; v4creds->kvno = ntohl(*((krb5_error_code *) p)); - p += sizeof(int); - reply.length -= sizeof(int); + p += sizeof(krb5_int32); + reply.length -= sizeof(krb5_int32); ret = decode_v4tkt(&v4creds->ticket_st, p, &reply.length); fail: diff --git a/src/krb524/encode.c b/src/krb524/encode.c index c81023de5..6c480d404 100644 --- a/src/krb524/encode.c +++ b/src/krb524/encode.c @@ -70,7 +70,7 @@ int encode_int32(out, outlen, v) int *outlen; krb5_int32 *v; { - int nv; + krb5_int32 nv; /* Must be 4 bytes */ nv = htonl(*v); return encode_bytes(out, outlen, (char *) &nv, sizeof(nv)); @@ -118,7 +118,7 @@ int decode_int32(out, outlen, v) krb5_int32 *v; { int ret; - int nv; + krb5_int32 nv; /* Must be four bytes */ if ((ret = decode_bytes(out, outlen, (char *) &nv, sizeof(nv)))) return ret; diff --git a/src/krb524/krb524d.c b/src/krb524/krb524d.c index cad0e3160..1561a9561 100644 --- a/src/krb524/krb524d.c +++ b/src/krb524/krb524d.c @@ -252,7 +252,8 @@ krb5_error_code do_connection(s, context) krb5_keyblock v5_service_key, v4_service_key; krb5_data msgdata, tktdata; char msgbuf[MSGSIZE], tktbuf[TKT_BUFSIZ], *p; - int n, ret, saddrlen; + int ret, saddrlen; + krb5_int32 n; /* Must be 4 bytes */ krb5_kvno v4kvno; /* Clear out keyblock contents so we don't accidentally free the stack.*/ @@ -283,7 +284,7 @@ krb5_error_code do_connection(s, context) break; default: /* try and recognize our own error packet */ - if (msgdata.length == sizeof(int)) + if (msgdata.length == sizeof(krb5_int32)) return KRB5_BADMSGTYPE; else goto error; @@ -342,17 +343,17 @@ error: msgdata.length = 0; n = htonl(ret); - memcpy(p, (char *) &n, sizeof(int)); - p += sizeof(int); - msgdata.length += sizeof(int); + memcpy(p, (char *) &n, sizeof(krb5_int32)); + p += sizeof(krb5_int32); + msgdata.length += sizeof(krb5_int32); if (ret) goto write_msg; n = htonl(v4kvno); - memcpy(p, (char *) &n, sizeof(int)); - p += sizeof(int); - msgdata.length += sizeof(int); + memcpy(p, (char *) &n, sizeof(krb5_int32)); + p += sizeof(krb5_int32); + msgdata.length += sizeof(krb5_int32); memcpy(p, tktdata.data, tktdata.length); p += tktdata.length;