*** empty log message ***
authorJohn Kohl <jtkohl@mit.edu>
Fri, 9 Mar 1990 10:57:00 +0000 (10:57 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Fri, 9 Mar 1990 10:57:00 +0000 (10:57 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@377 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/addr_comp.c [new file with mode: 0644]
src/lib/krb5/krb/addr_srch.c [new file with mode: 0644]

diff --git a/src/lib/krb5/krb/addr_comp.c b/src/lib/krb5/krb/addr_comp.c
new file mode 100644 (file)
index 0000000..9777e47
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/mit-copyright.h>.
+ *
+ * krb5_address_compare()
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char addr_comp_c[] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+#include <krb5/ext-proto.h>
+
+/*
+ * If the two addresses are the same, return TRUE, else return FALSE
+ */
+krb5_boolean
+krb5_address_compare(addr1, addr2)
+krb5_address *addr1, *addr2;
+{
+    if (addr1->addrtype != addr2->addrtype)
+       return(FALSE);
+
+    if (addr1->length != addr2->length)
+       return(FALSE);
+    if (bcmp((char *)addr1->contents, (char *)addr2->contents, addr1->length))
+       return FALSE;
+    else
+       return TRUE;
+}
diff --git a/src/lib/krb5/krb/addr_srch.c b/src/lib/krb5/krb/addr_srch.c
new file mode 100644 (file)
index 0000000..fedb3fa
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/mit-copyright.h>.
+ *
+ * krb5_address_search()
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char addr_srch_c[] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*
+ * if addr is listed in addrlist, or addrlist is null, return TRUE.
+ * if not listed, return FALSE
+ */
+krb5_boolean
+krb5_address_search(addr, addrlist)
+krb5_address *addr;
+krb5_address **addrlist;
+{
+    if (!addrlist)
+       return TRUE;
+    for (; *addrlist; addrlist++) {
+       if (krb5_address_compare(addr, *addrlist))
+           return TRUE;
+    }
+    return FALSE;
+}