* ktbase.c (krb5_kt_resolve): Signed/unsigned int
authorEzra Peisach <epeisach@mit.edu>
Tue, 17 Oct 2000 23:00:27 +0000 (23:00 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 17 Oct 2000 23:00:27 +0000 (23:00 +0000)
cleanups. Maintain const char * attribute of incomming name.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12781 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/keytab/ChangeLog
src/lib/krb5/keytab/file/ChangeLog
src/lib/krb5/keytab/file/ktf_g_name.c
src/lib/krb5/keytab/file/ktf_util.c
src/lib/krb5/keytab/file/ktfile.h
src/lib/krb5/keytab/ktbase.c
src/lib/krb5/keytab/srvtab/ChangeLog
src/lib/krb5/keytab/srvtab/kts_g_name.c
src/lib/krb5/keytab/srvtab/ktsrvtab.h

index af053f2bb0aa9778478c9bf5741d7695290ec361..62f13946d0e8ca59069b6161f0b9c479ebabc7e8 100644 (file)
@@ -1,3 +1,8 @@
+2000-10-17  Ezra Peisach  <epeisach@mit.edu>
+
+       * ktbase.c (krb5_kt_resolve): Signed/unsigned int
+       cleanups. Maintain const char * attribute of incomming name.
+
 2000-03-12  Ezra Peisach  <epeisach@mit.edu>
 
        * ktbase.c (krb5_kt_resolve): Change prototype from const to
index 2eeab44bb2f9bce62d3c55c4d025ef812af721c3..c1e910a93cfb0b2a40011ac0165fcf900e7d2684 100644 (file)
@@ -1,3 +1,10 @@
+2000-10-17  Ezra Peisach  <epeisach@mit.edu>
+
+       * ktf_util.c: Unsigned/signed int cleanups.
+
+       * ktf_g_name.c, ktfile.h (krb5_ktfile_get_name): Length field now
+       unsigned int.
+
 2000-09-25  Ezra Peisach  <epeisach@mit.edu>
 
        * ser_ktf.c (krb5_ktf_keytab_externalize): Do not violate const char * 
index 083ca387e8ee61ba1db346a43cfa8f1d2d5f1829..b3145e50c6a0d4b08876651ecdc05a92ac6b7b50 100644 (file)
@@ -35,7 +35,7 @@ krb5_ktfile_get_name(context, id, name, len)
     krb5_context context;
   krb5_keytab id;
   char *name;
-  int len;
+  unsigned int len;
   /* 
    * This routine returns the name of the name of the file associated with
    * this file-based keytab.  name is zeroed and the filename is truncated
index d583581bc5d1c0eb3afa700227df5558a45ffbd5..81737462538e314e736f76cf9d5d1d1b65a0309a 100644 (file)
@@ -255,6 +255,7 @@ krb5_int32 *delete_point;
 {
     krb5_octet vno;
     krb5_int16 count;
+    unsigned int u_count, u_princ_size;
     krb5_int16 enctype;
     krb5_int16 princ_size;
     register int i;
@@ -311,9 +312,11 @@ krb5_int32 *delete_point;
     if (!ret_entry->principal)
         return ENOMEM;
     
+    u_count = count;
     ret_entry->principal->magic = KV5M_PRINCIPAL;
-    ret_entry->principal->length = count;
-    ret_entry->principal->data = (krb5_data *)calloc(count, sizeof(krb5_data));
+    ret_entry->principal->length = u_count;
+    ret_entry->principal->data = (krb5_data *) 
+                                 calloc(u_count, sizeof(krb5_data));
     if (!ret_entry->principal->data) {
        free(ret_entry->principal);
        ret_entry->principal = 0;
@@ -331,13 +334,15 @@ krb5_int32 *delete_point;
            error = KRB5_KT_END;
            goto fail;
     }
-    krb5_princ_set_realm_length(context, ret_entry->principal, princ_size);
-    tmpdata = malloc(princ_size+1);
+    u_princ_size = princ_size;
+
+    krb5_princ_set_realm_length(context, ret_entry->principal, u_princ_size);
+    tmpdata = malloc(u_princ_size+1);
     if (!tmpdata) {
            error = ENOMEM;
            goto fail;
     }
-    if (fread(tmpdata, 1, princ_size, KTFILEP(id)) != (size_t) princ_size) {
+    if (fread(tmpdata, 1, u_princ_size, KTFILEP(id)) != (size_t) princ_size) {
            free(tmpdata);
            error = KRB5_KT_END;
            goto fail;
@@ -360,13 +365,14 @@ krb5_int32 *delete_point;
            goto fail;
         }
 
-       princ->length = princ_size;
-       princ->data = malloc(princ_size+1);
+       u_princ_size = princ_size; 
+       princ->length = u_princ_size;
+       princ->data = malloc(u_princ_size+1);
        if (!princ->data) {
            error = ENOMEM;
            goto fail;
         }
-       if (!xfread(princ->data, sizeof(char), princ_size, KTFILEP(id))) {
+       if (!xfread(princ->data, sizeof(char), u_princ_size, KTFILEP(id))) {
            error = KRB5_KT_END;
            goto fail;
         }
@@ -421,9 +427,11 @@ krb5_int32 *delete_point;
        error = KRB5_KT_END;
        goto fail;
     }
-    ret_entry->key.length = count;
+
+    u_count = count;
+    ret_entry->key.length = u_count;
     
-    ret_entry->key.contents = (krb5_octet *)malloc(count);
+    ret_entry->key.contents = (krb5_octet *)malloc(u_count);
     if (!ret_entry->key.contents) {
        error = ENOMEM;
        goto fail;
index 8ee5756f664920e959e32daf179e47aa281f413f..6481bc29d01d1ae2a33c6d5afa7bb09dc25077e7 100644 (file)
@@ -79,7 +79,7 @@ krb5_error_code KRB5_CALLCONV krb5_ktfile_get_name
        PROTOTYPE((krb5_context,
                   krb5_keytab,
                   char *,
-                  int));
+                  unsigned int));
 
 krb5_error_code KRB5_CALLCONV krb5_ktfile_close 
        PROTOTYPE((krb5_context,
index f438ca6a6364089298fe74252da60d0e0a3a3459..a112581197dfe8b28f1449ebb3e684c486692f8a 100644 (file)
@@ -88,16 +88,17 @@ krb5_kt_resolve (context, name, ktid)
     krb5_keytab FAR *ktid;
 {
     struct krb5_kt_typelist *tlist;
-    char *pfx, *resid, *cp;
-    int pfxlen;
+    char *pfx;
+    unsigned int pfxlen;
+    const char *cp, *resid;
     
     cp = strchr (name, ':');
     if (!cp) {
            return (*krb5_kt_dfl_ops.resolve)(context, name, ktid);
     }
 
-    pfxlen = cp - (char *)name;
-    resid = (char *)name + pfxlen + 1;
+    pfxlen = cp - name;
+    resid = name + pfxlen + 1;
        
     pfx = malloc (pfxlen+1);
     if (!pfx)
index 780b5d55e2ad74a065f93a503f62562a40a33711..8c435868a906f395ee4607525a7276895a0b04af 100644 (file)
@@ -1,3 +1,8 @@
+2000-10-17  Ezra Peisach  <epeisach@mit.edu>
+
+       * kts_g_name.c, ktsrvtab.h (krb5_ktsrvtab_get_name): Uses unsigned
+       int length now.
+
 2000-06-28  Ezra Peisach  <epeisach@mit.edu>
 
        * kts_util.c (read_field): Cleanup unused variable.
index bb72acfa4c137bc01a2f206d9a68e5df2841ef3b..31fc5aa18e3200d6dd65b6b0648ddf06a85e1fa9 100644 (file)
@@ -35,7 +35,7 @@ krb5_ktsrvtab_get_name(context, id, name, len)
     krb5_context context;
     krb5_keytab id;
     char *name;
-    int len;
+    unsigned int len;
   /* 
    * This routine returns the name of the name of the file associated with
    * this srvtab-based keytab.  The name is prefixed with PREFIX:, so that
index 12f11891245d85a743b33d1fb373456987f3b7f5..c7e069505b7cad655614837933be287017d823d1 100644 (file)
@@ -71,7 +71,7 @@ krb5_error_code KRB5_CALLCONV krb5_ktsrvtab_get_name
        PROTOTYPE((krb5_context,
                   krb5_keytab,
                   char *,
-                  int));
+                  unsigned int));
 
 krb5_error_code KRB5_CALLCONV krb5_ktsrvtab_close
        PROTOTYPE((krb5_context,