From: Ezra Peisach Date: Tue, 31 Jul 2001 08:52:36 +0000 (+0000) Subject: * genaddrs.c: Use GETPEERNAME_ARG2_TYPE, GETPEERNAME_ARG3_TYPE X-Git-Tag: krb5-1.3-alpha1~1152 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c523dd38687ccd572694408b3e443abac8367b35;p=krb5.git * genaddrs.c: Use GETPEERNAME_ARG2_TYPE, GETPEERNAME_ARG3_TYPE instead of assuming types. * changepw.c: Use GETSOCKNAME_ARG3_TYPE instead of int in casts. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13659 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 6ee887bbd..8bd702339 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,10 @@ +2001-07-31 Ezra Peisach + + * genaddrs.c: Use GETPEERNAME_ARG2_TYPE, GETPEERNAME_ARG3_TYPE + instead of assuming types. + + * changepw.c: Use GETSOCKNAME_ARG3_TYPE instead of int in casts. + 2001-07-26 Ezra Peisach * gen_port.c (krb5_gen_portaddr): Add const to cast of diff --git a/src/lib/krb5/os/changepw.c b/src/lib/krb5/os/changepw.c index 7153b75ec..867278440 100644 --- a/src/lib/krb5/os/changepw.c +++ b/src/lib/krb5/os/changepw.c @@ -49,6 +49,10 @@ #endif #endif /* _WIN32 && !__CYGWIN32__ */ +#ifndef GETSOCKNAME_ARG3_TYPE +#define GETSOCKNAME_ARG3_TYPE int +#endif + /* * Wrapper function for the two backends */ @@ -96,9 +100,12 @@ krb5_change_password(context, creds, newpw, result_code, krb5_address local_kaddr, remote_kaddr; char *code_string; krb5_error_code code = 0; - int i, addrlen; + int i; + GETSOCKNAME_ARG3_TYPE addrlen; struct sockaddr_storage local_addr, remote_addr, tmp_addr; - int cc, local_result_code, tmp_len; + int cc, local_result_code; + /* platforms seem to be consistant and use the same types */ + GETSOCKNAME_ARG3_TYPE tmp_len; SOCKET s1 = INVALID_SOCKET, s2 = INVALID_SOCKET; int tried_one = 0; struct addrlist al = ADDRLIST_INIT; @@ -245,7 +252,8 @@ krb5_change_password(context, creds, newpw, result_code, goto cleanup; } - if ((cc = sendto(s1, chpw_req.data, (int) chpw_req.length, 0, + if ((cc = sendto(s1, chpw_req.data, + (GETSOCKNAME_ARG3_TYPE) chpw_req.length, 0, al.addrs[i], socklen(al.addrs[i]))) != chpw_req.length) { if ((cc < 0) && ((SOCKET_ERRNO == ECONNREFUSED) || @@ -285,7 +293,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, (int) chpw_rep.length, + if ((cc = recvfrom(s1, chpw_rep.data, + (GETSOCKNAME_ARG3_TYPE) chpw_rep.length, 0, ss2sa(&tmp_addr), &tmp_len)) < 0) { code = SOCKET_ERRNO; diff --git a/src/lib/krb5/os/genaddrs.c b/src/lib/krb5/os/genaddrs.c index 1ff6ec01b..3e9409904 100644 --- a/src/lib/krb5/os/genaddrs.c +++ b/src/lib/krb5/os/genaddrs.c @@ -35,6 +35,19 @@ #include #endif +#ifndef GETPEERNAME_ARG2_TYPE +#define GETPEERNAME_ARG2_TYPE struct sockaddr +#endif +#ifndef GETPEERNAME_ARG3_TYPE +#define GETPEERNAME_ARG3_TYPE size_t +#endif +#ifndef GETSOCKNAME_ARG2_TYPE +#define GETSOCKNAME_ARG2_TYPE struct sockaddr +#endif +#ifndef GETSOCKNAME_ARG3_TYPE +#define GETSOCKNAME_ARG3_TYPE size_t +#endif + KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_auth_con_genaddrs(context, auth_context, infd, flags) krb5_context context; @@ -53,12 +66,13 @@ krb5_auth_con_genaddrs(context, auth_context, infd, flags) struct sockaddr_in lsaddr, rsaddr; krb5_address lcaddr, rcaddr; krb5_address lcport, rcport; - int ssize; + GETSOCKNAME_ARG3_TYPE ssize; ssize = sizeof(struct sockaddr); if ((flags & KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR) || (flags & KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR)) { - if ((retval = getsockname(fd, (struct sockaddr *) &lsaddr, &ssize))) + if ((retval = getsockname(fd, (GETSOCKNAME_ARG2_TYPE *) &lsaddr, + &ssize))) return retval; if (flags & KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR) { @@ -80,7 +94,8 @@ krb5_auth_con_genaddrs(context, auth_context, infd, flags) if ((flags & KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR) || (flags & KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR)) { - if ((retval = getpeername(fd, (struct sockaddr *) &rsaddr, &ssize))) + if ((retval = getpeername(fd, (GETPEERNAME_ARG2_TYPE *) &rsaddr, + &ssize))) return retval; if (flags & KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR) {