login_cap.h revision 25658
1/*- 2 * Copyright (c) 1996 by 3 * Sean Eric Fagan <sef@kithrup.com> 4 * David Nugent <davidn@blaze.net.au> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, is permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice immediately at the beginning of the file, without modification, 12 * this list of conditions, and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. This work was done expressly for inclusion into FreeBSD. Other use 17 * is permitted provided this notation is included. 18 * 4. Absolutely no warranty of function or purpose is made by the authors. 19 * 5. Modifications may be freely made to this file providing the above 20 * conditions are met. 21 * 22 * Low-level routines relating to the user capabilities database 23 * 24 * Was login_cap.h,v 1.9 1997/05/07 20:00:01 eivind Exp 25 * $Id$ 26 */ 27 28#ifndef _LOGIN_CAP_H_ 29#define _LOGIN_CAP_H_ 30 31#define LOGIN_DEFCLASS "default" 32#define LOGIN_DEFSTYLE "passwd" 33#define LOGIN_DEFSERVICE "login" 34#define LOGIN_DEFUMASK 022 35#define LOGIN_DEFPRI 0 36#define _PATH_LOGIN_CONF "/etc/login.conf" 37#define _FILE_LOGIN_CONF ".login_conf" 38#define _PATH_AUTHPROG "/usr/libexec/login_" 39 40#define LOGIN_SETGROUP 0x0001 /* set group */ 41#define LOGIN_SETLOGIN 0x0002 /* set login (via setlogin) */ 42#define LOGIN_SETPATH 0x0004 /* set path */ 43#define LOGIN_SETPRIORITY 0x0008 /* set priority */ 44#define LOGIN_SETRESOURCES 0x0010 /* set resources (cputime, etc.) */ 45#define LOGIN_SETUMASK 0x0020 /* set umask, obviously */ 46#define LOGIN_SETUSER 0x0040 /* set user (via setuid) */ 47#define LOGIN_SETENV 0x0080 /* set user environment */ 48#define LOGIN_SETALL 0x00ff /* set everything */ 49 50#define BI_AUTH "authorize" 51#define BI_AUTH2 "authorise" 52#define BI_REJECT "reject" 53#define BI_REMOVE "remove" 54#define BI_ROOTOKAY "root" 55#define BI_SECURE "secure" 56#define BI_SETENV "setenv" 57 58#ifndef AUTH_NONE /* Protect against <rpc/auth.h> */ 59#define AUTH_NONE 0x00 60#endif 61#define AUTH_OKAY 0x01 62#define AUTH_ROOTOKAY 0x02 /* root login okay */ 63#define AUTH_SECURE 0x04 /* secure login */ 64 65typedef struct login_cap { 66 char *lc_class; 67 char *lc_cap; 68 char *lc_style; 69} login_cap_t; 70 71typedef struct login_time { 72 u_short lt_start; /* Start time */ 73 u_short lt_end; /* End time */ 74 #define LTM_NONE 0x00 75 #define LTM_SUN 0x01 76 #define LTM_MON 0x02 77 #define LTM_TUE 0x04 78 #define LTM_WED 0x08 79 #define LTM_THU 0x10 80 #define LTM_FRI 0x20 81 #define LTM_SAT 0x40 82 #define LTM_ANY 0x7F 83 #define LTM_WK 0x3E 84 #define LTM_WD 0x41 85 u_char lt_dow; /* Days of week */ 86} login_time_t; 87#define LC_MAXTIMES 64 88 89#include <sys/cdefs.h> 90__BEGIN_DECLS 91struct passwd; 92 93void login_close __P((login_cap_t *)); 94login_cap_t *login_getclassbyname __P((const char *, const char *homedir)); 95login_cap_t *login_getclass __P((const struct passwd *)); 96login_cap_t *login_getuserclass __P((const struct passwd *)); 97 98char *login_getcapstr __P((login_cap_t*, const char *, char *, char *)); 99char **login_getcaplist __P((login_cap_t *, const char *, const char *)); 100char *login_getstyle __P((login_cap_t *, char *, const char *)); 101rlim_t login_getcaptime __P((login_cap_t *, const char *, rlim_t, rlim_t)); 102rlim_t login_getcapnum __P((login_cap_t *, const char *, rlim_t, rlim_t)); 103rlim_t login_getcapsize __P((login_cap_t *, const char *, rlim_t, rlim_t)); 104char *login_getpath __P((login_cap_t *, const char *, char *)); 105int login_getcapbool __P((login_cap_t *, const char *, int)); 106 107int setclasscontext __P((const char*, unsigned int)); 108int setusercontext __P((login_cap_t*, const struct passwd*, uid_t, unsigned int)); 109void setclassresources __P((login_cap_t *)); 110void setclassenvironment __P((login_cap_t *, const struct passwd *, int)); 111 112int authenticate __P((const char*, const char*, const char*, const char*)); 113int auth_script __P((const char*, ...)); 114int auth_env __P((void)); 115int auth_scan __P((int)); 116int auth_rmfiles __P((void)); 117void auth_checknologin __P((login_cap_t*)); 118int auth_cat __P((const char*)); 119 120int auth_ttyok __P((login_cap_t*, const char *)); 121int auth_hostok __P((login_cap_t*, const char *, char const *)); 122int auth_timeok __P((login_cap_t*, time_t)); 123 124struct tm; 125 126login_time_t parse_lt __P((const char *)); 127int in_ltm __P((const login_time_t *, struct tm *, time_t *)); 128int in_ltms __P((const login_time_t *, struct tm *, time_t *)); 129 130/* auxiliary functions */ 131 132int login_strinlist __P((char **, char const *, int)); 133int login_str2inlist __P((char **, const char *, const char *, int)); 134login_time_t * login_timelist __P((login_cap_t *, char const *, int *, login_time_t **)); 135int login_ttyok __P((login_cap_t *, const char *, const char *, const char *)); 136int login_hostok __P((login_cap_t *, const char *, const char *, const char *, const char *)); 137 138__END_DECLS 139 140#endif /* _LOGIN_CAP_H_ */ 141 142