diff libfdproto/ostr.c @ 1561:699c3fb0c57b

Switch from libidn to libidn2. libidn2 is the backwards compatible successor to libidn, and at least Red Hat 8 does not provide a dev package for libidn1.
author Thomas Klausner <wiz@gatalith.at>
date Wed, 16 Jun 2021 18:44:45 +0200
parents 1af09cc156d6
children
line wrap: on
line diff
--- a/libfdproto/ostr.c	Wed Jun 16 18:05:27 2021 +0200
+++ b/libfdproto/ostr.c	Wed Jun 16 18:44:45 2021 +0200
@@ -36,8 +36,8 @@
 #include "fdproto-internal.h"
 
 #if (!defined(DIAMID_IDNA_IGNORE) && !defined(DIAMID_IDNA_REJECT))
-/* Process IDNA with stringprep -- See RFC5890 -- and libidn documentation... */
-#include <idna.h> /* idna_to_ascii_8z() */
+/* Process IDNA with stringprep -- See RFC5890 -- and libidn2 documentation... */
+#include <idn2.h> /* idn2_to_ascii_8z() */
 #endif /* !defined(DIAMID_IDNA_IGNORE) && !defined(DIAMID_IDNA_REJECT) */
 
 /* Similar to strdup with (must have been verified) os0_t */
@@ -226,8 +226,8 @@
 			}
 		}
 		
-		ret = idna_to_ascii_8z ( *id, &processed, IDNA_USE_STD3_ASCII_RULES );
-		if (ret == IDNA_SUCCESS) {
+		ret = idn2_to_ascii_8z ( *id, &processed, IDNA_USE_STD3_ASCII_RULES );
+		if (ret == IDN2_OK) {
 			TRACE_DEBUG(INFO, "The string '%s' is not a valid DiameterIdentity, it was changed to '%s'", *id, processed);
 			if (memory == 0)
 				free(*id);
@@ -235,7 +235,7 @@
 			*inoutsz = strlen(processed);
 			/* Done! */
 		} else {
-			TRACE_DEBUG(INFO, "The string '%s' is not a valid DiameterIdentity and cannot be sanitanized: %s", *id, idna_strerror (ret));
+			TRACE_DEBUG(INFO, "The string '%s' is not a valid DiameterIdentity and cannot be sanitized: %s", *id, idn2_strerror (ret));
 			return EINVAL;
 		}
 	
"Welcome to our mercurial repository"