summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/bind/nameser/ns_samedomain.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind9/lib/bind/nameser/ns_samedomain.c')
-rw-r--r--contrib/bind9/lib/bind/nameser/ns_samedomain.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/contrib/bind9/lib/bind/nameser/ns_samedomain.c b/contrib/bind9/lib/bind/nameser/ns_samedomain.c
index d4ca550..a720f6a 100644
--- a/contrib/bind9/lib/bind/nameser/ns_samedomain.c
+++ b/contrib/bind9/lib/bind/nameser/ns_samedomain.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34:17 marka Exp $";
+static const char rcsid[] = "$Id: ns_samedomain.c,v 1.5.18.1 2005/04/27 05:01:09 sra Exp $";
#endif
#include "port_before.h"
@@ -28,21 +28,22 @@ static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34
#include "port_after.h"
-/*
- * int
- * ns_samedomain(a, b)
+/*%
* Check whether a name belongs to a domain.
+ *
* Inputs:
- * a - the domain whose ancestory is being verified
- * b - the potential ancestor we're checking against
+ *\li a - the domain whose ancestory is being verified
+ *\li b - the potential ancestor we're checking against
+ *
* Return:
- * boolean - is a at or below b?
+ *\li boolean - is a at or below b?
+ *
* Notes:
- * Trailing dots are first removed from name and domain.
+ *\li Trailing dots are first removed from name and domain.
* Always compare complete subdomains, not only whether the
* domain name is the trailing string of the given name.
*
- * "host.foobar.top" lies in "foobar.top" and in "top" and in ""
+ *\li "host.foobar.top" lies in "foobar.top" and in "top" and in ""
* but NOT in "bar.top"
*/
@@ -140,9 +141,7 @@ ns_samedomain(const char *a, const char *b) {
return (strncasecmp(cp, b, lb) == 0);
}
-/*
- * int
- * ns_subdomain(a, b)
+/*%
* is "a" a subdomain of "b"?
*/
int
@@ -150,30 +149,31 @@ ns_subdomain(const char *a, const char *b) {
return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
}
-/*
- * int
- * ns_makecanon(src, dst, dstsize)
+/*%
* make a canonical copy of domain name "src"
+ *
* notes:
+ * \code
* foo -> foo.
* foo. -> foo.
* foo.. -> foo.
* foo\. -> foo\..
* foo\\. -> foo\\.
+ * \endcode
*/
int
ns_makecanon(const char *src, char *dst, size_t dstsize) {
size_t n = strlen(src);
- if (n + sizeof "." > dstsize) { /* Note: sizeof == 2 */
+ if (n + sizeof "." > dstsize) { /*%< Note: sizeof == 2 */
errno = EMSGSIZE;
return (-1);
}
strcpy(dst, src);
- while (n >= 1U && dst[n - 1] == '.') /* Ends in "." */
- if (n >= 2U && dst[n - 2] == '\\' && /* Ends in "\." */
- (n < 3U || dst[n - 3] != '\\')) /* But not "\\." */
+ while (n >= 1U && dst[n - 1] == '.') /*%< Ends in "." */
+ if (n >= 2U && dst[n - 2] == '\\' && /*%< Ends in "\." */
+ (n < 3U || dst[n - 3] != '\\')) /*%< But not "\\." */
break;
else
dst[--n] = '\0';
@@ -182,14 +182,13 @@ ns_makecanon(const char *src, char *dst, size_t dstsize) {
return (0);
}
-/*
- * int
- * ns_samename(a, b)
+/*%
* determine whether domain name "a" is the same as domain name "b"
+ *
* return:
- * -1 on error
- * 0 if names differ
- * 1 if names are the same
+ *\li -1 on error
+ *\li 0 if names differ
+ *\li 1 if names are the same
*/
int
@@ -204,3 +203,5 @@ ns_samename(const char *a, const char *b) {
else
return (0);
}
+
+/*! \file */
OpenPOWER on IntegriCloud