From dd1875d0a589e4a70736265f19ded2d2230b7913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 5 Jan 2004 15:17:25 +0000 Subject: [PATCH] (add_addrs): don't add same address multiple times git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13257 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/get_for_creds.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/krb5/get_for_creds.c b/lib/krb5/get_for_creds.c index 63c420835..2e11e59f9 100644 --- a/lib/krb5/get_for_creds.c +++ b/lib/krb5/get_for_creds.c @@ -62,9 +62,15 @@ add_addrs(krb5_context context, } i = addr->len; for (a = ai; a != NULL; a = a->ai_next) { - ret = krb5_sockaddr2address (context, a->ai_addr, &addr->val[i]); - if (ret == 0) - ++i; + krb5_address ad; + + ret = krb5_sockaddr2address (context, a->ai_addr, &ad); + if (ret == 0) { + if (krb5_address_search(context, &ad, addr)) + krb5_free_address(context, &ad); + else + addr->val[i++] = ad; + } else if (ret == KRB5_PROG_ATYPE_NOSUPP) krb5_clear_error_string (context); else