From: Ezra Peisach Date: Tue, 17 Oct 2000 23:01:33 +0000 (+0000) Subject: * changepw.c: Cast length argument to recvfrom/sendto to int X-Git-Tag: krb5-1.3-alpha1~1820 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b96606c107b3021f71c0f97062a2f317e19c1286;p=krb5.git * changepw.c: Cast length argument to recvfrom/sendto to int * os-proto.h: Moved extern definition of krb5_max_dgram_size, krb5_max_skdc_timeout, krb5_skdc_timeout_shift, krb5_skdc_timeout_1 here. * accessor.c: Definition for krb5_max_dgram_size, krb5_max_skdc_timeout, krb5_skdc_timeout_shift, krb5_skdc_timeout_1 moved to os-proto.h * osconfig.c: Changed definition for krb5_max_dgram_size, krb5_max_skdc_timeout, krb5_skdc_timeout_shift, krb5_skdc_timeout_1 to unsigned int. * get_krbhst.c, init_os_context.c, locate_kdc.c, prompter.c: Unsigned/signed int cleanup. * read_pwd.c (krb5_read_password): Change size_return to unsigned int *. * sendto_kdc.c: Remove definition for krb5_max_dgram_size, krb5_max_skdc_timeout, krb5_skdc_timeout_shift, krb5_skdc_timeout_1. (moved to os-proto.h). Cast arguments to int for send() and recv(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12783 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 6a337cc8f..1f8104d8b 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,31 @@ +2000-10-17 Ezra Peisach + + * changepw.c: Cast length argument to recvfrom/sendto to int. + + * os-proto.h: Moved extern definition of krb5_max_dgram_size, + krb5_max_skdc_timeout, krb5_skdc_timeout_shift, + krb5_skdc_timeout_1 here. + + * accessor.c: Definition for krb5_max_dgram_size, + krb5_max_skdc_timeout, krb5_skdc_timeout_shift, + krb5_skdc_timeout_1 moved to os-proto.h + + * osconfig.c: Changed definition for krb5_max_dgram_size, + krb5_max_skdc_timeout, krb5_skdc_timeout_shift, + krb5_skdc_timeout_1 to unsigned int. + + * get_krbhst.c, init_os_context.c, locate_kdc.c, prompter.c: + Unsigned/signed int cleanup. + + * read_pwd.c (krb5_read_password): Change size_return to unsigned + int *. + + * sendto_kdc.c: Remove definition for krb5_max_dgram_size, + krb5_max_skdc_timeout, krb5_skdc_timeout_shift, + krb5_skdc_timeout_1. (moved to os-proto.h). Cast arguments to int + for send() and recv(). + + 2000-10-09 Ken Raeburn Support for getifaddrs() interface added in BSD. diff --git a/src/lib/krb5/os/accessor.c b/src/lib/krb5/os/accessor.c index b62e7d2a4..d0d0dc21d 100644 --- a/src/lib/krb5/os/accessor.c +++ b/src/lib/krb5/os/accessor.c @@ -29,11 +29,6 @@ #include "k5-int.h" #include "os-proto.h" -extern int krb5_max_skdc_timeout; -extern int krb5_skdc_timeout_shift; -extern int krb5_skdc_timeout_1; -extern int krb5_max_dgram_size; - KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5int_accessor(internals, version) krb5int_access* internals; diff --git a/src/lib/krb5/os/changepw.c b/src/lib/krb5/os/changepw.c index 86df506f5..3d3ea25a7 100644 --- a/src/lib/krb5/os/changepw.c +++ b/src/lib/krb5/os/changepw.c @@ -271,7 +271,7 @@ krb5_change_password(context, creds, newpw, result_code, goto cleanup; } - if ((cc = sendto(s1, chpw_req.data, chpw_req.length, 0, + if ((cc = sendto(s1, chpw_req.data, (int) chpw_req.length, 0, (struct sockaddr *) &addr_p[i], sizeof(addr_p[i]))) != chpw_req.length) { @@ -312,7 +312,8 @@ krb5_change_password(context, creds, newpw, result_code, SunOS 4.1.4 or Irix 5.3. Thus we must actually accept the value and discard it. */ tmp_len = sizeof(tmp_addr); - if ((cc = recvfrom(s1, chpw_rep.data, chpw_rep.length, 0, &tmp_addr, &tmp_len)) < 0) + if ((cc = recvfrom(s1, chpw_rep.data, (int) chpw_rep.length, + 0, &tmp_addr, &tmp_len)) < 0) { code = SOCKET_ERRNO; goto cleanup; diff --git a/src/lib/krb5/os/get_krbhst.c b/src/lib/krb5/os/get_krbhst.c index 1b42943a3..75f4c56af 100644 --- a/src/lib/krb5/os/get_krbhst.c +++ b/src/lib/krb5/os/get_krbhst.c @@ -109,7 +109,7 @@ krb5_get_krbhst(context, realm, hostlist) goto cleanup; } for (i = 0; i < count; i++) { - int len = strlen (values[i]) + 1; + unsigned int len = strlen (values[i]) + 1; rethosts[i] = malloc(len); if (!rethosts[i]) { retval = ENOMEM; diff --git a/src/lib/krb5/os/init_os_ctx.c b/src/lib/krb5/os/init_os_ctx.c index f59969714..4168dfe46 100644 --- a/src/lib/krb5/os/init_os_ctx.c +++ b/src/lib/krb5/os/init_os_ctx.c @@ -326,7 +326,7 @@ os_get_default_config_files(pfiles, secure) #else /* !_MSDOS && !_WIN32 */ char* filepath = 0; int n_entries, i; - int ent_len; + unsigned int ent_len; const char *s, *t; if (!secure) filepath = getenv("KRB5_CONFIG"); diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c index bae1523a4..91e12b19d 100644 --- a/src/lib/krb5/os/locate_kdc.c +++ b/src/lib/krb5/os/locate_kdc.c @@ -386,7 +386,7 @@ krb5_locate_srv_dns(realm, service, protocol, addr_pp, naddrs) if ( strlen(service) + strlen(protocol) + realm->length + 6 > MAX_DNS_NAMELEN ) goto out; - sprintf(host, "%s.%s.%.*s", service, protocol, realm->length, + sprintf(host, "%s.%s.%.*s", service, protocol, (int) realm->length, realm->data); /* Realm names don't (normally) end with ".", but if the query diff --git a/src/lib/krb5/os/os-proto.h b/src/lib/krb5/os/os-proto.h index 111bf5897..37782df7d 100644 --- a/src/lib/krb5/os/os-proto.h +++ b/src/lib/krb5/os/os-proto.h @@ -59,5 +59,10 @@ int _krb5_use_dns_realm KRB5_PROTOTYPE((krb5_context)); int _krb5_use_dns_kdc KRB5_PROTOTYPE((krb5_context)); int _krb5_conf_boolean KRB5_PROTOTYPE((const char *)); +extern unsigned int krb5_max_skdc_timeout; +extern unsigned int krb5_skdc_timeout_shift; +extern unsigned int krb5_skdc_timeout_1; +extern unsigned int krb5_max_dgram_size; + #endif /* KRB5_LIBOS_INT_PROTO__ */ diff --git a/src/lib/krb5/os/osconfig.c b/src/lib/krb5/os/osconfig.c index 2ae48009c..dec5cac77 100644 --- a/src/lib/krb5/os/osconfig.c +++ b/src/lib/krb5/os/osconfig.c @@ -36,10 +36,10 @@ char *krb5_defkeyname = DEFAULT_KEYTAB_NAME; -int krb5_max_dgram_size = MAX_DGRAM_SIZE; -int krb5_max_skdc_timeout = MAX_SKDC_TIMEOUT; -int krb5_skdc_timeout_shift = SKDC_TIMEOUT_SHIFT; -int krb5_skdc_timeout_1 = SKDC_TIMEOUT_1; +unsigned int krb5_max_dgram_size = MAX_DGRAM_SIZE; +unsigned int krb5_max_skdc_timeout = MAX_SKDC_TIMEOUT; +unsigned int krb5_skdc_timeout_shift = SKDC_TIMEOUT_SHIFT; +unsigned int krb5_skdc_timeout_1 = SKDC_TIMEOUT_1; char *krb5_default_pwd_prompt1 = DEFAULT_PWD_STRING1; char *krb5_default_pwd_prompt2 = DEFAULT_PWD_STRING2; diff --git a/src/lib/krb5/os/prompter.c b/src/lib/krb5/os/prompter.c index 985ed6e45..d61c0b582 100644 --- a/src/lib/krb5/os/prompter.c +++ b/src/lib/krb5/os/prompter.c @@ -84,7 +84,7 @@ krb5_prompter_posix(krb5_context context, (void) fflush(stdout); (void) memset(prompts[i].reply->data, 0, prompts[i].reply->length); - if (fgets(prompts[i].reply->data, prompts[i].reply->length, stdin) + if (fgets(prompts[i].reply->data, (int) prompts[i].reply->length, stdin) == NULL) { if (prompts[i].hidden) (void) putchar('\n'); diff --git a/src/lib/krb5/os/read_pwd.c b/src/lib/krb5/os/read_pwd.c index 4adee3dc4..776ae857e 100644 --- a/src/lib/krb5/os/read_pwd.c +++ b/src/lib/krb5/os/read_pwd.c @@ -56,7 +56,7 @@ krb5_read_password(context, prompt, prompt2, return_pwd, size_return) const char *prompt; const char *prompt2; char *return_pwd; - int *size_return; + unsigned int *size_return; { /* adapted from Kerberos v4 des/read_password.c */ /* readin_string is used after a longjmp, so must be volatile */ @@ -94,7 +94,7 @@ krb5_read_password(context, prompt, prompt2, return_pwd, size_return) (void) fflush(stdout); (void) memset(return_pwd, 0, *size_return); - if (fgets(return_pwd, *size_return, stdin) == NULL) { + if (fgets(return_pwd, (int) *size_return, stdin) == NULL) { (void) putchar('\n'); errcode = KRB5_LIBOS_CANTREADPWD; goto cleanup; @@ -120,7 +120,7 @@ krb5_read_password(context, prompt, prompt2, return_pwd, size_return) goto cleanup; } (void) memset((char *)readin_string, 0, *size_return); - if (fgets((char *)readin_string, *size_return, stdin) == NULL) { + if (fgets((char *)readin_string, (int) *size_return, stdin) == NULL) { (void) putchar('\n'); errcode = KRB5_LIBOS_CANTREADPWD; goto cleanup; diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c index 95c65ed30..58c97f837 100644 --- a/src/lib/krb5/os/sendto_kdc.c +++ b/src/lib/krb5/os/sendto_kdc.c @@ -54,11 +54,6 @@ * when finished. */ -extern int krb5_max_dgram_size; -extern int krb5_max_skdc_timeout; -extern int krb5_skdc_timeout_shift; -extern int krb5_skdc_timeout_1; - krb5_error_code krb5_sendto_kdc (context, message, realm, reply, use_master) krb5_context context; @@ -152,7 +147,8 @@ krb5_sendto_kdc (context, message, realm, reply, use_master) continue; } if (send(socklist[host], - message->data, message->length, 0) != message->length) + message->data, (int) message->length, 0) + != message->length) continue; retry: waitlen.tv_usec = 0; @@ -171,7 +167,8 @@ krb5_sendto_kdc (context, message, realm, reply, use_master) goto out; } if ((cc = recv(socklist[host], - reply->data, reply->length, 0)) == SOCKET_ERROR) + reply->data, (int) reply->length, + 0)) == SOCKET_ERROR) { /* man page says error could be: EBADF: won't happen