summaryrefslogtreecommitdiffstats
path: root/lib/libutil/login_cap.h
diff options
context:
space:
mode:
authordavidn <davidn@FreeBSD.org>1997-05-10 18:55:38 +0000
committerdavidn <davidn@FreeBSD.org>1997-05-10 18:55:38 +0000
commit1ad6ccc98afd1c55203d6b83b4d8e79fa7b3847a (patch)
treefc47fb17dbeaaa8cc7d7360dc539739166e4102e /lib/libutil/login_cap.h
parentd0fcfa02e614f5fbab7f793c6a1e1b161a71315e (diff)
downloadFreeBSD-src-1ad6ccc98afd1c55203d6b83b4d8e79fa7b3847a.zip
FreeBSD-src-1ad6ccc98afd1c55203d6b83b4d8e79fa7b3847a.tar.gz
Summary of login.conf support changes:
o Incorporated BSDI code and enhancements, better logging for error checking (which has been shown to be a problem, and is therefore justified, imho); also some minor things we were missing, including better quad_t math, which checks for under/overflows. o setusercontext() now allows user resource limit overrides, but does this AFTER dropping root privs, to restrict the user to droping hard limits and set soft limits within the kernel's allowed user limits. o umask() only set once, and only if requested. o add _secure_path(), and use in login.conf to guard against symlinks etc. and non-root owned or non-user owned files being used. Derived from BSDI contributed code. o revamped authentication code to BSDI's latest api, which includes deleting authenticate() and adding auth_check() and a few other functions. This is still marked as depecated in BSDI, but is included for completeness. No other source in the tree uses this anyway, so it is now bracketed with #ifdef LOGIN_CAP_AUTH which is by default not defined. Only auth_checknologin() and auth_cat() are actually used in module login_auth.c. o AUTH_NONE definition removed (collided with other includes in the tree). [bde] o BSDI's login_getclass() now accepts a char *classname parameter rather than struct passwd *pwd. We now do likewise, but added login_getpwclass() for (sort of) backwards compatiblity, namely because we handle root as a special case for the default class. This will require quite a few changes elsewhere in the source tree. o We no longer pretend to support rlim_t as a long type. o Revised code formatting to be more bsd-ish style.
Diffstat (limited to 'lib/libutil/login_cap.h')
-rw-r--r--lib/libutil/login_cap.h115
1 files changed, 65 insertions, 50 deletions
diff --git a/lib/libutil/login_cap.h b/lib/libutil/login_cap.h
index 4c92f0a..f380936 100644
--- a/lib/libutil/login_cap.h
+++ b/lib/libutil/login_cap.h
@@ -22,13 +22,15 @@
* Low-level routines relating to the user capabilities database
*
* Was login_cap.h,v 1.9 1997/05/07 20:00:01 eivind Exp
- * $Id$
+ * $Id: login_cap.h,v 1.1 1997/05/10 12:49:30 davidn Exp $
*/
#ifndef _LOGIN_CAP_H_
#define _LOGIN_CAP_H_
#define LOGIN_DEFCLASS "default"
+#define LOGIN_DEFROOTCLASS "root"
+#define LOGIN_MECLASS "me"
#define LOGIN_DEFSTYLE "passwd"
#define LOGIN_DEFSERVICE "login"
#define LOGIN_DEFUMASK 022
@@ -37,53 +39,57 @@
#define _FILE_LOGIN_CONF ".login_conf"
#define _PATH_AUTHPROG "/usr/libexec/login_"
-#define LOGIN_SETGROUP 0x0001 /* set group */
-#define LOGIN_SETLOGIN 0x0002 /* set login (via setlogin) */
-#define LOGIN_SETPATH 0x0004 /* set path */
-#define LOGIN_SETPRIORITY 0x0008 /* set priority */
-#define LOGIN_SETRESOURCES 0x0010 /* set resources (cputime, etc.) */
-#define LOGIN_SETUMASK 0x0020 /* set umask, obviously */
-#define LOGIN_SETUSER 0x0040 /* set user (via setuid) */
-#define LOGIN_SETENV 0x0080 /* set user environment */
-#define LOGIN_SETALL 0x00ff /* set everything */
-
-#define BI_AUTH "authorize"
-#define BI_AUTH2 "authorise"
-#define BI_REJECT "reject"
-#define BI_REMOVE "remove"
-#define BI_ROOTOKAY "root"
-#define BI_SECURE "secure"
-#define BI_SETENV "setenv"
-
-#ifndef AUTH_NONE /* Protect against <rpc/auth.h> */
-#define AUTH_NONE 0x00
-#endif
-#define AUTH_OKAY 0x01
-#define AUTH_ROOTOKAY 0x02 /* root login okay */
-#define AUTH_SECURE 0x04 /* secure login */
+#define LOGIN_SETGROUP 0x0001 /* set group */
+#define LOGIN_SETLOGIN 0x0002 /* set login (via setlogin) */
+#define LOGIN_SETPATH 0x0004 /* set path */
+#define LOGIN_SETPRIORITY 0x0008 /* set priority */
+#define LOGIN_SETRESOURCES 0x0010 /* set resources (cputime, etc.) */
+#define LOGIN_SETUMASK 0x0020 /* set umask, obviously */
+#define LOGIN_SETUSER 0x0040 /* set user (via setuid) */
+#define LOGIN_SETENV 0x0080 /* set user environment */
+#define LOGIN_SETALL 0x00ff /* set everything */
+
+#define BI_AUTH "authorize" /* accepted authentication */
+#define BI_REJECT "reject" /* rejected authentication */
+#define BI_CHALLENG "reject challenge" /* reject with a challenge */
+#define BI_SILENT "reject silent" /* reject silently */
+#define BI_REMOVE "remove" /* remove file on error */
+#define BI_ROOTOKAY "authorize root" /* root authenticated */
+#define BI_SECURE "authorize secure" /* okay on non-secure line */
+#define BI_SETENV "setenv" /* set environment variable */
+#define BI_VALUE "value" /* set local variable */
+
+#define AUTH_OKAY 0x01 /* user authenticated */
+#define AUTH_ROOTOKAY 0x02 /* root login okay */
+#define AUTH_SECURE 0x04 /* secure login */
+#define AUTH_SILENT 0x08 /* silent rejection */
+#define AUTH_CHALLENGE 0x10 /* a chellenge was given */
+
+#define AUTH_ALLOW (AUTH_OKAY | AUTH_ROOTOKAY | AUTH_SECURE)
typedef struct login_cap {
- char *lc_class;
- char *lc_cap;
- char *lc_style;
+ char *lc_class;
+ char *lc_cap;
+ char *lc_style;
} login_cap_t;
typedef struct login_time {
- u_short lt_start; /* Start time */
- u_short lt_end; /* End time */
- #define LTM_NONE 0x00
- #define LTM_SUN 0x01
- #define LTM_MON 0x02
- #define LTM_TUE 0x04
- #define LTM_WED 0x08
- #define LTM_THU 0x10
- #define LTM_FRI 0x20
- #define LTM_SAT 0x40
- #define LTM_ANY 0x7F
- #define LTM_WK 0x3E
- #define LTM_WD 0x41
- u_char lt_dow; /* Days of week */
+ u_short lt_start; /* Start time */
+ u_short lt_end; /* End time */
+#define LTM_NONE 0x00
+#define LTM_SUN 0x01
+#define LTM_MON 0x02
+#define LTM_TUE 0x04
+#define LTM_WED 0x08
+#define LTM_THU 0x10
+#define LTM_FRI 0x20
+#define LTM_SAT 0x40
+#define LTM_ANY 0x7F
+#define LTM_WK 0x3E
+#define LTM_WD 0x41
+ u_char lt_dow; /* Days of week */
} login_time_t;
+
#define LC_MAXTIMES 64
#include <sys/cdefs.h>
@@ -91,8 +97,9 @@ __BEGIN_DECLS
struct passwd;
void login_close __P((login_cap_t *));
-login_cap_t *login_getclassbyname __P((const char *, const char *homedir));
-login_cap_t *login_getclass __P((const struct passwd *));
+login_cap_t *login_getclassbyname __P((const char *, const struct passwd *));
+login_cap_t *login_getclass __P((const char *));
+login_cap_t *login_getpwclass __P((const struct passwd *));
login_cap_t *login_getuserclass __P((const struct passwd *));
char *login_getcapstr __P((login_cap_t*, const char *, char *, char *));
@@ -109,11 +116,20 @@ int setusercontext __P((login_cap_t*, const struct passwd*, uid_t, unsigned int)
void setclassresources __P((login_cap_t *));
void setclassenvironment __P((login_cap_t *, const struct passwd *, int));
-int authenticate __P((const char*, const char*, const char*, const char*));
-int auth_script __P((const char*, ...));
-int auth_env __P((void));
+/* Most of these functions are deprecated */
+int auth_approve __P((login_cap_t*, const char*, const char*));
+int auth_check __P((const char *, const char *, const char *, const char *, int *));
+void auth_env __P((void));
+char *auth_mkvalue __P((const char *n));
+int auth_response __P((const char *, const char *, const char *, const char *, int *, const char *, const char *));
+void auth_rmfiles __P((void));
int auth_scan __P((int));
-int auth_rmfiles __P((void));
+int auth_script __P((const char*, ...));
+int auth_script_data __P((const char *, int, const char *, ...));
+char *auth_valud __P((const char *));
+int auth_setopt __P((const char *, const char *));
+void auth_clropts __P((void));
+
void auth_checknologin __P((login_cap_t*));
int auth_cat __P((const char*));
@@ -127,7 +143,7 @@ login_time_t parse_lt __P((const char *));
int in_ltm __P((const login_time_t *, struct tm *, time_t *));
int in_ltms __P((const login_time_t *, struct tm *, time_t *));
-/* auxiliary functions */
+/* helper functions */
int login_strinlist __P((char **, char const *, int));
int login_str2inlist __P((char **, const char *, const char *, int));
@@ -138,4 +154,3 @@ int login_hostok __P((login_cap_t *, const char *, const char *, const char *, c
__END_DECLS
#endif /* _LOGIN_CAP_H_ */
-
OpenPOWER on IntegriCloud