1*a7b56afaSmortimer /* $OpenBSD: token.h,v 1.5 2020/09/06 17:08:29 mortimer Exp $ */ 227b8cbb6Smillert 327b8cbb6Smillert /*- 4fafad76dSmillert * Copyright (c) 1995 Migration Associates Corp. All Rights Reserved 527b8cbb6Smillert * 627b8cbb6Smillert * Redistribution and use in source and binary forms, with or without 727b8cbb6Smillert * modification, are permitted provided that the following conditions 827b8cbb6Smillert * are met: 927b8cbb6Smillert * 1. Redistributions of source code must retain the above copyright 1027b8cbb6Smillert * notice, this list of conditions and the following disclaimer. 1127b8cbb6Smillert * 2. Redistributions in binary form must reproduce the above copyright 1227b8cbb6Smillert * notice, this list of conditions and the following disclaimer in the 1327b8cbb6Smillert * documentation and/or other materials provided with the distribution. 1427b8cbb6Smillert * 3. All advertising materials mentioning features or use of this software 1527b8cbb6Smillert * must display the following acknowledgement: 1627b8cbb6Smillert * This product includes software developed by Berkeley Software Design, 1727b8cbb6Smillert * Inc. 1827b8cbb6Smillert * 4. The name of Berkeley Software Design, Inc. may not be used to endorse 1927b8cbb6Smillert * or promote products derived from this software without specific prior 2027b8cbb6Smillert * written permission. 2127b8cbb6Smillert * 2227b8cbb6Smillert * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND 2327b8cbb6Smillert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2427b8cbb6Smillert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2527b8cbb6Smillert * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE 2627b8cbb6Smillert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2727b8cbb6Smillert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2827b8cbb6Smillert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2927b8cbb6Smillert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3027b8cbb6Smillert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3127b8cbb6Smillert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3227b8cbb6Smillert * SUCH DAMAGE. 3327b8cbb6Smillert * 3427b8cbb6Smillert * BSDI $From: token.h,v 1.1 1996/08/26 20:13:10 prb Exp $ 3527b8cbb6Smillert */ 3627b8cbb6Smillert 3727b8cbb6Smillert /* 3827b8cbb6Smillert * Operations accepted by the token admin commands 3927b8cbb6Smillert */ 4027b8cbb6Smillert 4127b8cbb6Smillert #define TOKEN_DISABLE 0x1 /* disable user account */ 4227b8cbb6Smillert #define TOKEN_ENABLE 0x2 /* enable user account */ 4327b8cbb6Smillert #define TOKEN_INITUSER 0x4 /* add/init user account */ 4427b8cbb6Smillert #define TOKEN_RMUSER 0x8 /* remove user account */ 4527b8cbb6Smillert #define TOKEN_UNLOCK 0x10 /* force unlock db record */ 4627b8cbb6Smillert 4727b8cbb6Smillert /* 4827b8cbb6Smillert * Flags for options to modify TOKEN_INITUSER 4927b8cbb6Smillert */ 5027b8cbb6Smillert 5127b8cbb6Smillert #define TOKEN_FORCEINIT 0x100 /* reinit existing account */ 5227b8cbb6Smillert #define TOKEN_GENSECRET 0x200 /* gen shared secret for token */ 5327b8cbb6Smillert 5427b8cbb6Smillert /* 5527b8cbb6Smillert * Structure describing different token cards 5627b8cbb6Smillert */ 5727b8cbb6Smillert struct token_types { 5827b8cbb6Smillert char *name; /* name of card */ 5927b8cbb6Smillert char *proper; /* proper name of card */ 6027b8cbb6Smillert char *db; /* path to database */ 6127b8cbb6Smillert char map[6]; /* how A-F map to decimal */ 62284c262eSjufi int options; /* various available options */ 6327b8cbb6Smillert u_int modes; /* available modes */ 6427b8cbb6Smillert u_int defmode; /* default mode (if none specified) */ 6527b8cbb6Smillert }; 6627b8cbb6Smillert 67*a7b56afaSmortimer extern struct token_types *tt; /* what type we are running as now */ 6827b8cbb6Smillert 6927b8cbb6Smillert /* 7027b8cbb6Smillert * Options 7127b8cbb6Smillert */ 7227b8cbb6Smillert #define TOKEN_PHONE 0x0001 /* Allow phone number representation */ 7327b8cbb6Smillert #define TOKEN_HEXINIT 0x0002 /* Allow initialization in hex (and octal) */ 7427b8cbb6Smillert 7527b8cbb6Smillert /* 7627b8cbb6Smillert * Function prototypes for commands involving intimate DES knowledge 7727b8cbb6Smillert */ 7827b8cbb6Smillert 7927b8cbb6Smillert extern void tokenchallenge(char *, char *, int, char *); 8027b8cbb6Smillert extern int tokenverify(char *, char *, char *); 8127b8cbb6Smillert extern int tokenuserinit(int, char *, u_char *, u_int); 8227b8cbb6Smillert extern int token_init(char *); 8327b8cbb6Smillert extern u_int token_mode(char *); 8427b8cbb6Smillert extern char * token_getmode(u_int); 85