* t_ser.c (stuff): New variable.
authorKen Raeburn <raeburn@mit.edu>
Tue, 30 Apr 1996 22:25:26 +0000 (22:25 +0000)
committerKen Raeburn <raeburn@mit.edu>
Tue, 30 Apr 1996 22:25:26 +0000 (22:25 +0000)
(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  <eichin@cygnus.com>

* 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

src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/conv_princ.c
src/lib/krb5/krb/get_creds.c
src/lib/krb5/krb/t_ser.c

index c9985e7cab23441802a9382b54e3eb6e8a869b19..39b1ff6017285a729205d50a86a539e87fc74f8b 100644 (file)
@@ -1,3 +1,18 @@
+Tue Apr 30 18:19:01 1996  Ken Raeburn  <raeburn@cygnus.com>
+
+       * 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  <eichin@cygnus.com>
+
+       * 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  <basch@lehman.com>
 
        * fwd_tgt.c (krb5_fwd_tgt_creds): fixed a possible null dereference.
index 7e4d43ea97bdbaf73d6ae95ab7870cab702945e6..d11fac3375dc20ee66bfa7bdf39da32ab9929bee 100644 (file)
@@ -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;
index 32bac9dadc60f9c72ebbd5cdc98cbd69566f17a6..c0b8912e767da2fde17a843e24ae97b452943a6e 100644 (file)
@@ -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;
index 08235ec9d1917c151ce79521f4c375d3f03888a7..3e0062d8598d634632e55dc9ec3df833ec165748 100644 (file)
 #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)