From: Keith Vetter Date: Thu, 2 Mar 1995 04:22:26 +0000 (+0000) Subject: A few small changes for 16 vs 32 bit, pulling in winsock for network byte X-Git-Tag: krb5-1.0-beta5~612 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=94484a7911be3d20ef6602dac8235bdabece4684;p=krb5.git A few small changes for 16 vs 32 bit, pulling in winsock for network byte ordering and removed some unused local variables. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5058 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 7e3e5d6d2..13fc0ff20 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,11 @@ +Wed Mar 1 20:15:00 1995 Keith Vetter (keithv@fusion.com) + + * compat_r.c, copy_pri.c, get_fcre.c, get_in_t.c, init_ctx.c, in_tkt_p.c + in_tkt_s.c, preauth.c, princ_co.c, pr_to_sa.c, rd_req_d.c, recvauth.c + sendauth.c, send_tgs.c, unparse.c: 16 vs 32 bit casts, removed some + unused local variables, and pulled in winsock.h for network byte + ordering. + Tue Feb 28 01:14:57 1995 John Gilmore (gnu at toad.com) * *.c: Avoid includes. diff --git a/src/lib/krb5/krb/compat_recv.c b/src/lib/krb5/krb/compat_recv.c index 0a65e307c..25f18f1da 100644 --- a/src/lib/krb5/krb/compat_recv.c +++ b/src/lib/krb5/krb/compat_recv.c @@ -33,6 +33,7 @@ * to a V4 sendauth. */ +#define NEED_WINSOCK_H #include "k5-int.h" #ifndef _MSDOS #include @@ -41,8 +42,10 @@ #include #include +#ifndef _WINSOCKAPI_ #include #include +#endif static int krb_v4_recvauth(); @@ -164,7 +167,7 @@ krb5_compat_recvauth(context, * the version string, and make sure it matches. */ - len = ntohl(vers.len); + len = (int) ntohl(vers.len); if (len < 0 || len > 255) return KRB5_SENDAUTH_BADAUTHVERS; diff --git a/src/lib/krb5/krb/copy_princ.c b/src/lib/krb5/krb/copy_princ.c index 48775e20b..4e7fb9998 100644 --- a/src/lib/krb5/krb/copy_princ.c +++ b/src/lib/krb5/krb/copy_princ.c @@ -45,7 +45,7 @@ krb5_copy_principal(context, inprinc, outprinc) *tempprinc = *inprinc; /* Copy all of the non-allocated pieces */ - nelems = krb5_princ_size(context, inprinc); + nelems = (int) krb5_princ_size(context, inprinc); tempprinc->data = malloc(nelems * sizeof(krb5_data)); if (tempprinc->data == 0) { diff --git a/src/lib/krb5/krb/get_fcreds.c b/src/lib/krb5/krb/get_fcreds.c index 08f138fb8..9df5b3911 100644 --- a/src/lib/krb5/krb/get_fcreds.c +++ b/src/lib/krb5/krb/get_fcreds.c @@ -30,12 +30,13 @@ /* General-purpose forwarding routines. These routines may be put into */ /* libkrb5.a to allow widespread use */ +#define NEED_WINSOCK_H +#include "k5-int.h" #include -#ifndef _MSDOS +#ifndef _WINSOCKAPI_ #include #include - -#include "k5-int.h" +#endif #define KRB5_DEFAULT_LIFE 60*60*8 /* 8 hours */ /* helper function: convert flags to necessary KDC options */ @@ -57,7 +58,6 @@ krb5_get_for_creds(context, sumtype, rhost, client, enc_key, krb5_enctype etype; krb5_address **addrs; krb5_error_code retval; - krb5_data *scratch; krb5_kdc_rep *dec_rep = 0; krb5_error *err_reply; krb5_response tgsrep; @@ -224,4 +224,3 @@ errout: krb5_free_kdc_rep(context, dec_rep); return retval; } -#endif diff --git a/src/lib/krb5/krb/get_in_tkt.c b/src/lib/krb5/krb/get_in_tkt.c index 7acbb9473..2fb93048d 100644 --- a/src/lib/krb5/krb/get_in_tkt.c +++ b/src/lib/krb5/krb/get_in_tkt.c @@ -96,7 +96,7 @@ krb5_get_in_tkt(context, options, addrs, etypes, ptypes, key_proc, keyseed, krb5_data reply; krb5_keyblock *decrypt_key = 0; krb5_timestamp time_now; - krb5_pa_data *padata; +/* krb5_pa_data *padata; */ int f_salt = 0, use_salt = 0; krb5_data salt; char k4_version; /* same type as *(krb5_data::data) */ diff --git a/src/lib/krb5/krb/in_tkt_pwd.c b/src/lib/krb5/krb/in_tkt_pwd.c index 76fa1210d..c28806362 100644 --- a/src/lib/krb5/krb/in_tkt_pwd.c +++ b/src/lib/krb5/krb/in_tkt_pwd.c @@ -48,7 +48,6 @@ pwd_keyproc(context, type, salt, keyseed, key) { krb5_error_code retval; krb5_encrypt_block eblock; - const struct pwd_keyproc_arg *arg; char pwdbuf[BUFSIZ]; krb5_data * password; int pwsize = sizeof(pwdbuf); diff --git a/src/lib/krb5/krb/in_tkt_sky.c b/src/lib/krb5/krb/in_tkt_sky.c index 278895071..b8378e1d0 100644 --- a/src/lib/krb5/krb/in_tkt_sky.c +++ b/src/lib/krb5/krb/in_tkt_sky.c @@ -53,10 +53,7 @@ skey_keyproc(context, type, salt, keyseed, key) krb5_keyblock ** key; { krb5_keyblock *realkey; - const struct skey_keyproc_arg *arg; krb5_error_code retval; - krb5_keytab kt_id; - krb5_keytab_entry kt_ent; const krb5_keyblock * keyblock; keyblock = (const krb5_keyblock *)keyseed; diff --git a/src/lib/krb5/krb/init_ctx.c b/src/lib/krb5/krb/init_ctx.c index 199d8ef29..d137c29b4 100644 --- a/src/lib/krb5/krb/init_ctx.c +++ b/src/lib/krb5/krb/init_ctx.c @@ -116,7 +116,6 @@ krb5_get_default_in_tkt_etypes(context, etypes) krb5_enctype **etypes; { krb5_enctype * old_etypes; - int i; if (old_etypes = (krb5_enctype *)malloc(sizeof(krb5_enctype) * (context->etype_count + 1))) { diff --git a/src/lib/krb5/krb/pr_to_salt.c b/src/lib/krb5/krb/pr_to_salt.c index 5c7c794a1..2c614d946 100644 --- a/src/lib/krb5/krb/pr_to_salt.c +++ b/src/lib/krb5/krb/pr_to_salt.c @@ -37,7 +37,7 @@ krb5_principal2salt_internal(context, pr, ret, use_realm) int use_realm; { int size = 0, offset = 0; - int nelem; + krb5_int32 nelem; register int i; if (pr == 0) { @@ -51,7 +51,7 @@ krb5_principal2salt_internal(context, pr, ret, use_realm) if (use_realm) size += krb5_princ_realm(context, pr)->length; - for (i = 0; i < nelem; i++) + for (i = 0; i < (int) nelem; i++) size += krb5_princ_component(context, pr, i)->length; ret->length = size; @@ -63,7 +63,7 @@ krb5_principal2salt_internal(context, pr, ret, use_realm) memcpy(ret->data, krb5_princ_realm(context, pr)->data, offset); } - for (i = 0; i < nelem; i++) { + for (i = 0; i < (int) nelem; i++) { memcpy(&ret->data[offset], krb5_princ_component(context, pr, i)->data, krb5_princ_component(context, pr, i)->length); offset += krb5_princ_component(context, pr, i)->length; diff --git a/src/lib/krb5/krb/preauth.c b/src/lib/krb5/krb/preauth.c index f9c939b1c..8beade6ef 100644 --- a/src/lib/krb5/krb/preauth.c +++ b/src/lib/krb5/krb/preauth.c @@ -41,6 +41,10 @@ #include #include "k5-int.h" #include +#ifdef _MSDOS +#define getpid _getpid +#include +#endif static krb5_preauth_ops preauth_systems[] = { { @@ -324,18 +328,18 @@ get_unixtime_padata(context, client, src_addr, pa_data) if (retval) return retval; if ( !seeded) { - seeded = kdc_time + getpid(); + seeded = (int) kdc_time + getpid(); srand(seeded); } for (i=0; i < 8; i++) *tmp++ = rand() & 255; - *tmp++ = 0; - *tmp++ = (kdc_time >> 24) & 255; - *tmp++ = (kdc_time >> 16) & 255; - *tmp++ = (kdc_time >> 8) & 255; - *tmp++ = kdc_time & 255; + *tmp++ = (unsigned char) 0; + *tmp++ = (unsigned char) ((kdc_time >> 24) & 255); + *tmp++ = (unsigned char) ((kdc_time >> 16) & 255); + *tmp++ = (unsigned char) ((kdc_time >> 8) & 255); + *tmp++ = (unsigned char) (kdc_time & 255); return(0); } diff --git a/src/lib/krb5/krb/princ_comp.c b/src/lib/krb5/krb/princ_comp.c index 12a1df20f..0ada4a26b 100644 --- a/src/lib/krb5/krb/princ_comp.c +++ b/src/lib/krb5/krb/princ_comp.c @@ -49,7 +49,8 @@ krb5_principal_compare(context, princ1, princ2) krb5_const_principal princ1; krb5_const_principal princ2; { - register int i, nelem; + register int i; + krb5_int32 nelem; nelem = krb5_princ_size(context, princ1); if (nelem != krb5_princ_size(context, princ2)) @@ -58,7 +59,7 @@ krb5_principal_compare(context, princ1, princ2) if (! krb5_realm_compare(context, princ1, princ2)) return FALSE; - for (i = 0; i < nelem; i++) { + for (i = 0; i < (int) nelem; i++) { register const krb5_data *p1 = krb5_princ_component(context, princ1, i); register const krb5_data *p2 = krb5_princ_component(context, princ2, i); if (p1->length != p2->length || diff --git a/src/lib/krb5/krb/rd_req_dec.c b/src/lib/krb5/krb/rd_req_dec.c index c2ec2904f..e8599795b 100644 --- a/src/lib/krb5/krb/rd_req_dec.c +++ b/src/lib/krb5/krb/rd_req_dec.c @@ -203,7 +203,7 @@ krb5_rd_req_decoded(context, req, server, sender_addr, fetchfrom, keyproc, /* Hierarchical Cross-Realm */ - { int i; + { krb5_data lrealm; krb5_data *realm = krb5_princ_realm(context, req->ticket->enc_part2->client); krb5_transited *trans = &(req->ticket->enc_part2->transited); diff --git a/src/lib/krb5/krb/recvauth.c b/src/lib/krb5/krb/recvauth.c index 4d1c95041..171598664 100644 --- a/src/lib/krb5/krb/recvauth.c +++ b/src/lib/krb5/krb/recvauth.c @@ -25,14 +25,17 @@ */ +#define NEED_WINSOCK_H #include "k5-int.h" -#ifndef _MSDOS + #include "com_err.h" #include #include #include +#ifndef _WINSOCKAPI_ #include +#endif extern krb5_flags krb5_kdc_default_options; @@ -317,5 +320,3 @@ krb5_recvauth(context, krb5_xfree(authdat); return 0; } - -#endif diff --git a/src/lib/krb5/krb/send_tgs.c b/src/lib/krb5/krb/send_tgs.c index d20e4970b..9eb08668e 100644 --- a/src/lib/krb5/krb/send_tgs.c +++ b/src/lib/krb5/krb/send_tgs.c @@ -55,7 +55,7 @@ krb5_send_tgs(context, kdcoptions, timestruct, etypes, sumtype, sname, addrs, const krb5_cksumtype sumtype; krb5_const_principal sname; krb5_address * const * addrs; - const krb5_authdata ** authorization_data; + krb5_authdata * const * authorization_data; krb5_pa_data * const * padata; const krb5_data * second_ticket; krb5_creds * in_cred; @@ -97,7 +97,8 @@ krb5_send_tgs(context, kdcoptions, timestruct, etypes, sumtype, sname, addrs, /* need to encrypt it in the request */ krb5_encrypt_block eblock; - if (retval = encode_krb5_authdata(authorization_data, &scratch)) + if (retval = encode_krb5_authdata((const krb5_authdata**)authorization_data, + &scratch)) return(retval); krb5_use_cstype(context, &eblock, in_cred->keyblock.etype); tgsreq.authorization_data.etype = in_cred->keyblock.etype; diff --git a/src/lib/krb5/krb/sendauth.c b/src/lib/krb5/krb/sendauth.c index 9c18ed8b5..2fc46eaba 100644 --- a/src/lib/krb5/krb/sendauth.c +++ b/src/lib/krb5/krb/sendauth.c @@ -24,14 +24,12 @@ * convenience sendauth/recvauth functions */ +#define NEED_WINSOCK_H #include "k5-int.h" #include "com_err.h" #include #include #include -#ifdef _MSDOS -#define ECONNABORTED 53 -#endif #define WORKING_RCACHE diff --git a/src/lib/krb5/krb/unparse.c b/src/lib/krb5/krb/unparse.c index cf3b82dbb..64823c550 100644 --- a/src/lib/krb5/krb/unparse.c +++ b/src/lib/krb5/krb/unparse.c @@ -63,7 +63,8 @@ krb5_unparse_name_ext(context, principal, name, size) { register char *cp, *q; register int i,j; - int length, nelem; + int length; + krb5_int32 nelem; register int totalsize = 0; cp = krb5_princ_realm(context, principal)->data; @@ -77,7 +78,7 @@ krb5_unparse_name_ext(context, principal, name, size) totalsize++; /* This is for the separator */ nelem = krb5_princ_size(context, principal); - for (i = 0; i < nelem; i++) { + for (i = 0; i < (int) nelem; i++) { cp = krb5_princ_component(context, principal, i)->data; length = krb5_princ_component(context, principal, i)->length; totalsize += length; @@ -112,7 +113,7 @@ krb5_unparse_name_ext(context, principal, name, size) q = *name; - for (i = 0; i < nelem; i++) { + for (i = 0; i < (int) nelem; i++) { cp = krb5_princ_component(context, principal, i)->data; length = krb5_princ_component(context, principal, i)->length; for (j=0; j < length; j++,cp++) {