2007-11-29 [colin] 3.1.0cvs45

* src/common/ssl_certificate.c
		Use the more modern getaddrinfo instead of
		gethostbyname when possible
This commit is contained in:
Colin Leroy 2007-11-29 18:25:42 +00:00
parent 8916ee9239
commit e44b285b53
4 changed files with 39 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2007-11-29 [colin] 3.1.0cvs45
* src/common/ssl_certificate.c
Use the more modern getaddrinfo instead of
gethostbyname when possible
2007-11-28 [colin] 3.1.0cvs44
* src/summaryview.c

View file

@ -3102,3 +3102,4 @@
( cvs diff -u -r 1.207.2.188 -r 1.207.2.189 src/folderview.c; ) > 3.1.0cvs42.patchset
( cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/prefs_summary_open.c; ) > 3.1.0cvs43.patchset
( cvs diff -u -r 1.395.2.342 -r 1.395.2.343 src/summaryview.c; ) > 3.1.0cvs44.patchset
( cvs diff -u -r 1.4.2.23 -r 1.4.2.24 src/common/ssl_certificate.c; ) > 3.1.0cvs45.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=1
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=44
EXTRA_VERSION=45
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -118,16 +118,47 @@ time_t asn1toTime(ASN1_TIME *asn1Time)
static char * get_fqdn(char *host)
{
#ifdef INET6
gint gai_err;
struct addrinfo hints, *res;
#else
struct hostent *hp;
#endif
if (host == NULL || strlen(host) == 0)
return g_strdup("");
#ifdef INET6
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
gai_err = getaddrinfo(host, NULL, &hints, &res);
if (gai_err != 0) {
g_warning("getaddrinfo for %s failed: %s\n",
host, gai_strerror(gai_err));
return g_strdup(host);
}
if (res != NULL) {
if (res->ai_canonname && strlen(res->ai_canonname)) {
gchar *fqdn = g_strdup(res->ai_canonname);
freeaddrinfo(res);
return fqdn;
} else {
freeaddrinfo(res);
return g_strdup(host);
}
} else {
return g_strdup(host);
}
#else
hp = my_gethostbyname(host);
if (hp == NULL)
return g_strdup(host); /*caller should free*/
else
return g_strdup(hp->h_name);
#endif
}
char * readable_fingerprint(unsigned char *src, int len)