usched: Allow process to change self cpu affinity
[dragonfly.git] / contrib / opie / opie.h
blobda0f235931fb716a1b4fa9b5edd387c5e0b11c8b
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: head/contrib/opie/opie.h 269809 2014-08-11 13:36:02Z ache $
42 #ifndef _OPIE_H
43 #define _OPIE_H 1
45 struct opie {
46 int opie_flags;
47 char opie_buf[256];
48 char *opie_principal;
49 int opie_n;
50 char *opie_seed;
51 char *opie_val;
52 long opie_recstart;
55 #define __OPIE_FLAGS_RW 1
56 #define __OPIE_FLAGS_READ 2
58 /* Minimum length of a secret password */
59 #ifndef OPIE_SECRET_MIN
60 #define OPIE_SECRET_MIN 10
61 #endif /* OPIE_SECRET_MIN */
63 /* Maximum length of a secret password */
64 #define OPIE_SECRET_MAX 127
66 /* Minimum length of a seed */
67 #define OPIE_SEED_MIN 5
69 /* Maximum length of a seed */
70 #define OPIE_SEED_MAX 16
72 /* Max length of hash algorithm name (md4/md5/sha1) */
73 #define OPIE_HASHNAME_MAX 4
75 /* Maximum length of a challenge (otp-md? 9999 seed ext) */
76 #define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX+1+3)
78 /* Maximum length of a response that we allow */
79 #define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19)
81 /* Maximum length of a principal (read: user name) */
82 #define OPIE_PRINCIPAL_MAX 32
84 /* Maximum sequence number */
85 #ifndef OPIE_SEQUENCE_MAX
86 #define OPIE_SEQUENCE_MAX 9999
87 #endif /* OPIE_SEQUENCE_MAX */
89 /* Restricted sequence number */
90 #ifndef OPIE_SEQUENCE_RESTRICT
91 #define OPIE_SEQUENCE_RESTRICT 9
92 #endif /* OPIE_SEQUENCE_RESTRICT */
94 #define UINT4 u_int32_t
96 struct opie_otpkey {
97 UINT4 words[2];
100 #ifndef SEEK_SET
101 #define SEEK_SET 0
102 #endif /* SEEK_SET */
104 #ifndef SEEK_END
105 #define SEEK_END 2
106 #endif /* SEEK_END */
108 __BEGIN_DECLS
109 int opieaccessfile(char *);
110 int rdnets(long);
111 int isaddr(register char *);
112 int opiealways(char *);
113 char *opieatob8(struct opie_otpkey *, char *);
114 void opiebackspace(char *);
115 char *opiebtoa8(char *, struct opie_otpkey *);
116 char *opiebtoe(char *, struct opie_otpkey *);
117 char *opiebtoh(char *, struct opie_otpkey *);
118 int opieetob(struct opie_otpkey *, char *);
119 int opiechallenge(struct opie *,char *,char *);
120 int opiegenerator(char *,char *,char *);
121 int opiegetsequence(struct opie *);
122 void opiehash(struct opie_otpkey *, unsigned);
123 int opiehtoi(register char);
124 int opiekeycrunch(int, struct opie_otpkey *, char *, char *);
125 int opielock(char *);
126 int opieunlock(void);
127 void opieunlockaeh(void);
128 void opiedisableaeh(void);
129 int opielookup(struct opie *,char *);
130 int opiepasscheck(char *);
131 int opienewseed(char *);
132 void opierandomchallenge(char *);
133 char * opieskipspace(register char *);
134 void opiestripcrlf(char *);
135 int opieverify(struct opie *,char *);
136 int opiepasswd(struct opie *, int, char *, int, char *, char *);
137 char *opiereadpass(char *, int, int);
138 int opielogin(char *line, char *name, char *host);
139 const char *opie_get_algorithm(void);
140 int opie_haskey(char *username);
141 char *opie_keyinfo(char *);
142 int opie_passverify(char *username, char *passwd);
143 int opieinsecure(void);
144 void opieversion(void);
145 __END_DECLS
147 #if _OPIE
148 #define VOIDPTR void *
149 #define VOIDRET void
150 #define NOARGS void
151 #define FUNCTION(arglist, args) (args)
152 #define AND ,
153 #define FUNCTION_NOARGS ()
155 __BEGIN_DECLS
156 struct utmp;
157 int __opiegetutmpentry(char *, struct utmp *);
158 #ifdef EOF
159 FILE *__opieopen(char *, int, int);
160 #endif /* EOF */
161 int __opiereadrec(struct opie *);
162 int __opiewriterec(struct opie *);
163 int __opieparsechallenge(char *buffer, int *algorithm, int *sequence, char **seed, int *exts);
164 void opiehashlen(int algorithm, void *in, struct opie_otpkey *out, int n);
165 __END_DECLS
167 #define opiestrncpy(dst, src, n) \
168 do { \
169 strncpy(dst, src, n-1); \
170 dst[n-1] = 0; \
171 } while(0)
173 /* #include "missing.h" */
174 #endif /* _OPIE */
176 #define OPIEPASSWD_CONSOLE 1
177 #define OPIEPASSWD_FORCE 2
179 #endif /* _OPIE_H */