xref: /openbsd-src/usr.bin/getcap/getcap.1 (revision 647427d6f39b02be77397484b468d703ecda3237)
1*647427d6Sderaadt.\"	$OpenBSD: getcap.1,v 1.6 2019/09/02 21:18:41 deraadt Exp $
286976e7dSmillert.\"
3bf198cc6Smillert.\" Copyright (c) 2005 Todd C. Miller <millert@openbsd.org>
486976e7dSmillert.\"
586976e7dSmillert.\" Permission to use, copy, modify, and distribute this software for any
686976e7dSmillert.\" purpose with or without fee is hereby granted, provided that the above
786976e7dSmillert.\" copyright notice and this permission notice appear in all copies.
886976e7dSmillert.\"
986976e7dSmillert.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1086976e7dSmillert.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1186976e7dSmillert.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1286976e7dSmillert.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1386976e7dSmillert.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1486976e7dSmillert.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1586976e7dSmillert.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1686976e7dSmillert.\"
17*647427d6Sderaadt.Dd $Mdocdate: September 2 2019 $
1886976e7dSmillert.Dt GETCAP 1
1986976e7dSmillert.Os
2086976e7dSmillert.Sh NAME
2186976e7dSmillert.Nm getcap
2286976e7dSmillert.Nd capability database access utility
2386976e7dSmillert.Sh SYNOPSIS
2486976e7dSmillert.Nm getcap
2586976e7dSmillert.Oo
2686976e7dSmillert.Fl b Ar boolean | Fl c Ar capability |
2786976e7dSmillert.Fl n Ar number | Fl s Ar string
2886976e7dSmillert.Oc
2986976e7dSmillert.Fl f Ar path
30fbfb0fafSschwarze.Fl a | Ar record ...
3186976e7dSmillert.Sh DESCRIPTION
3286976e7dSmillertThe
3386976e7dSmillert.Nm
34f1599580Sjmcutility provides a simple method for querying a capability database such as
3586976e7dSmillert.Pa /etc/login.conf
3686976e7dSmillertor
3786976e7dSmillert.Pa /etc/printcap
3886976e7dSmillertand as described by
39*647427d6Sderaadt.Xr cgetent 3 .
4086976e7dSmillert.Pp
4186976e7dSmillertThe following query types are supported:
4286976e7dSmillert.Bl -tag -width "capability"
4386976e7dSmillert.It boolean
4486976e7dSmillertA boolean flag.
4586976e7dSmillertFor each matching record, the name of the boolean capability is printed
4686976e7dSmillert(since there is no value per se).
4786976e7dSmillert.It number
4886976e7dSmillertA numeric capability (key#number).
4986976e7dSmillertFor each matching record, the value of the numeric capability is printed
5086976e7dSmillertas a decimal number.
5186976e7dSmillertTo print a number in the same format as it is listed in the
5286976e7dSmillertcapabilities database (i.e. literally), use a
5386976e7dSmillert.Dq raw
5486976e7dSmillertquery instead.
5586976e7dSmillert.It string
5686976e7dSmillertA string capability (key=value).
57f1599580SjmcNote that the value printed has escape sequences expanded: see
58*647427d6Sderaadt.Xr cgetent 3
5986976e7dSmillertfor a list of valid escape sequences.
6086976e7dSmillertTo print the string exactly as it is listed in the
6186976e7dSmillertcapabilities database, use a
6286976e7dSmillert.Dq raw
6386976e7dSmillertquery instead.
6486976e7dSmillert.It raw
6586976e7dSmillertA generic query where no interpretation of the data is done.
6686976e7dSmillertUse this for querying capabilities with non-standard types or
6786976e7dSmillertfor getting the raw, unformatted entry from the database.
6886976e7dSmillert.El
6986976e7dSmillert.Pp
7086976e7dSmillert.Nm
71f1599580Sjmcprints the value associated with the given key.
7286976e7dSmillertIf more than one record is being searched, the value is prefixed
7386976e7dSmillertwith the record name (for records with multiple names, only the
7486976e7dSmillertfirst is printed).
7586976e7dSmillertIf a key has no associated value and a boolean query is not being
7686976e7dSmillertperformed, a blank line will be printed.
7786976e7dSmillert.Pp
7886976e7dSmillertThe options are as follows:
7986976e7dSmillert.Bl -tag -width "-c capability"
8086976e7dSmillert.It Fl a
8186976e7dSmillertQuery all records in the database.
8286976e7dSmillert.It Fl b Ar boolean
8386976e7dSmillertReturn occurrences of
8486976e7dSmillert.Ar boolean .
8586976e7dSmillert.It Fl c Ar capability
8686976e7dSmillertReturn the raw value for the key
8786976e7dSmillert.Ar capability ,
88f1599580Sjmcwhich must include the type as the last character, e.g.\&
8986976e7dSmillert.Dq foo=
9086976e7dSmillertfor the string
9186976e7dSmillert.Sq foo .
9286976e7dSmillertSee
93*647427d6Sderaadt.Xr cgetent 3
9486976e7dSmillertfor more information on capability types.
9586976e7dSmillert.It Fl f Ar path
9686976e7dSmillertA colon-separated list of database filenames to be searched for records.
9786976e7dSmillert.It Fl n Ar number
9886976e7dSmillertReturn occurrences of
9986976e7dSmillert.Ar number .
10086976e7dSmillert.It Fl s Ar string
10186976e7dSmillertReturn occurrences of the string
10286976e7dSmillert.Ar string .
10386976e7dSmillert.El
10486976e7dSmillert.Pp
10586976e7dSmillertOnly one of the
10686976e7dSmillert.Fl b ,
10786976e7dSmillert.Fl c ,
108f1599580Sjmc.Fl n ,
10986976e7dSmillertand
11086976e7dSmillert.Fl s
11186976e7dSmillertoptions may be specified.
112f1599580SjmcIf none are specified, the record will be dumped from the database as is.
11386976e7dSmillert.Sh FILES
114f1599580Sjmc.Bl -tag -width "/etc/login.confXX" -compact
11586976e7dSmillert.It Pa /etc/login.conf
11686976e7dSmillertlogin configuration
11786976e7dSmillert.It Pa /etc/printcap
11886976e7dSmillertprinter configuration
11986976e7dSmillert.It Pa /etc/termcap
12086976e7dSmillertterminal configuration
12186976e7dSmillert.El
12286976e7dSmillert.Sh EXAMPLES
12386976e7dSmillertFind all
12486976e7dSmillert.Xr login.conf 5
12586976e7dSmillertentries with the
12686976e7dSmillert.Dq ignorenologin
12786976e7dSmillertcapability:
12886976e7dSmillert.Pp
12986976e7dSmillert.Dl "$ getcap -f /etc/login.conf -a -b ignorenologin"
13086976e7dSmillert.Pp
13186976e7dSmillertDump the
13286976e7dSmillert.Dq default
13386976e7dSmillertrecord in
13486976e7dSmillert.Xr login.conf 5 :
13586976e7dSmillert.Pp
13686976e7dSmillert.Dl "$ getcap -f /etc/login.conf default"
13786976e7dSmillert.Pp
13886976e7dSmillertPrint all
139f1599580Sjmc.Xr login.conf 5
14086976e7dSmillertrecords with the
14186976e7dSmillert.Dq localcipher
14286976e7dSmillertcapability:
14386976e7dSmillert.Pp
14486976e7dSmillert.Dl "$ getcap -f /etc/login.conf -a -s localcipher"
14586976e7dSmillert.Pp
14686976e7dSmillertPrint the
14786976e7dSmillert.Dq datasize-max
14886976e7dSmillertcapability in the
14986976e7dSmillert.Dq staff
15086976e7dSmillertrecord in
15186976e7dSmillert.Xr login.conf 5
15286976e7dSmillertif it exists:
15386976e7dSmillert.Pp
15486976e7dSmillert.Dl "$ getcap -f /etc/login.conf -s datasize-max staff"
15586976e7dSmillert.Pp
15686976e7dSmillertPrint all
15786976e7dSmillert.Xr printcap 5
15886976e7dSmillertentries that reference
15986976e7dSmillert.Pa /dev/lp .
16086976e7dSmillertNote that we are treating the entire string
16186976e7dSmillert.Dq lp=/dev/lp
16286976e7dSmillertas a boolean flag instead of a key/value pair.
16386976e7dSmillert.Pp
16486976e7dSmillert.Dl "$ getcap -f /etc/printcap -a -b lp=/dev/lp"
16586976e7dSmillert.Sh SEE ALSO
16686976e7dSmillert.Xr cap_mkdb 1 ,
167*647427d6Sderaadt.Xr cgetent 3 ,
16886976e7dSmillert.Xr login.conf 5 ,
16986976e7dSmillert.Xr printcap 5 ,
17086976e7dSmillert.Xr termcap 5
17186976e7dSmillert.Sh HISTORY
17286976e7dSmillertThe
17386976e7dSmillert.Nm
17486976e7dSmillertcommand appeared in
17586976e7dSmillert.Ox 3.7 .
17686976e7dSmillert.Sh AUTHORS
177f1599580Sjmc.An Todd C. Miller
178