Add the kernel support function allocsysid().
[dragonfly/vkernel-mp.git] / contrib / opie / opie.h
blob8f5920ef3a74ca39fbc0ec5d3eb17cb84fb202bd
1 /* opie.h: Data structures and values for the OPIE authentication
2 system that a program might need.
4 %%% portions-copyright-cmetz-96
5 Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
6 Reserved. The Inner Net License Version 2 applies to these portions of
7 the software.
8 You should have received a copy of the license with this software. If
9 you didn't get a copy, you may request one from <license@inner.net>.
11 Portions of this software are Copyright 1995 by Randall Atkinson and Dan
12 McDonald, All Rights Reserved. All Rights under this copyright are assigned
13 to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
14 License Agreement applies to this software.
16 History:
18 Modified by cmetz for OPIE 2.4. Added sequence number limits. Added
19 struct opie_otpkey and made many functions use it. Added
20 opiestrncpy(). Include header with libmissing prototypes.
21 Modified by cmetz for OPIE 2.32. Added symbolic flag names for
22 opiepasswd(). Added __opieparsechallenge() prototype.
23 Modified by cmetz for OPIE 2.31. Removed active attack protection.
24 Modified by cmetz for OPIE 2.3. Renamed PTR to VOIDPTR. Added
25 re-init key and extension file fields to struct opie. Added
26 opie_ prefix on struct opie members. Added opie_flags field
27 and definitions. Added more prototypes. Changed opiehash()
28 prototype.
29 Modified by cmetz for OPIE 2.22. Define __P correctly if this file
30 is included in a third-party program.
31 Modified by cmetz for OPIE 2.2. Re-did prototypes. Added FUNCTION
32 definition et al. Multiple-include protection. Added struct
33 utsname fake. Got rid of gethostname() cruft. Moved UINT4
34 here. Provide for *seek whence values. Move MDx context here
35 and unify. Re-did prototypes.
36 Modified at NRL for OPIE 2.0.
37 Written at Bellcore for the S/Key Version 1 software distribution
38 (skey.h).
40 $FreeBSD: src/contrib/opie/opie.h,v 1.4.6.4 2002/07/15 14:48:43 des Exp $
41 $DragonFly: src/contrib/opie/opie.h,v 1.2 2003/06/17 06:24:04 dillon Exp $
43 #ifndef _OPIE_H
44 #define _OPIE_H 1
46 struct opie {
47 int opie_flags;
48 char opie_buf[256];
49 char *opie_principal;
50 int opie_n;
51 char *opie_seed;
52 char *opie_val;
53 long opie_recstart;
56 #define __OPIE_FLAGS_RW 1
57 #define __OPIE_FLAGS_READ 2
59 /* Minimum length of a secret password */
60 #ifndef OPIE_SECRET_MIN
61 #define OPIE_SECRET_MIN 10
62 #endif /* OPIE_SECRET_MIN */
64 /* Maximum length of a secret password */
65 #define OPIE_SECRET_MAX 127
67 /* Minimum length of a seed */
68 #define OPIE_SEED_MIN 5
70 /* Maximum length of a seed */
71 #define OPIE_SEED_MAX 16
73 /* Max length of hash algorithm name (md4/md5) */
74 #define OPIE_HASHNAME_MAX 3
76 /* Maximum length of a challenge (otp-md? 9999 seed) */
77 #define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX)
79 /* Maximum length of a response that we allow */
80 #define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19)
82 /* Maximum length of a principal (read: user name) */
83 #define OPIE_PRINCIPAL_MAX 32
85 /* Maximum sequence number */
86 #ifndef OPIE_SEQUENCE_MAX
87 #define OPIE_SEQUENCE_MAX 9999
88 #endif /* OPIE_SEQUENCE_MAX */
90 /* Restricted sequence number */
91 #ifndef OPIE_SEQUENCE_RESTRICT
92 #define OPIE_SEQUENCE_RESTRICT 9
93 #endif /* OPIE_SEQUENCE_RESTRICT */
95 #define UINT4 u_int32_t
97 struct opie_otpkey {
98 UINT4 words[2];
101 #ifndef SEEK_SET
102 #define SEEK_SET 0
103 #endif /* SEEK_SET */
105 #ifndef SEEK_END
106 #define SEEK_END 2
107 #endif /* SEEK_END */
109 __BEGIN_DECLS
110 int opieaccessfile __P((char *));
111 int rdnets __P((long));
112 int isaddr __P((register char *));
113 int opiealways __P((char *));
114 char *opieatob8 __P((struct opie_otpkey *, char *));
115 void opiebackspace __P((char *));
116 char *opiebtoa8 __P((char *, struct opie_otpkey *));
117 char *opiebtoe __P((char *, struct opie_otpkey *));
118 char *opiebtoh __P((char *, struct opie_otpkey *));
119 int opieetob __P((struct opie_otpkey *, char *));
120 int opiechallenge __P((struct opie *,char *,char *));
121 int opiegenerator __P((char *,char *,char *));
122 int opiegetsequence __P((struct opie *));
123 void opiehash __P((struct opie_otpkey *, unsigned));
124 int opiehtoi __P((register char));
125 int opiekeycrunch __P((int, struct opie_otpkey *, char *, char *));
126 int opielock __P((char *));
127 int opieunlock __P((void));
128 void opieunlockaeh __P((void));
129 void opiedisableaeh __P((void));
130 int opielookup __P((struct opie *,char *));
131 int opiepasscheck __P((char *));
132 void opierandomchallenge __P((char *));
133 char * opieskipspace __P((register char *));
134 void opiestripcrlf __P((char *));
135 int opieverify __P((struct opie *,char *));
136 int opiepasswd __P((struct opie *, int, char *, int, char *, char *));
137 char *opiereadpass __P((char *, int, int));
138 int opielogin __P((char *line, char *name, char *host));
139 const char *opie_get_algorithm __P((void));
140 int opie_haskey __P((char *username));
141 char *opie_keyinfo __P((char *));
142 int opie_passverify __P((char *username, char *passwd));
143 __END_DECLS
145 #if _OPIE
146 #define VOIDPTR void *
147 #define VOIDRET void
148 #define NOARGS void
149 #define FUNCTION(arglist, args) (args)
150 #define AND ,
151 #define FUNCTION_NOARGS ()
153 __BEGIN_DECLS
154 struct utmp;
155 int __opiegetutmpentry __P((char *, struct utmp *));
156 #ifdef EOF
157 FILE *__opieopen __P((char *, int, int));
158 #endif /* EOF */
159 int __opiereadrec __P((struct opie *));
160 int __opiewriterec __P((struct opie *));
161 int __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));
162 __END_DECLS
164 #define opiestrncpy(dst, src, n) \
165 do { \
166 strncpy(dst, src, n-1); \
167 dst[n-1] = 0; \
168 } while(0)
170 /* #include "missing.h" */
171 #endif /* _OPIE */
173 #define OPIEPASSWD_CONSOLE 1
174 #define OPIEPASSWD_FORCE 2
176 #endif /* _OPIE_H */