1/*	$OpenBSD: token.h,v 1.5 2020/09/06 17:08:29 mortimer 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: token.h,v 1.1 1996/08/26 20:13:10 prb Exp $
35 */
36
37/*
38 * Operations accepted by the token admin commands
39 */
40
41#define	TOKEN_DISABLE	0x1	/* disable user account		*/
42#define	TOKEN_ENABLE	0x2	/* enable user account		*/
43#define	TOKEN_INITUSER	0x4	/* add/init user account	*/
44#define	TOKEN_RMUSER	0x8	/* remove user account		*/
45#define	TOKEN_UNLOCK	0x10	/* force unlock db record	*/
46
47/*
48 * Flags for options to modify TOKEN_INITUSER
49 */
50
51#define	TOKEN_FORCEINIT	0x100	/* reinit existing account	*/
52#define	TOKEN_GENSECRET	0x200	/* gen shared secret for token	*/
53
54/*
55 * Structure describing different token cards
56 */
57struct token_types {
58	char	*name;		/* name of card */
59	char	*proper;	/* proper name of card */
60	char	*db;		/* path to database */
61	char	map[6];		/* how A-F map to decimal */
62	int	options;	/* various available options */
63	u_int	modes;		/* available modes */
64	u_int	defmode;	/* default mode (if none specified) */
65};
66
67extern struct token_types *tt;		/* what type we are running as now */
68
69/*
70 * Options
71 */
72#define	TOKEN_PHONE	0x0001	/* Allow phone number representation */
73#define	TOKEN_HEXINIT	0x0002	/* Allow initialization in hex (and octal) */
74
75/*
76 * Function prototypes for commands involving intimate DES knowledge
77 */
78
79extern	void	tokenchallenge(char *, char *, int, char *);
80extern	int	tokenverify(char *, char *, char *);
81extern	int	tokenuserinit(int, char *, u_char *, u_int);
82extern	int	token_init(char *);
83extern	u_int	token_mode(char *);
84extern	char *	token_getmode(u_int);
85