From: John Kohl Date: Fri, 9 Mar 1990 10:57:00 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: krb5-1.0-alpha2~1007 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4fea0525a661d98020910411e0abcbafbc6f01cf;p=krb5.git *** empty log message *** git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@377 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/addr_comp.c b/src/lib/krb5/krb/addr_comp.c new file mode 100644 index 000000000..9777e475a --- /dev/null +++ b/src/lib/krb5/krb/addr_comp.c @@ -0,0 +1,38 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * krb5_address_compare() + */ + +#if !defined(lint) && !defined(SABER) +static char addr_comp_c[] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include +#include +#include + +/* + * 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 index 000000000..fedb3fa0b --- /dev/null +++ b/src/lib/krb5/krb/addr_srch.c @@ -0,0 +1,37 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * krb5_address_search() + */ + +#if !defined(lint) && !defined(SABER) +static char addr_srch_c[] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include +#include + +/* + * 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; +}