summaryrefslogtreecommitdiff
path: root/libexec/login_token/tokendb.h
blob: e8d43afa84691acc8044c33151668861b5f062eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*	$OpenBSD: tokendb.h,v 1.4 2002/11/21 22:11:45 millert Exp $	*/

/*-
 * Copyright (c) 1995 Migration Associates Corp. All Rights Reserved
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by Berkeley Software Design,
 *      Inc.
 * 4. The name of Berkeley Software Design, Inc.  may not be used to endorse
 *    or promote products derived from this software without specific prior
 *    written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	BSDI $From: tokendb.h,v 1.1 1996/08/26 20:13:11 prb Exp $
 */

/*
 * Structure defining a record for a user.  All fields 
 * stored in ascii to facilitate backup/reconstruction.
 * A null byte is required after the share secret field.
 */

typedef	struct	{
	char	uname[L_cuserid];	/* user login name	*/
	char	secret[16];		/* token shared secret	*/
	unsigned flags;			/* record flags		*/
	unsigned mode;			/* token mode flags	*/
	time_t	lock_time;		/* time of record lock	*/
	u_char	rim[8];			/* reduced input mode 	*/
	char	reserved_char1[8];
	char	reserved_char2[80];
} TOKENDB_Rec;

/*
 * Record flag values
 */

#define	TOKEN_LOCKED	0x1		/* record locked for updating	*/
#define	TOKEN_ENABLED	0x2		/* user login method enabled	*/
#define	TOKEN_LOGIN	0x4		/* login in progress lock	*/
#define	TOKEN_USEMODES	0x8		/* use the mode field		*/

#define	TOKEN_DECMODE	0x1		/* allow decimal results */
#define	TOKEN_HEXMODE	0x2		/* allow hex results */
#define	TOKEN_PHONEMODE	0x4		/* allow phone book results */
#define	TOKEN_RIM	0x8		/* reduced imput mode */

#define	TOKEN_GROUP	"_token"	/* group that owns token database */

/*
 * Function prototypes for routines which manipulate the 
 * database for the token.  These routines have no knowledge
 * of DES or encryption.  However, they will manipulate the
 * flags field of the database record with complete abandon.
 */

extern	int	tokendb_delrec(char *);
extern	int	tokendb_getrec(char *, TOKENDB_Rec *);
extern	int	tokendb_putrec(char *, TOKENDB_Rec *);
extern	int	tokendb_firstrec(int, TOKENDB_Rec *);
extern	int	tokendb_nextrec(int, TOKENDB_Rec *);
extern	int	tokendb_lockrec(char *, TOKENDB_Rec *, unsigned);