xref: /freebsd-13-stable/contrib/opie/libopie/lookup.c (revision 3b8f08459569bf0faa21473e5cec2491e95c9349)
1 /* lookup.c: The opielookup() library function.
2 
3 %%% copyright-cmetz-96
4 This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
5 The Inner Net License Version 3 applies to this software.
6 You should have received a copy of the license with this software. If
7 you didn't get a copy, you may request one from <license@inner.net>.
8 
9         History:
10 
11         Created by cmetz for OPIE 2.3 (re-write).
12 */
13 
14 #include "opie_cfg.h"
15 #include <stdio.h>
16 #include <string.h>
17 #include "opie.h"
18 
19 int opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal)
20 {
21   int i;
22 
23   memset(opie, 0, sizeof(struct opie));
24   opie->opie_principal = principal;
25 
26   if (i = __opiereadrec(opie))
27     return i;
28 
29   return (opie->opie_flags & __OPIE_FLAGS_RW) ? 0 : 2;
30 }
31 
32