aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2022-03-23 22:47:26 -0800
committerDavid M. Syzdek <david@syzdek.net>2022-03-23 22:47:26 -0800
commite5f4160abac6c03d67eda46b2096e0c95f04b2e1 (patch)
treeeb768195a22c039f01fc92abe6195652fd3c037d
parent93b7274344ee2c0d6cbf867869c5129e8a521583 (diff)
downloadtinyrad-e5f4160abac6c03d67eda46b2096e0c95f04b2e1.tar.gz
tinyrad-e5f4160abac6c03d67eda46b2096e0c95f04b2e1.tar.bz2
tinyrad-e5f4160abac6c03d67eda46b2096e0c95f04b2e1.tar.xz
tinyrad-e5f4160abac6c03d67eda46b2096e0c95f04b2e1.zip
libtinyrad: updating how tinyrad_urldesc_resolve() handles unresolved URLs
-rw-r--r--lib/libtinyrad/lurl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libtinyrad/lurl.c b/lib/libtinyrad/lurl.c
index 501c815..6447e67 100644
--- a/lib/libtinyrad/lurl.c
+++ b/lib/libtinyrad/lurl.c
@@ -538,6 +538,7 @@ tinyrad_urldesc_resolve(
538 size_t pos; 538 size_t pos;
539 int ai_family; 539 int ai_family;
540 int ai_flags; 540 int ai_flags;
541 int resolved;
541 size_t size; 542 size_t size;
542 struct addrinfo hints; 543 struct addrinfo hints;
543 struct addrinfo * hintsp; 544 struct addrinfo * hintsp;
@@ -589,7 +590,10 @@ tinyrad_urldesc_resolve(
589 break; 590 break;
590 }; 591 };
591 592
592 while ((trudp)) 593 resolved = TRAD_NO;
594
595 // loop through URL descriptors
596 for(; ((trudp)); trudp = trudp->trud_next)
593 { 597 {
594 TinyRadDebug(TRAD_DEBUG_ARGS, " => %s members", "trudp"); 598 TinyRadDebug(TRAD_DEBUG_ARGS, " => %s members", "trudp");
595 TinyRadDebug(TRAD_DEBUG_ARGS, " => trudp->trud_host: %s", trudp->trud_host); 599 TinyRadDebug(TRAD_DEBUG_ARGS, " => trudp->trud_host: %s", trudp->trud_host);
@@ -605,7 +609,8 @@ tinyrad_urldesc_resolve(
605 hintsp = &hints; 609 hintsp = &hints;
606 610
607 if (getaddrinfo(trudp->trud_host, NULL, hintsp, &res) != 0) 611 if (getaddrinfo(trudp->trud_host, NULL, hintsp, &res) != 0)
608 return(TRAD_ERESOLVE); 612 continue;
613 resolved = TRAD_YES;
609 614
610 // initialize memory 615 // initialize memory
611 sas_len = ((trudp->trud_sockaddrs_len)) ? trudp->trud_sockaddrs_len : 0; 616 sas_len = ((trudp->trud_sockaddrs_len)) ? trudp->trud_sockaddrs_len : 0;
@@ -664,10 +669,11 @@ tinyrad_urldesc_resolve(
664 }; 669 };
665 670
666 freeaddrinfo(res); 671 freeaddrinfo(res);
667
668 trudp = trudp->trud_next;
669 }; 672 };
670 673
674 if (resolved == TRAD_NO)
675 return(TRAD_ERESOLVE);
676
671 return(TRAD_SUCCESS); 677 return(TRAD_SUCCESS);
672} 678}
673 679