From: Ezra Peisach Date: Mon, 25 Sep 2000 21:08:11 +0000 (+0000) Subject: * cc_file.c ccbase.c, cc_stdio.c, cc_retr.c, cc_memory.c: More X-Git-Tag: krb5-1.3-alpha1~1884 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3ad649a103a0d53eeb7d0e706e3680b82c621436;p=krb5.git * cc_file.c ccbase.c, cc_stdio.c, cc_retr.c, cc_memory.c: More signed/unsigned fixes. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12671 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index bfe95675d..e1eb808d8 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,8 @@ +2000-09-25 Ezra Peisach + + * cc_file.c ccbase.c, cc_stdio.c, cc_retr.c, cc_memory.c: More + signed/unsigned fixes. + Sat Sep 23 23:42:32 2000 Ezra Peisach * t_cc.c: Code cleanup. Test more failure modes of the cache library. diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c index f55fb76fa..fc092f0af 100644 --- a/src/lib/krb5/ccache/cc_file.c +++ b/src/lib/krb5/ccache/cc_file.c @@ -306,8 +306,9 @@ krb5_fcc_read(context, id, buf, len) int len; { int ret; + unsigned ulen = len; - ret = read(((krb5_fcc_data *) id->data)->fd, (char *) buf, len); + ret = read(((krb5_fcc_data *) id->data)->fd, (char *) buf, ulen); if (ret == -1) return krb5_fcc_interpret(context, errno); else if (ret != len) @@ -524,7 +525,7 @@ krb5_fcc_read_data(context, id, data) return KRB5_OK; } - data->data = (char *) malloc(data->length+1); + data->data = (char *) malloc((unsigned) data->length+1); if (data->data == NULL) return KRB5_CC_NOMEM; @@ -569,7 +570,7 @@ krb5_fcc_read_addr(context, id, addr) if (addr->length == 0) return KRB5_OK; - addr->contents = (krb5_octet *) malloc(addr->length); + addr->contents = (krb5_octet *) malloc((unsigned) addr->length); if (addr->contents == NULL) return KRB5_CC_NOMEM; @@ -752,7 +753,7 @@ krb5_fcc_read_authdatum(context, id, a) if (a->length == 0 ) return KRB5_OK; - a->contents = (krb5_octet *) malloc(a->length); + a->contents = (krb5_octet *) malloc((unsigned) a->length); if (a->contents == NULL) return KRB5_CC_NOMEM; @@ -789,8 +790,9 @@ krb5_fcc_write(context, id, buf, len) int len; { int ret; + unsigned int ulen = len; - ret = write(((krb5_fcc_data *)id->data)->fd, (char *) buf, len); + ret = write(((krb5_fcc_data *)id->data)->fd, (char *) buf, ulen); if (ret < 0) return krb5_fcc_interpret(context, errno); if (ret != len) @@ -1261,11 +1263,11 @@ krb5_fcc_skip_header(context, id) krb5_error_code kret; krb5_ui_2 fcc_flen; - lseek(data->fd, sizeof(krb5_ui_2), SEEK_SET); + lseek(data->fd, (off_t) sizeof(krb5_ui_2), SEEK_SET); if (data->version == KRB5_FCC_FVNO_4) { kret = krb5_fcc_read_ui_2(context, id, &fcc_flen); if (kret) return kret; - if(lseek(data->fd, fcc_flen, SEEK_CUR) < 0) + if(lseek(data->fd, (off_t) fcc_flen, SEEK_CUR) < 0) return errno; } return KRB5_OK; @@ -1385,7 +1387,7 @@ krb5_fcc_destroy(context, id) ((krb5_fcc_data *) id->data)->fd = ret; } else - lseek(((krb5_fcc_data *) id->data)->fd, 0, SEEK_SET); + lseek(((krb5_fcc_data *) id->data)->fd, (off_t) 0, SEEK_SET); #ifdef MSDOS_FILESYSTEM /* "disgusting bit of UNIX trivia" - that's how the writers of NFS describe @@ -1592,7 +1594,7 @@ krb5_fcc_start_seq_get(context, id, cursor) kret = krb5_fcc_skip_principal(context, id); if (kret) goto done; - fcursor->pos = lseek(data->fd, 0, SEEK_CUR); + fcursor->pos = lseek(data->fd, (off_t) 0, SEEK_CUR); *cursor = (krb5_cc_cursor) fcursor; done: @@ -1669,7 +1671,8 @@ krb5_fcc_next_cred(context, id, cursor, creds) kret = krb5_fcc_read_data(context, id, &creds->second_ticket); TCHECK(kret); - fcursor->pos = lseek(((krb5_fcc_data *) id->data)->fd, 0, SEEK_CUR); + fcursor->pos = lseek(((krb5_fcc_data *) id->data)->fd, (off_t) 0, + SEEK_CUR); cursor = (krb5_cc_cursor *) fcursor; lose: @@ -1918,7 +1921,7 @@ krb5_fcc_store(context, id, creds) MAYBE_OPEN(context, id, FCC_OPEN_RDWR); /* Make sure we are writing to the end of the file */ - ret = lseek(((krb5_fcc_data *) id->data)->fd, 0, SEEK_END); + ret = lseek(((krb5_fcc_data *) id->data)->fd, (off_t) 0, SEEK_END); if (ret < 0) { MAYBE_CLOSE_IGNORE(context, id); return krb5_fcc_interpret(context, errno); @@ -1932,7 +1935,7 @@ krb5_fcc_store(context, id, creds) TCHECK(ret); ret = krb5_fcc_store_times(context, id, &creds->times); TCHECK(ret); - ret = krb5_fcc_store_octet(context, id, creds->is_skey); + ret = krb5_fcc_store_octet(context, id, (krb5_int32) creds->is_skey); TCHECK(ret); ret = krb5_fcc_store_int32(context, id, creds->ticket_flags); TCHECK(ret); diff --git a/src/lib/krb5/ccache/cc_memory.c b/src/lib/krb5/ccache/cc_memory.c index f01bd6bbd..c7e0a4314 100644 --- a/src/lib/krb5/ccache/cc_memory.c +++ b/src/lib/krb5/ccache/cc_memory.c @@ -368,7 +368,7 @@ krb5_mcc_next_cred(context, id, cursor, creds) return KRB5_OK; clearticket: - memset(creds->ticket.data,0,creds->ticket.length); + memset(creds->ticket.data,0, (unsigned) creds->ticket.length); cleanticket: krb5_xfree(creds->ticket.data); cleanaddrs: diff --git a/src/lib/krb5/ccache/cc_retr.c b/src/lib/krb5/ccache/cc_retr.c index 8d439d329..11fc6ddbe 100644 --- a/src/lib/krb5/ccache/cc_retr.c +++ b/src/lib/krb5/ccache/cc_retr.c @@ -102,7 +102,7 @@ authdata_match(mdata, data) if ((mdatap->ad_type != datap->ad_type) || (mdatap->length != datap->length) || (memcmp ((char *)mdatap->contents, - (char *)datap->contents, mdatap->length) != 0)) + (char *)datap->contents, (unsigned) mdatap->length) != 0)) return FALSE; mdata++; data++; @@ -125,7 +125,8 @@ data_match(data1, data2) if (data1->length != data2->length) return FALSE; else - return memcmp(data1->data, data2->data, data1->length) ? FALSE : TRUE; + return memcmp(data1->data, data2->data, (unsigned) data1->length) + ? FALSE : TRUE; } static int diff --git a/src/lib/krb5/ccache/cc_stdio.c b/src/lib/krb5/ccache/cc_stdio.c index a887165fa..d647ad127 100644 --- a/src/lib/krb5/ccache/cc_stdio.c +++ b/src/lib/krb5/ccache/cc_stdio.c @@ -349,9 +349,10 @@ krb5_scc_read(context, id, buf, len) int len; { int ret; + unsigned int ulen = len; errno = 0; - ret = fread((char *) buf, 1, len, ((krb5_scc_data *) id->data)->file); + ret = fread((char *) buf, 1, ulen, ((krb5_scc_data *) id->data)->file); if ((ret == 0) && errno) return krb5_scc_interpret(context, errno); else if (ret != len) @@ -464,7 +465,8 @@ krb5_scc_read_addrs(context, id, addrs) /* Make *addrs able to hold length pointers to krb5_address structs * Add one extra for a null-terminated list */ - *addrs = (krb5_address **) calloc(length+1, sizeof(krb5_address *)); + *addrs = (krb5_address **) calloc((unsigned) length+1, + sizeof(krb5_address *)); if (*addrs == NULL) return KRB5_CC_NOMEM; @@ -563,7 +565,7 @@ krb5_scc_read_data(context, id, data) return KRB5_OK; } - data->data = (char *) malloc(data->length+1); + data->data = (char *) malloc((unsigned int) data->length+1); if (data->data == NULL) return KRB5_CC_NOMEM; @@ -608,7 +610,7 @@ krb5_scc_read_addr(context, id, addr) if (addr->length == 0) return KRB5_OK; - addr->contents = (krb5_octet *) malloc(addr->length); + addr->contents = (krb5_octet *) malloc((unsigned) addr->length); if (addr->contents == NULL) return KRB5_CC_NOMEM; @@ -733,7 +735,8 @@ krb5_scc_read_authdata(context, id, a) /* Make *a able to hold length pointers to krb5_authdata structs * Add one extra for a null-terminated list */ - *a = (krb5_authdata **) calloc(length+1, sizeof(krb5_authdata *)); + *a = (krb5_authdata **) calloc((unsigned) length+1, + sizeof(krb5_authdata *)); if (*a == NULL) return KRB5_CC_NOMEM; @@ -783,7 +786,7 @@ krb5_scc_read_authdatum(context, id, a) if (a->length == 0 ) return KRB5_OK; - a->contents = (krb5_octet *) malloc(a->length); + a->contents = (krb5_octet *) malloc((unsigned) a->length); if (a->contents == NULL) return KRB5_CC_NOMEM; @@ -820,9 +823,10 @@ krb5_scc_write(context, id, buf, len) int len; { int ret; + unsigned int ulen = len; errno = 0; - ret = fwrite((char *) buf, 1, len, ((krb5_scc_data *)id->data)->file); + ret = fwrite((char *) buf, 1, ulen, ((krb5_scc_data *)id->data)->file); if ((ret == 0) && errno) { return krb5_scc_interpret (context, errno); } else if (ret != len) @@ -2004,7 +2008,7 @@ krb5_scc_store(context, id, creds) TCHECK(ret); ret = krb5_scc_store_times(context, id, &creds->times); TCHECK(ret); - ret = krb5_scc_store_octet(context, id, creds->is_skey); + ret = krb5_scc_store_octet(context, id, (krb5_int32) creds->is_skey); TCHECK(ret); ret = krb5_scc_store_int32(context, id, creds->ticket_flags); TCHECK(ret); diff --git a/src/lib/krb5/ccache/ccbase.c b/src/lib/krb5/ccache/ccbase.c index 912571f78..b215d2901 100644 --- a/src/lib/krb5/ccache/ccbase.c +++ b/src/lib/krb5/ccache/ccbase.c @@ -88,7 +88,7 @@ krb5_cc_resolve (context, name, cache) struct krb5_cc_typelist *tlist; char *pfx, *cp; const char *resid; - int pfxlen; + unsigned int pfxlen; cp = strchr (name, ':'); if (!cp) {