From: Ezra Peisach Date: Tue, 17 Oct 2000 23:00:27 +0000 (+0000) Subject: * ktbase.c (krb5_kt_resolve): Signed/unsigned int X-Git-Tag: krb5-1.3-alpha1~1822 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3cc4e404e8a3b56a4b88e7eb1fd6b5badaee6742;p=krb5.git * ktbase.c (krb5_kt_resolve): Signed/unsigned int cleanups. Maintain const char * attribute of incomming name. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12781 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/ChangeLog b/src/lib/krb5/keytab/ChangeLog index af053f2bb..62f13946d 100644 --- a/src/lib/krb5/keytab/ChangeLog +++ b/src/lib/krb5/keytab/ChangeLog @@ -1,3 +1,8 @@ +2000-10-17 Ezra Peisach + + * ktbase.c (krb5_kt_resolve): Signed/unsigned int + cleanups. Maintain const char * attribute of incomming name. + 2000-03-12 Ezra Peisach * ktbase.c (krb5_kt_resolve): Change prototype from const to diff --git a/src/lib/krb5/keytab/file/ChangeLog b/src/lib/krb5/keytab/file/ChangeLog index 2eeab44bb..c1e910a93 100644 --- a/src/lib/krb5/keytab/file/ChangeLog +++ b/src/lib/krb5/keytab/file/ChangeLog @@ -1,3 +1,10 @@ +2000-10-17 Ezra Peisach + + * 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 * ser_ktf.c (krb5_ktf_keytab_externalize): Do not violate const char * diff --git a/src/lib/krb5/keytab/file/ktf_g_name.c b/src/lib/krb5/keytab/file/ktf_g_name.c index 083ca387e..b3145e50c 100644 --- a/src/lib/krb5/keytab/file/ktf_g_name.c +++ b/src/lib/krb5/keytab/file/ktf_g_name.c @@ -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 diff --git a/src/lib/krb5/keytab/file/ktf_util.c b/src/lib/krb5/keytab/file/ktf_util.c index d583581bc..817374625 100644 --- a/src/lib/krb5/keytab/file/ktf_util.c +++ b/src/lib/krb5/keytab/file/ktf_util.c @@ -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; diff --git a/src/lib/krb5/keytab/file/ktfile.h b/src/lib/krb5/keytab/file/ktfile.h index 8ee5756f6..6481bc29d 100644 --- a/src/lib/krb5/keytab/file/ktfile.h +++ b/src/lib/krb5/keytab/file/ktfile.h @@ -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, diff --git a/src/lib/krb5/keytab/ktbase.c b/src/lib/krb5/keytab/ktbase.c index f438ca6a6..a11258119 100644 --- a/src/lib/krb5/keytab/ktbase.c +++ b/src/lib/krb5/keytab/ktbase.c @@ -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) diff --git a/src/lib/krb5/keytab/srvtab/ChangeLog b/src/lib/krb5/keytab/srvtab/ChangeLog index 780b5d55e..8c435868a 100644 --- a/src/lib/krb5/keytab/srvtab/ChangeLog +++ b/src/lib/krb5/keytab/srvtab/ChangeLog @@ -1,3 +1,8 @@ +2000-10-17 Ezra Peisach + + * kts_g_name.c, ktsrvtab.h (krb5_ktsrvtab_get_name): Uses unsigned + int length now. + 2000-06-28 Ezra Peisach * kts_util.c (read_field): Cleanup unused variable. diff --git a/src/lib/krb5/keytab/srvtab/kts_g_name.c b/src/lib/krb5/keytab/srvtab/kts_g_name.c index bb72acfa4..31fc5aa18 100644 --- a/src/lib/krb5/keytab/srvtab/kts_g_name.c +++ b/src/lib/krb5/keytab/srvtab/kts_g_name.c @@ -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 diff --git a/src/lib/krb5/keytab/srvtab/ktsrvtab.h b/src/lib/krb5/keytab/srvtab/ktsrvtab.h index 12f118912..c7e069505 100644 --- a/src/lib/krb5/keytab/srvtab/ktsrvtab.h +++ b/src/lib/krb5/keytab/srvtab/ktsrvtab.h @@ -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,