Lines 59-64
__FBSDID("$FreeBSD$");
Link Here
|
59 |
#include <grp.h> |
59 |
#include <grp.h> |
60 |
#include <errno.h> |
60 |
#include <errno.h> |
61 |
#include <locale.h> |
61 |
#include <locale.h> |
|
|
62 |
#include <jail.h> |
62 |
|
63 |
|
63 |
#define STATUS_MATCH 0 |
64 |
#define STATUS_MATCH 0 |
64 |
#define STATUS_NOMATCH 1 |
65 |
#define STATUS_NOMATCH 1 |
Lines 78-84
enum listtype {
Link Here
|
78 |
LT_GROUP, |
79 |
LT_GROUP, |
79 |
LT_TTY, |
80 |
LT_TTY, |
80 |
LT_PGRP, |
81 |
LT_PGRP, |
81 |
LT_JID, |
82 |
LT_JAIL, |
82 |
LT_SID, |
83 |
LT_SID, |
83 |
LT_CLASS |
84 |
LT_CLASS |
84 |
}; |
85 |
}; |
Lines 245-251
main(int argc, char **argv)
Link Here
|
245 |
cflags |= REG_ICASE; |
246 |
cflags |= REG_ICASE; |
246 |
break; |
247 |
break; |
247 |
case 'j': |
248 |
case 'j': |
248 |
makelist(&jidlist, LT_JID, optarg); |
249 |
makelist(&jidlist, LT_JAIL, optarg); |
249 |
criteria = 1; |
250 |
criteria = 1; |
250 |
break; |
251 |
break; |
251 |
case 'l': |
252 |
case 'l': |
Lines 585-591
usage(void)
Link Here
|
585 |
|
586 |
|
586 |
fprintf(stderr, |
587 |
fprintf(stderr, |
587 |
"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n" |
588 |
"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n" |
588 |
" [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jid]\n" |
589 |
" [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jail]\n" |
589 |
" [-s sid] [-t tty] [-u euid] pattern ...\n", |
590 |
" [-s sid] [-t tty] [-u euid] pattern ...\n", |
590 |
getprogname(), ustr); |
591 |
getprogname(), ustr); |
591 |
|
592 |
|
Lines 700-706
makelist(struct listhead *head, enum listtype type
Link Here
|
700 |
if (li->li_number == 0) |
701 |
if (li->li_number == 0) |
701 |
li->li_number = getsid(mypid); |
702 |
li->li_number = getsid(mypid); |
702 |
break; |
703 |
break; |
703 |
case LT_JID: |
704 |
case LT_JAIL: |
704 |
if (li->li_number < 0) |
705 |
if (li->li_number < 0) |
705 |
errx(STATUS_BADUSAGE, |
706 |
errx(STATUS_BADUSAGE, |
706 |
"Negative jail ID `%s'", sp); |
707 |
"Negative jail ID `%s'", sp); |
Lines 766-780
foundtty: if ((st.st_mode & S_IFCHR) == 0)
Link Here
|
766 |
|
767 |
|
767 |
li->li_number = st.st_rdev; |
768 |
li->li_number = st.st_rdev; |
768 |
break; |
769 |
break; |
769 |
case LT_JID: |
770 |
case LT_JAIL: { |
|
|
771 |
int jid; |
772 |
|
770 |
if (strcmp(sp, "none") == 0) |
773 |
if (strcmp(sp, "none") == 0) |
771 |
li->li_number = 0; |
774 |
li->li_number = 0; |
772 |
else if (strcmp(sp, "any") == 0) |
775 |
else if (strcmp(sp, "any") == 0) |
773 |
li->li_number = -1; |
776 |
li->li_number = -1; |
|
|
777 |
else if ((jid = jail_getid(sp)) != -1) |
778 |
li->li_number = jid; |
774 |
else if (*ep != '\0') |
779 |
else if (*ep != '\0') |
775 |
errx(STATUS_BADUSAGE, |
780 |
errx(STATUS_BADUSAGE, |
776 |
"Invalid jail ID `%s'", sp); |
781 |
"Invalid jail ID or name `%s'", sp); |
777 |
break; |
782 |
break; |
|
|
783 |
} |
778 |
case LT_CLASS: |
784 |
case LT_CLASS: |
779 |
li->li_number = -1; |
785 |
li->li_number = -1; |
780 |
li->li_name = strdup(sp); |
786 |
li->li_name = strdup(sp); |