1997-01-04 16:50:08 +00:00
|
|
|
.\" Copyright (c) 1995 David Nugent <davidn@blaze.net.au>
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, is permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice immediately at the beginning of the file, without modification,
|
|
|
|
.\" this list of conditions, and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. This work was done expressly for inclusion into FreeBSD. Other use
|
|
|
|
.\" is permitted provided this notation is included.
|
|
|
|
.\" 4. Absolutely no warranty of function or purpose is made by the author
|
|
|
|
.\" David Nugent.
|
|
|
|
.\" 5. Modifications may be freely made to this file providing the above
|
|
|
|
.\" conditions are met.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1997-01-04 16:50:08 +00:00
|
|
|
.\"
|
2007-06-14 09:33:37 +00:00
|
|
|
.Dd June 14, 2007
|
2001-07-10 13:41:46 +00:00
|
|
|
.Os
|
1997-01-04 16:50:08 +00:00
|
|
|
.Dt LOGIN_CAP 3
|
|
|
|
.Sh NAME
|
|
|
|
.Nm login_close ,
|
2000-04-22 16:17:00 +00:00
|
|
|
.Nm login_getcapbool ,
|
1997-01-04 16:50:08 +00:00
|
|
|
.Nm login_getcaplist ,
|
|
|
|
.Nm login_getcapnum ,
|
2000-04-22 16:17:00 +00:00
|
|
|
.Nm login_getcapstr ,
|
1997-01-04 16:50:08 +00:00
|
|
|
.Nm login_getcapsize ,
|
2000-04-22 16:17:00 +00:00
|
|
|
.Nm login_getcaptime ,
|
|
|
|
.Nm login_getclass ,
|
|
|
|
.Nm login_getclassbyname ,
|
|
|
|
.Nm login_getpwclass ,
|
|
|
|
.Nm login_getstyle ,
|
2000-08-22 02:15:54 +00:00
|
|
|
.Nm login_getuserclass ,
|
|
|
|
.Nm login_setcryptfmt
|
2001-04-18 15:54:10 +00:00
|
|
|
.Nd "functions for accessing the login class capabilities database"
|
2000-04-22 16:17:00 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libutil
|
1997-01-04 16:50:08 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/types.h
|
|
|
|
.In login_cap.h
|
1997-01-04 16:50:08 +00:00
|
|
|
.Ft void
|
2000-01-18 03:02:29 +00:00
|
|
|
.Fn login_close "login_cap_t *lc"
|
1997-01-04 16:50:08 +00:00
|
|
|
.Ft login_cap_t *
|
1997-11-05 04:03:05 +00:00
|
|
|
.Fn login_getclassbyname "const char *nam" "const struct passwd *pwd"
|
1997-01-04 16:50:08 +00:00
|
|
|
.Ft login_cap_t *
|
1997-05-18 09:14:11 +00:00
|
|
|
.Fn login_getclass "const char *nam"
|
|
|
|
.Ft login_cap_t *
|
|
|
|
.Fn login_getpwclass "const struct passwd *pwd"
|
1997-01-04 16:50:08 +00:00
|
|
|
.Ft login_cap_t *
|
|
|
|
.Fn login_getuserclass "const struct passwd *pwd"
|
2002-04-08 11:04:56 +00:00
|
|
|
.Ft "const char *"
|
|
|
|
.Fn login_getcapstr "login_cap_t *lc" "const char *cap" "const char *def" "const char *error"
|
2005-11-24 11:29:11 +00:00
|
|
|
.Ft "const char **"
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn login_getcaplist "login_cap_t *lc" "const char *cap" "const char *chars"
|
2002-04-08 11:04:56 +00:00
|
|
|
.Ft "const char *"
|
|
|
|
.Fn login_getpath "login_cap_t *lc" "const char *cap" "const char *error"
|
1997-01-04 16:50:08 +00:00
|
|
|
.Ft rlim_t
|
|
|
|
.Fn login_getcaptime "login_cap_t *lc" "const char *cap" "rlim_t def" "rlim_t error"
|
|
|
|
.Ft rlim_t
|
|
|
|
.Fn login_getcapnum "login_cap_t *lc" "const char *cap" "rlim_t def" "rlim_t error"
|
|
|
|
.Ft rlim_t
|
1997-03-19 02:01:27 +00:00
|
|
|
.Fn login_getcapsize "login_cap_t *lc" "const char *cap" "rlim_t def" "rlim_t error"
|
1997-01-04 16:50:08 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn login_getcapbool "login_cap_t *lc" "const char *cap" "int def"
|
2002-04-08 11:04:56 +00:00
|
|
|
.Ft "const char *"
|
|
|
|
.Fn login_getstyle "login_cap_t *lc" "const char *style" "const char *auth"
|
2000-08-22 02:15:54 +00:00
|
|
|
.Ft const char *
|
|
|
|
.Fn login_setcryptfmt "login_cap_t *lc" "const char *def" "const char *error"
|
1997-01-04 16:50:08 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
These functions represent a programming interface to the login
|
|
|
|
classes database provided in
|
|
|
|
.Xr login.conf 5 .
|
|
|
|
This database contains capabilities, attributes and default environment
|
|
|
|
and accounting settings for users and programs running as specific users,
|
|
|
|
as determined by the login class field within entries in
|
|
|
|
.Pa /etc/master.passwd .
|
|
|
|
.Pp
|
|
|
|
Entries in
|
|
|
|
.Xr login.conf 5
|
|
|
|
consist of colon
|
|
|
|
.Ql \&:
|
|
|
|
separated fields, the first field in each record being one or more
|
1999-07-20 20:46:26 +00:00
|
|
|
identifiers for the record (which must be unique for the entire database),
|
2007-06-14 07:31:59 +00:00
|
|
|
each separated by a
|
|
|
|
.Ql | ,
|
|
|
|
and may optionally include a description as
|
|
|
|
the last
|
|
|
|
.Sq name .
|
1997-01-04 16:50:08 +00:00
|
|
|
Remaining fields in the record consist of keyword/data pairs.
|
1999-07-20 20:46:26 +00:00
|
|
|
Long lines may be continued with a backslash within empty entries,
|
1997-01-04 16:50:08 +00:00
|
|
|
with the second and subsequent lines optionally indented for readability.
|
|
|
|
This is similar to the format used in
|
1999-08-18 05:55:22 +00:00
|
|
|
.Xr termcap 5 ,
|
1997-01-04 16:50:08 +00:00
|
|
|
except that keywords are not limited to two significant characters,
|
|
|
|
and are usually longer for improved readability.
|
|
|
|
As with termcap entries, multiple records can be linked together
|
2007-06-14 07:31:59 +00:00
|
|
|
(one record including another) using a field containing
|
|
|
|
.Ql tc= Ns Va <recordid> .
|
|
|
|
The result is that the entire record referenced by
|
|
|
|
.Va <recordid>
|
|
|
|
replaces the
|
|
|
|
.Va tc=
|
|
|
|
field at the point at which it occurs.
|
1997-01-04 16:50:08 +00:00
|
|
|
See
|
|
|
|
.Xr getcap 3
|
|
|
|
for further details on the format and use of a capabilities database.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm login_cap
|
|
|
|
interface provides a convenient means of retrieving login class
|
2007-06-14 07:31:59 +00:00
|
|
|
records with all
|
|
|
|
.Va tc=
|
|
|
|
references expanded.
|
1997-01-04 16:50:08 +00:00
|
|
|
A program will typically call one of
|
|
|
|
.Fn login_getclass ,
|
1997-05-18 09:14:11 +00:00
|
|
|
.Fn login_getpwclass ,
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn login_getuserclass
|
|
|
|
or
|
|
|
|
.Fn login_getclassbyname
|
|
|
|
according to its requirements.
|
|
|
|
Each of these functions returns a login capabilities structure,
|
2007-06-14 07:31:59 +00:00
|
|
|
.Vt login_cap_t ,
|
1997-01-04 16:50:08 +00:00
|
|
|
which may subsequently be used to interrogate the database for
|
|
|
|
specific values using the rest of the API.
|
2007-06-14 07:31:59 +00:00
|
|
|
Once the
|
|
|
|
.Vt login_cap_t
|
|
|
|
is of no further use, the
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn login_close
|
|
|
|
function should be called to free all resources used.
|
|
|
|
.Pp
|
2007-06-14 07:31:59 +00:00
|
|
|
The structure of
|
|
|
|
.Vt login_cap_t
|
|
|
|
is defined in
|
|
|
|
.In login_cap.h ,
|
|
|
|
as:
|
1997-01-04 16:50:08 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
typedef struct {
|
|
|
|
char *lc_class;
|
|
|
|
char *lc_cap;
|
|
|
|
char *lc_style;
|
|
|
|
} login_cap_t;
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa lc_class
|
1997-01-04 16:50:08 +00:00
|
|
|
member contains a pointer to the name of the login class
|
|
|
|
retrieved.
|
|
|
|
This may not necessarily be the same as the one requested,
|
|
|
|
either directly via
|
|
|
|
.Fn login_getclassbyname ,
|
2007-06-14 09:33:37 +00:00
|
|
|
or indirectly via a user's login record using
|
1997-05-18 09:14:11 +00:00
|
|
|
.Fn login_getpwclass ,
|
|
|
|
by class name using
|
2007-06-14 09:33:37 +00:00
|
|
|
.Fn login_getclass .
|
1997-01-04 16:50:08 +00:00
|
|
|
If the referenced user has no login class specified in
|
|
|
|
.Pa /etc/master.passwd ,
|
2007-06-14 07:31:59 +00:00
|
|
|
the class name is
|
|
|
|
.Dv NULL
|
|
|
|
or an empty string.
|
2000-03-02 09:14:21 +00:00
|
|
|
If the class
|
1997-01-04 16:50:08 +00:00
|
|
|
specified does not exist in the database, each of these
|
2007-06-14 07:31:59 +00:00
|
|
|
functions will search for a record with an id of
|
|
|
|
.Ql default ,
|
1997-01-04 16:50:08 +00:00
|
|
|
with that name returned in the
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa lc_class
|
1997-01-04 16:50:08 +00:00
|
|
|
field.
|
2001-07-15 07:53:42 +00:00
|
|
|
In addition, if the referenced user has a UID of 0 (normally,
|
2007-06-14 07:31:59 +00:00
|
|
|
.Ql root ,
|
|
|
|
although the user name is not considered) then
|
2001-07-15 07:53:42 +00:00
|
|
|
.Fn login_getpwclass
|
2007-06-14 07:31:59 +00:00
|
|
|
will search for a record with an id of
|
|
|
|
.Ql root
|
|
|
|
before it searches
|
|
|
|
for the record with the id of
|
|
|
|
.Ql default .
|
1997-01-04 16:50:08 +00:00
|
|
|
.Pp
|
|
|
|
The
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa lc_cap
|
1997-01-04 16:50:08 +00:00
|
|
|
field is used internally by the library to contain the
|
|
|
|
expanded login capabilities record.
|
|
|
|
Programs with unusual requirements may wish to use this
|
|
|
|
with the lower-level
|
|
|
|
.Fn getcap
|
|
|
|
style functions to access the record directly.
|
|
|
|
.Pp
|
|
|
|
The
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa lc_style
|
1997-01-04 16:50:08 +00:00
|
|
|
field is set by the
|
|
|
|
.Fn login_getstyle
|
1999-07-20 20:46:26 +00:00
|
|
|
function to the authorisation style, according to the requirements
|
1997-01-04 16:50:08 +00:00
|
|
|
of the program handling a login itself.
|
|
|
|
.Pp
|
2003-03-24 16:02:05 +00:00
|
|
|
The
|
2004-05-11 11:05:26 +00:00
|
|
|
.Fn login_getclassbyname
|
2007-06-14 09:33:37 +00:00
|
|
|
function is the basic means to get a
|
|
|
|
.Vt login_cap_t
|
|
|
|
object.
|
|
|
|
It accepts two arguments: the first one,
|
|
|
|
.Fa name ,
|
|
|
|
is the record identifier of the
|
|
|
|
record to be retrieved; the second,
|
|
|
|
.Fa pwd ,
|
|
|
|
is an optional pointer to a
|
2007-06-14 07:31:59 +00:00
|
|
|
.Vt passwd
|
2004-05-11 11:05:26 +00:00
|
|
|
structure.
|
2007-06-14 09:33:37 +00:00
|
|
|
First of all, its arguments are used by the function
|
|
|
|
to choose between system and user modes of operation.
|
|
|
|
When in system mode, only the system login class database is used.
|
|
|
|
When in user mode, the supplemental login class database in the
|
|
|
|
user's home directory is allowed to override settings from the system
|
|
|
|
database in a limited way as noted below.
|
|
|
|
To minimize security implications, user mode is entered by
|
|
|
|
.Fn login_getclassbyname
|
|
|
|
if and only if
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa name
|
2007-06-14 09:33:37 +00:00
|
|
|
is
|
|
|
|
.Dv LOGIN_MECLASS
|
|
|
|
.Pq Ql me
|
|
|
|
and
|
|
|
|
.Fa pwd
|
|
|
|
is not
|
|
|
|
.Dv NULL .
|
|
|
|
Otherwise system mode is chosen.
|
|
|
|
.Pp
|
|
|
|
In system mode, any record in the system database
|
|
|
|
.Pa /etc/login.conf
|
|
|
|
can be accessed,
|
|
|
|
and a fallback to the default record is provided as follows.
|
|
|
|
If
|
|
|
|
.Fa name
|
|
|
|
is
|
2007-06-14 07:31:59 +00:00
|
|
|
.Dv NULL ,
|
|
|
|
an empty string, or a class that does not exist
|
2007-06-14 09:33:37 +00:00
|
|
|
in the login class database, then the
|
|
|
|
.Dv LOGIN_DEFCLASS
|
|
|
|
record
|
|
|
|
.Pq Ql default
|
|
|
|
is returned instead.
|
|
|
|
.Pp
|
|
|
|
In user mode, only the
|
|
|
|
.Dv LOGIN_MECLASS
|
|
|
|
record
|
|
|
|
.Pq Ql me
|
|
|
|
is accessed and no fallback to the
|
2007-06-14 07:31:59 +00:00
|
|
|
.Ql default
|
2007-06-14 09:33:37 +00:00
|
|
|
record is provided.
|
|
|
|
The directory specified by
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa pwd->pw_dir
|
2004-05-11 11:05:26 +00:00
|
|
|
is searched for
|
2007-06-14 07:31:59 +00:00
|
|
|
a login database file called
|
|
|
|
.Pa .login_conf ,
|
2007-06-14 09:33:37 +00:00
|
|
|
and only the
|
|
|
|
.Ql me
|
|
|
|
capability record
|
|
|
|
contained within it may override the system record with the same name
|
|
|
|
while other records are ignored.
|
|
|
|
Using this scheme, an application can explicitly
|
|
|
|
allow users to override a selected subset of login settings.
|
|
|
|
To do so, the application should obtain two
|
|
|
|
.Vt login_cap_t
|
|
|
|
objects, one in user mode and the other in system mode,
|
|
|
|
and then query the user object before the
|
|
|
|
system object for login parameters that are allowed to
|
|
|
|
be overridden by the user.
|
|
|
|
For example, the user's
|
1997-01-07 14:29:50 +00:00
|
|
|
.Pa .login_conf
|
2007-06-14 09:33:37 +00:00
|
|
|
can provide a convenient way for a user to set up their preferred
|
|
|
|
login environment before the shell is invoked on login if supported by
|
|
|
|
.Xr login 1 .
|
|
|
|
.Pp
|
2004-05-11 11:05:26 +00:00
|
|
|
Note that access to the
|
|
|
|
.Pa /etc/login.conf
|
|
|
|
and
|
|
|
|
.Pa .login_conf
|
|
|
|
files will only be performed subject to the security checks documented in
|
|
|
|
.Xr _secure_path 3
|
|
|
|
for the uids 0 and
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa pwd->pw_uid
|
2004-05-11 11:05:26 +00:00
|
|
|
respectively.
|
1997-01-04 16:50:08 +00:00
|
|
|
.Pp
|
2007-06-14 07:31:59 +00:00
|
|
|
If the specified record is
|
|
|
|
.Dv NULL ,
|
|
|
|
empty or does not exist, and the
|
|
|
|
system has no
|
|
|
|
.Ql default
|
|
|
|
record available to fall back to, there is a
|
1997-01-04 16:50:08 +00:00
|
|
|
memory allocation error or for some reason
|
|
|
|
.Xr cgetent 3
|
|
|
|
is unable to access the login capabilities database, this function
|
2007-06-14 07:31:59 +00:00
|
|
|
returns
|
|
|
|
.Dv NULL .
|
1997-01-04 16:50:08 +00:00
|
|
|
.Pp
|
|
|
|
The functions
|
2007-06-14 09:33:37 +00:00
|
|
|
.Fn login_getclass ,
|
|
|
|
.Fn login_getpwclass
|
1997-01-04 16:50:08 +00:00
|
|
|
and
|
|
|
|
.Fn login_getuserclass
|
|
|
|
retrieve the applicable login class record for the user's passwd
|
1997-05-18 09:14:11 +00:00
|
|
|
entry or class name by calling
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn login_getclassbyname .
|
2007-06-14 07:31:59 +00:00
|
|
|
On failure,
|
|
|
|
.Dv NULL
|
|
|
|
is returned.
|
1997-05-18 09:14:11 +00:00
|
|
|
The difference between these functions is that
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn login_getuserclass
|
|
|
|
includes the user's overriding
|
1997-01-07 14:29:50 +00:00
|
|
|
.Pa .login_conf
|
1999-07-20 20:46:26 +00:00
|
|
|
that exists in the user's home directory, and
|
|
|
|
.Fn login_getpwclass
|
1997-05-18 09:14:11 +00:00
|
|
|
and
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn login_getclass
|
1999-07-20 20:46:26 +00:00
|
|
|
restrict lookup only to the system login class database in
|
1997-01-04 16:50:08 +00:00
|
|
|
.Pa /etc/login.conf .
|
1999-07-14 22:36:10 +00:00
|
|
|
As explained earlier,
|
1997-05-18 09:14:11 +00:00
|
|
|
.Fn login_getpwclass
|
2007-06-14 09:33:37 +00:00
|
|
|
differs from
|
1997-05-18 09:14:11 +00:00
|
|
|
.Fn login_getclass
|
2007-06-14 07:31:59 +00:00
|
|
|
in that it allows the default class for a super-user as
|
|
|
|
.Ql root
|
1997-05-18 09:14:11 +00:00
|
|
|
if none has been specified in the password database.
|
2007-06-14 07:31:59 +00:00
|
|
|
Otherwise, if the passwd pointer is
|
|
|
|
.Dv NULL ,
|
|
|
|
or the user record
|
|
|
|
has no login class, then the system
|
|
|
|
.Ql default
|
|
|
|
entry is retrieved.
|
2007-06-14 09:33:37 +00:00
|
|
|
Essentially,
|
|
|
|
.Fn login_getclass name
|
|
|
|
is equivalent to
|
|
|
|
.Fn login_getclassbyname name NULL
|
|
|
|
and
|
|
|
|
.Fn login_getuserclass pwd
|
|
|
|
to
|
|
|
|
.Fn login_getclassbyname LOGIN_MECLASS pwd .
|
1997-01-04 16:50:08 +00:00
|
|
|
.Pp
|
2007-06-14 07:31:59 +00:00
|
|
|
Once a program no longer wishes to use a
|
|
|
|
.Vt login_cap_t
|
|
|
|
object,
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn login_close
|
|
|
|
may be called to free all resources used by the login class.
|
2003-03-24 16:02:05 +00:00
|
|
|
The
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn login_close
|
2007-06-14 07:31:59 +00:00
|
|
|
function may be passed a
|
|
|
|
.Dv NULL
|
|
|
|
pointer with no harmful side-effects.
|
1997-01-04 16:50:08 +00:00
|
|
|
.Pp
|
|
|
|
The remaining functions may be used to retrieve individual
|
|
|
|
capability records.
|
2007-06-14 07:31:59 +00:00
|
|
|
Each function takes a
|
|
|
|
.Vt login_cap_t
|
|
|
|
object as its first parameter,
|
1997-01-04 16:50:08 +00:00
|
|
|
a capability tag as the second, and remaining parameters being
|
|
|
|
default and error values that are returned if the capability is
|
|
|
|
not found.
|
|
|
|
The type of the additional parameters passed and returned depend
|
|
|
|
on the
|
|
|
|
.Em type
|
|
|
|
of capability each deals with, be it a simple string, a list,
|
|
|
|
a time value, a file or memory size value, a path (consisting of
|
|
|
|
a colon-separated list of directories) or a boolean flag.
|
|
|
|
The manpage for
|
|
|
|
.Xr login.conf 5
|
|
|
|
deals in specific tags and their type.
|
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Note that with all functions in this group, you should not call
|
1997-01-04 16:50:08 +00:00
|
|
|
.Xr free 3
|
|
|
|
on any pointers returned.
|
|
|
|
Memory allocated during retrieval or processing of capability
|
|
|
|
tags is automatically reused by subsequent calls to functions
|
|
|
|
in this group, or deallocated on calling
|
|
|
|
.Fn login_close .
|
|
|
|
.Bl -tag -width "login_getcaplist()"
|
|
|
|
.It Fn login_getcapstr
|
|
|
|
This function returns a simple string capability.
|
|
|
|
If the string is not found, then the value in
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa def
|
1997-01-04 16:50:08 +00:00
|
|
|
is returned as the default value, or if an error
|
|
|
|
occurs, the value in the
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa error
|
1997-01-04 16:50:08 +00:00
|
|
|
parameter is returned.
|
|
|
|
.It Fn login_getcaplist
|
|
|
|
This function returns the value corresponding to the named
|
2007-06-14 07:31:59 +00:00
|
|
|
capability tag as a list of values in a
|
|
|
|
.Dv NULL
|
|
|
|
terminated array.
|
1997-01-04 16:50:08 +00:00
|
|
|
Within the login class database, some tags are of type
|
2007-06-14 07:31:59 +00:00
|
|
|
.Vt list ,
|
1997-01-04 16:50:08 +00:00
|
|
|
which consist of one or more comma- or space separated
|
|
|
|
values.
|
|
|
|
Usually, this function is not called directly from an
|
|
|
|
application, but is used indirectly via
|
|
|
|
.Fn login_getstyle .
|
|
|
|
.It Fn login_getpath
|
|
|
|
This function returns a list of directories separated by colons
|
2004-12-29 02:18:24 +00:00
|
|
|
.Ql \&: .
|
1997-01-04 16:50:08 +00:00
|
|
|
Capability tags for which this function is called consist of a list of
|
|
|
|
directories separated by spaces.
|
|
|
|
.It Fn login_getcaptime
|
|
|
|
This function returns a
|
2007-06-14 07:31:59 +00:00
|
|
|
.Vt time value
|
1997-01-04 16:50:08 +00:00
|
|
|
associated with a particular capability tag with the value expressed
|
|
|
|
in seconds (the default), minutes, hours, days, weeks or (365 day)
|
|
|
|
years or any combination of these.
|
2007-06-14 07:31:59 +00:00
|
|
|
A suffix determines the units used:
|
|
|
|
.Ql S
|
|
|
|
for seconds,
|
|
|
|
.Ql M
|
|
|
|
for minutes,
|
|
|
|
.Ql H
|
|
|
|
for hours,
|
|
|
|
.Ql D
|
|
|
|
for days,
|
|
|
|
.Ql W
|
|
|
|
for weeks and
|
|
|
|
.Ql Y
|
|
|
|
for 365 day years.
|
1997-01-04 16:50:08 +00:00
|
|
|
Case of the units suffix is ignored.
|
|
|
|
.Pp
|
|
|
|
Time values are normally used for setting resource, accounting and
|
|
|
|
session limits.
|
2000-12-12 10:11:12 +00:00
|
|
|
If supported by the operating system and compiler (which is true of
|
|
|
|
.Fx ) ,
|
2007-06-14 07:31:59 +00:00
|
|
|
the value returned is a
|
|
|
|
.Vt quad
|
|
|
|
.Pq Vt long long ,
|
|
|
|
of type
|
|
|
|
.Vt rlim_t .
|
|
|
|
A value
|
|
|
|
.Ql inf
|
|
|
|
or
|
|
|
|
.Ql infinity
|
|
|
|
may be used to express an infinite
|
|
|
|
value, in which case
|
|
|
|
.Dv RLIM_INFINITY
|
|
|
|
is returned.
|
1997-01-04 16:50:08 +00:00
|
|
|
.It Fn login_getcapnum
|
|
|
|
This function returns a numeric value for a tag, expressed either as
|
2007-06-14 07:31:59 +00:00
|
|
|
.Ql tag=<value>
|
|
|
|
or the standard
|
1997-01-04 16:50:08 +00:00
|
|
|
.Fn cgetnum
|
2007-06-14 07:31:59 +00:00
|
|
|
format
|
|
|
|
.Ql tag#<value> .
|
1997-01-04 16:50:08 +00:00
|
|
|
The first format should be used in preference to the second, the
|
|
|
|
second format is provided for compatibility and consistency with the
|
|
|
|
.Xr getcap 3
|
|
|
|
database format where numeric types use the
|
|
|
|
.Ql \&#
|
|
|
|
as the delimiter for numeric values.
|
2007-06-14 07:31:59 +00:00
|
|
|
If in the first format, then the value given may be
|
|
|
|
.Ql inf
|
|
|
|
or
|
|
|
|
.Ql infinity
|
|
|
|
which results in a return value of
|
|
|
|
.Dv RLIM_INFINITY .
|
1997-01-04 16:50:08 +00:00
|
|
|
If the given capability tag cannot be found, the
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa def
|
2001-07-15 07:53:42 +00:00
|
|
|
parameter is returned, and if an error occurs, the
|
2007-06-14 07:31:59 +00:00
|
|
|
.Fa error
|
1997-01-04 16:50:08 +00:00
|
|
|
parameter is returned.
|
|
|
|
.It Fn login_getcapsize
|
|
|
|
.Fn login_getcapsize
|
1998-06-06 05:50:53 +00:00
|
|
|
returns a value representing a size (typically, file or memory)
|
1997-01-04 16:50:08 +00:00
|
|
|
which may be expressed as bytes (the default), 512 byte blocks,
|
|
|
|
kilobytes, megabytes, gigabytes, and on systems that support the
|
2007-06-14 07:31:59 +00:00
|
|
|
.Vt long long
|
1998-06-06 05:50:53 +00:00
|
|
|
type, terabytes.
|
1997-01-04 16:50:08 +00:00
|
|
|
The suffix used determines the units, and multiple values and
|
2004-07-02 23:52:20 +00:00
|
|
|
units may be used in combination (e.g.\& 1m500k = 1.5 megabytes).
|
2007-06-14 07:31:59 +00:00
|
|
|
A value with no suffix is interpreted as bytes,
|
|
|
|
.Ql B
|
|
|
|
as 512-byte blocks,
|
|
|
|
.Ql K
|
|
|
|
as kilobytes,
|
|
|
|
.Ql M
|
|
|
|
as megabytes,
|
|
|
|
.Ql G
|
|
|
|
as gigabytes and
|
|
|
|
.Ql T
|
|
|
|
as terabytes.
|
1997-01-04 16:50:08 +00:00
|
|
|
Case is ignored.
|
|
|
|
The error value is returned if there is a login capabilities database
|
|
|
|
error, if an invalid suffix is used, or if a numeric value cannot be
|
|
|
|
interpreted.
|
|
|
|
.It Fn login_getcapbool
|
|
|
|
This function returns a boolean value tied to a particular flag.
|
|
|
|
It returns 0 if the given capability tag is not present or is
|
2007-06-14 07:31:59 +00:00
|
|
|
negated by the presence of a
|
|
|
|
.Ql tag@
|
|
|
|
(see
|
1997-01-04 16:50:08 +00:00
|
|
|
.Xr getcap 3
|
|
|
|
for more information on boolean flags), and returns 1 if the tag
|
|
|
|
is found.
|
|
|
|
.It Fn login_getstyle
|
|
|
|
This function is used by the login authorisation system to determine
|
|
|
|
the style of login available in a particular case.
|
2007-06-14 07:31:59 +00:00
|
|
|
The function accepts three parameters, the
|
|
|
|
.Fa lc
|
|
|
|
entry itself and
|
|
|
|
two optional parameters, and authorisation type
|
|
|
|
.Fa auth
|
|
|
|
and
|
|
|
|
.Fa style ,
|
|
|
|
and
|
1997-01-04 16:50:08 +00:00
|
|
|
applies these to determine the authorisation style that best suites
|
|
|
|
these rules.
|
2000-12-29 14:08:20 +00:00
|
|
|
.Bl -bullet
|
1997-01-04 16:50:08 +00:00
|
|
|
.It
|
2007-06-14 07:31:59 +00:00
|
|
|
If
|
|
|
|
.Fa auth
|
|
|
|
is neither
|
|
|
|
.Dv NULL
|
|
|
|
nor an empty string, look for a tag of type
|
|
|
|
.Ql auth- Ns Fa <auth>
|
|
|
|
in the capability record.
|
|
|
|
If not present, then look for the default tag
|
|
|
|
.Va auth= .
|
1997-01-04 16:50:08 +00:00
|
|
|
.It
|
|
|
|
If no valid authorisation list was found from the previous step, then
|
2007-06-14 07:31:59 +00:00
|
|
|
default to
|
|
|
|
.Ql passwd
|
|
|
|
as the authorisation list.
|
1997-01-04 16:50:08 +00:00
|
|
|
.It
|
2007-06-14 07:31:59 +00:00
|
|
|
If
|
|
|
|
.Fa style
|
|
|
|
is not
|
|
|
|
.Dv NULL
|
|
|
|
or empty, look for it in the list of authorisation
|
2004-12-29 02:18:24 +00:00
|
|
|
methods found from the previous step.
|
2007-06-14 07:31:59 +00:00
|
|
|
If
|
|
|
|
.Fa style
|
|
|
|
is
|
|
|
|
.Dv NULL
|
|
|
|
or an empty string, then default to
|
|
|
|
.Ql passwd
|
1997-01-04 16:50:08 +00:00
|
|
|
authorisation.
|
|
|
|
.It
|
2007-06-14 07:31:59 +00:00
|
|
|
If
|
|
|
|
.Fa style
|
|
|
|
is found in the chosen list of authorisation methods, then
|
|
|
|
return that, otherwise return
|
|
|
|
.Dv NULL .
|
1997-01-04 16:50:08 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
This scheme allows the administrator to determine the types of
|
|
|
|
authorisation methods accepted by the system, depending on the
|
|
|
|
means by which the access occurs.
|
|
|
|
For example, the administrator may require skey or kerberos as
|
|
|
|
the authentication method used for access to the system via the
|
|
|
|
network, and standard methods via direct dialup or console
|
|
|
|
logins, significantly reducing the risk of password discovery
|
|
|
|
by "snooping" network packets.
|
2000-08-22 02:15:54 +00:00
|
|
|
.It Fn login_setcryptfmt
|
|
|
|
The
|
|
|
|
.Fn login_setcryptfmt
|
|
|
|
function is used to set the
|
|
|
|
.Xr crypt 3
|
|
|
|
format using the
|
2007-06-14 07:31:59 +00:00
|
|
|
.Va passwd_format
|
2000-08-22 02:15:54 +00:00
|
|
|
configuration entry.
|
|
|
|
If no entry is found,
|
|
|
|
.Fa def
|
|
|
|
is taken to be used as the fallback.
|
|
|
|
If calling
|
|
|
|
.Xr crypt_set_format 3
|
|
|
|
on the specifier fails,
|
|
|
|
.Fa error
|
|
|
|
is returned to indicate this.
|
1997-01-04 16:50:08 +00:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
2007-06-14 09:33:37 +00:00
|
|
|
.Xr login 1 ,
|
2000-08-22 02:15:54 +00:00
|
|
|
.Xr crypt 3 ,
|
1997-01-20 23:23:22 +00:00
|
|
|
.Xr getcap 3 ,
|
1997-01-04 16:50:08 +00:00
|
|
|
.Xr login_class 3 ,
|
|
|
|
.Xr login.conf 5 ,
|
1997-01-20 23:23:22 +00:00
|
|
|
.Xr termcap 5
|