1 /** $MirOS: src/include/login_cap.h,v 1.2 2010/01/07 22:34:48 tg Exp $ */ 2 /* $OpenBSD: login_cap.h,v 1.13 2005/01/28 17:17:22 millert Exp $ */ 3 4 /*- 5 * Copyright (c) 1995,1997 Berkeley Software Design, Inc. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Berkeley Software Design, 18 * Inc. 19 * 4. The name of Berkeley Software Design, Inc. may not be used to endorse 20 * or promote products derived from this software without specific prior 21 * written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * BSDI $From: login_cap.h,v 2.11 1999/09/08 18:11:57 prb Exp $ 36 */ 37 38 #ifndef _LOGIN_CAP_H_ 39 #define _LOGIN_CAP_H_ 40 41 #define LOGIN_DEFCLASS "default" 42 #define LOGIN_DEFSTYLE "passwd" 43 #define LOGIN_DEFSERVICE "login" 44 #define LOGIN_DEFUMASK 022 45 #define _PATH_LOGIN_CONF "/etc/login.conf" 46 #define _PATH_AUTHPROG "/usr/libexec/auth/login_" 47 48 #define LOGIN_SETGROUP 0x0001 /* Set group */ 49 #define LOGIN_SETLOGIN 0x0002 /* Set login */ 50 #define LOGIN_SETPATH 0x0004 /* Set path */ 51 #define LOGIN_SETPRIORITY 0x0008 /* Set priority */ 52 #define LOGIN_SETRESOURCES 0x0010 /* Set resource limits */ 53 #define LOGIN_SETUMASK 0x0020 /* Set umask */ 54 #define LOGIN_SETUSER 0x0040 /* Set user */ 55 #define LOGIN_SETENV 0x0080 /* Set environment */ 56 #define LOGIN_SETALL 0x00ff /* Set all. */ 57 58 #define BI_AUTH "authorize" /* Accepted authentication */ 59 #define BI_REJECT "reject" /* Rejected authentication */ 60 #define BI_CHALLENGE "reject challenge" /* Reject with a challenge */ 61 #define BI_SILENT "reject silent" /* Reject silently */ 62 #define BI_REMOVE "remove" /* remove file on error */ 63 #define BI_ROOTOKAY "authorize root" /* root authenticated */ 64 #define BI_SECURE "authorize secure" /* okay on non-secure line */ 65 #define BI_SETENV "setenv" /* set environment variable */ 66 #define BI_UNSETENV "unsetenv" /* unset environment variable */ 67 #define BI_VALUE "value" /* set local variable */ 68 #define BI_EXPIRED "reject expired" /* account expired */ 69 #define BI_PWEXPIRED "reject pwexpired" /* password expired */ 70 #define BI_FDPASS "fd" /* child is passing an fd */ 71 72 /* 73 * bits which can be returned by authenticate()/auth_scan() 74 */ 75 #define AUTH_OKAY 0x01 /* user authenticated */ 76 #define AUTH_ROOTOKAY 0x02 /* authenticated as root */ 77 #define AUTH_SECURE 0x04 /* secure login */ 78 #define AUTH_SILENT 0x08 /* silent rejection */ 79 #define AUTH_CHALLENGE 0x10 /* a challenge was given */ 80 #define AUTH_EXPIRED 0x20 /* account expired */ 81 #define AUTH_PWEXPIRED 0x40 /* password expired */ 82 83 #define AUTH_ALLOW (AUTH_OKAY | AUTH_ROOTOKAY | AUTH_SECURE) 84 85 typedef struct login_cap { 86 char *lc_class; 87 char *lc_cap; 88 char *lc_style; 89 } login_cap_t; 90 91 #include <sys/cdefs.h> 92 __BEGIN_DECLS 93 struct passwd; 94 95 login_cap_t *login_getclass(char *); 96 void login_close(login_cap_t *); 97 int login_getcapbool(login_cap_t *, char *, unsigned int); 98 quad_t login_getcapnum(login_cap_t *, char *, quad_t, quad_t); 99 quad_t login_getcapsize(login_cap_t *, char *, quad_t, quad_t); 100 char *login_getcapstr(login_cap_t *, char *, char *, char *); 101 quad_t login_getcaptime(login_cap_t *, char *, quad_t, quad_t); 102 char *login_getstyle(login_cap_t *, char *, char *); 103 104 int secure_path(char *); 105 int setclasscontext(char *, unsigned int); 106 int setusercontext(login_cap_t *, struct passwd *, uid_t, unsigned int); 107 108 void mbsd_crypt_32to64(const uint8_t *, char *, uint32_t, int); 109 int pwd_gensalt(char *, int, login_cap_t *, char); 110 __END_DECLS 111 112 #endif /* _LOGIN_CAP_H_ */ 113