(print_cred_verbose): print IPv4-address in a portable way.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4688 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -148,9 +148,17 @@ print_cred_verbose(krb5_context context, krb5_creds *cred)
|
|||||||
for(j = 0; j < cred->addresses.len; j++){
|
for(j = 0; j < cred->addresses.len; j++){
|
||||||
if(j) printf(", ");
|
if(j) printf(", ");
|
||||||
switch(cred->addresses.val[j].addr_type){
|
switch(cred->addresses.val[j].addr_type){
|
||||||
case KRB5_ADDRESS_INET :
|
case KRB5_ADDRESS_INET : {
|
||||||
printf("IPv4: %s", inet_ntoa(*(struct in_addr*)cred->addresses.val[j].address.data));
|
struct in_addr a;
|
||||||
|
unsigned long foo;
|
||||||
|
|
||||||
|
k_get_int (cred->addresses.val[j].address.data,
|
||||||
|
&foo, 4);
|
||||||
|
a.s_addr = foo;
|
||||||
|
|
||||||
|
printf("IPv4: %s", inet_ntoa(a));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
#if defined(AF_INET6) && defined(HAVE_INET_NTOP) && defined(INET6_ADDRSTRLEN)
|
#if defined(AF_INET6) && defined(HAVE_INET_NTOP) && defined(INET6_ADDRSTRLEN)
|
||||||
case KRB5_ADDRESS_INET6: {
|
case KRB5_ADDRESS_INET6: {
|
||||||
char foo[INET6_ADDRSTRLEN];
|
char foo[INET6_ADDRSTRLEN];
|
||||||
|
Reference in New Issue
Block a user