xref: /openbsd/libexec/login_token/tokendb.h (revision 15904bd8)
1 /*	$OpenBSD: tokendb.h,v 1.3 2002/11/21 22:00:50 millert Exp $	*/
2 
3 /*-
4  * Copyright (c) 1995 Migration Associates Corp. All Rights Reserved
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *      This product includes software developed by Berkeley Software Design,
17  *      Inc.
18  * 4. The name of Berkeley Software Design, Inc.  may not be used to endorse
19  *    or promote products derived from this software without specific prior
20  *    written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	BSDI $From: tokendb.h,v 1.1 1996/08/26 20:13:11 prb Exp $
35  */
36 
37 /*
38  * Structure defining a record for a user.  All fields
39  * stored in ascii to facilitate backup/reconstruction.
40  * A null byte is required after the share secret field.
41  */
42 
43 typedef	struct	{
44 	char	uname[L_cuserid];	/* user login name	*/
45 	char	secret[16];		/* token shared secret	*/
46 	unsigned flags;			/* record flags		*/
47 	unsigned mode;			/* token mode flags	*/
48 	time_t	lock_time;		/* time of record lock	*/
49 	u_char	rim[8];			/* reduced input mode 	*/
50 	char	reserved_char1[8];
51 	char	reserved_char2[80];
52 } TOKENDB_Rec;
53 
54 /*
55  * Record flag values
56  */
57 
58 #define	TOKEN_LOCKED	0x1		/* record locked for updating	*/
59 #define	TOKEN_ENABLED	0x2		/* user login method enabled	*/
60 #define	TOKEN_LOGIN	0x4		/* login in progress lock	*/
61 #define	TOKEN_USEMODES	0x8		/* use the mode field		*/
62 
63 #define	TOKEN_DECMODE	0x1		/* allow decimal results */
64 #define	TOKEN_HEXMODE	0x2		/* allow hex results */
65 #define	TOKEN_PHONEMODE	0x4		/* allow phone book results */
66 #define	TOKEN_RIM	0x8		/* reduced imput mode */
67 
68 #define	TOKEN_GROUP	"tokenadm"	/* group that owns token database */
69 
70 /*
71  * Function prototypes for routines which manipulate the
72  * database for the token.  These routines have no knowledge
73  * of DES or encryption.  However, they will manipulate the
74  * flags field of the database record with complete abandon.
75  */
76 
77 extern	int	tokendb_delrec(char *);
78 extern	int	tokendb_getrec(char *, TOKENDB_Rec *);
79 extern	int	tokendb_putrec(char *, TOKENDB_Rec *);
80 extern	int	tokendb_firstrec(int, TOKENDB_Rec *);
81 extern	int	tokendb_nextrec(int, TOKENDB_Rec *);
82 extern	int	tokendb_lockrec(char *, TOKENDB_Rec *, unsigned);
83