From: Ken Raeburn Date: Tue, 30 Apr 1996 22:25:26 +0000 (+0000) Subject: * t_ser.c (stuff): New variable. X-Git-Tag: krb5-1.0-beta6~167 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c0456f5d048f3b9316ffaabbb9166962aeb72c15;p=krb5.git * t_ser.c (stuff): New variable. (ser_acontext_test, ser_eblock_test, ser_cksum_test): Use it, instead of assuming it's valid to treat &FUNCTION as a data pointer. * conv_princ.c (sconv_list): Now const. (krb5_*_conv_principal): Use pointer to const for it. Tue Apr 23 19:39:59 1996 Mark Eichin * get_creds.c (krb5_get_credentials): this isn't the kernel, so don't return negative errno values. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7875 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index c9985e7ca..39b1ff601 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,18 @@ +Tue Apr 30 18:19:01 1996 Ken Raeburn + + * t_ser.c (stuff): New variable. + (ser_acontext_test, ser_eblock_test, ser_cksum_test): Use it, + instead of assuming it's valid to treat &FUNCTION as a data + pointer. + + * conv_princ.c (sconv_list): Now const. + (krb5_*_conv_principal): Use pointer to const for it. + + Tue Apr 23 19:39:59 1996 Mark Eichin + + * get_creds.c (krb5_get_credentials): this isn't the kernel, so + don't return negative errno values. + Sat Apr 27 19:14:21 1996 Richard Basch * fwd_tgt.c (krb5_fwd_tgt_creds): fixed a possible null dereference. diff --git a/src/lib/krb5/krb/conv_princ.c b/src/lib/krb5/krb/conv_princ.c index 7e4d43ea9..d11fac337 100644 --- a/src/lib/krb5/krb/conv_princ.c +++ b/src/lib/krb5/krb/conv_princ.c @@ -54,7 +54,7 @@ struct krb_convert { * kadmin/REALM.NAME. It should be kadmin/kerberos.master.host, but * we'll fix that in the next release. */ -static struct krb_convert sconv_list[] = { +static const struct krb_convert sconv_list[] = { {"kadmin", "kadmin", 0}, {"rcmd", "host", DO_REALM_CONVERSION}, {"discuss", "discuss", DO_REALM_CONVERSION}, @@ -110,7 +110,7 @@ krb5_524_conv_principal(context, princ, name, inst, realm) char *inst; char *realm; { - struct krb_convert *p; + const struct krb_convert *p; krb5_data *compo; char *c; @@ -178,7 +178,7 @@ krb5_425_conv_principal(context, name, instance, realm, princ) const char *realm; krb5_principal *princ; { - struct krb_convert *p; + const struct krb_convert *p; char buf[256]; /* V4 instances are limited to 40 characters */ krb5_error_code retval; char *domain, *cp; diff --git a/src/lib/krb5/krb/get_creds.c b/src/lib/krb5/krb/get_creds.c index 32bac9dad..c0b8912e7 100644 --- a/src/lib/krb5/krb/get_creds.c +++ b/src/lib/krb5/krb/get_creds.c @@ -57,7 +57,7 @@ krb5_get_credentials(context, options, ccache, in_creds, out_creds) krb5_flags fields; if (!in_creds || !in_creds->server || !in_creds->client) - return -EINVAL; + return EINVAL; memset((char *)&mcreds, 0, sizeof(krb5_creds)); mcreds.magic = KV5M_CREDS; @@ -86,7 +86,7 @@ krb5_get_credentials(context, options, ccache, in_creds, out_creds) } if ((ncreds = (krb5_creds *)malloc(sizeof(krb5_creds))) == NULL) - return -ENOMEM; + return ENOMEM; memset((char *)ncreds, 0, sizeof(krb5_creds)); ncreds->magic = KV5M_CREDS; diff --git a/src/lib/krb5/krb/t_ser.c b/src/lib/krb5/krb/t_ser.c index 08235ec9d..3e0062d85 100644 --- a/src/lib/krb5/krb/t_ser.c +++ b/src/lib/krb5/krb/t_ser.c @@ -28,6 +28,11 @@ #include "k5-int.h" #include "auth_con.h" +static const char stuff[]="You can't take a pointer to a function and convert \ +it to a pointer to char; ANSI doesn't say it'll work, and in fact on the HPPA \ +you can lose some bits of the function pointer, and get a pointer that you \ +can't safely dereference. This test file used to make this mistake, often."; + /* * Dump an external representation. */ @@ -336,7 +341,7 @@ ser_acontext_test(kcontext, verbose) adataent.magic = KV5M_AUTHDATA; adataent.ad_type = 123; adataent.length = 128; - adataent.contents = (krb5_octet *) ser_acontext_test; + adataent.contents = (krb5_octet *) stuff; adatalist[0] = &adataent; adatalist[1] = &adataent; adatalist[2] = (krb5_authdata *) NULL; @@ -512,7 +517,7 @@ ser_eblock_test(kcontext, verbose) krb5_use_enctype(kcontext, &eblock, DEFAULT_KDC_ENCTYPE); if (!(kret = ser_data(verbose, "> NULL eblock", (krb5_pointer) &eblock, KV5M_ENCRYPT_BLOCK))) { - eblock.priv = (krb5_pointer) ser_eblock_test; + eblock.priv = (krb5_pointer) stuff; eblock.priv_size = 8; if (!(kret = ser_data(verbose, "> eblock with private data", (krb5_pointer) &eblock, @@ -589,11 +594,7 @@ ser_cksum_test(kcontext, verbose) checksum.checksum_type = 123; checksum.length = sizeof(ckdata); checksum.contents = ckdata; -#if 0 - memcpy(ckdata, (char *) &ser_cksum_test, sizeof(ckdata)); -#else - memcpy(ckdata, (char *) &ser_princ_test, sizeof(ckdata)); -#endif + memcpy(ckdata, (char *) &stuff, sizeof(ckdata)); if (!(kret = ser_data(verbose, "> checksum with data", (krb5_pointer) &checksum, KV5M_CHECKSUM))) { if (verbose)