Lines 41-46
__FBSDID("$FreeBSD$");
Link Here
|
41 |
#include <sys/stat.h> |
41 |
#include <sys/stat.h> |
42 |
#include <sys/time.h> |
42 |
#include <sys/time.h> |
43 |
#include <sys/user.h> |
43 |
#include <sys/user.h> |
|
|
44 |
#include <sys/jail.h> |
44 |
|
45 |
|
45 |
#include <assert.h> |
46 |
#include <assert.h> |
46 |
#include <stdio.h> |
47 |
#include <stdio.h> |
Lines 59-64
__FBSDID("$FreeBSD$");
Link Here
|
59 |
#include <grp.h> |
60 |
#include <grp.h> |
60 |
#include <errno.h> |
61 |
#include <errno.h> |
61 |
#include <locale.h> |
62 |
#include <locale.h> |
|
|
63 |
#include <jail.h> |
62 |
|
64 |
|
63 |
#define STATUS_MATCH 0 |
65 |
#define STATUS_MATCH 0 |
64 |
#define STATUS_NOMATCH 1 |
66 |
#define STATUS_NOMATCH 1 |
Lines 78-84
enum listtype {
Link Here
|
78 |
LT_GROUP, |
80 |
LT_GROUP, |
79 |
LT_TTY, |
81 |
LT_TTY, |
80 |
LT_PGRP, |
82 |
LT_PGRP, |
81 |
LT_JID, |
83 |
LT_JID, /* jid or jname */ |
82 |
LT_SID, |
84 |
LT_SID, |
83 |
LT_CLASS |
85 |
LT_CLASS |
84 |
}; |
86 |
}; |
Lines 585-591
usage(void)
Link Here
|
585 |
|
587 |
|
586 |
fprintf(stderr, |
588 |
fprintf(stderr, |
587 |
"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n" |
589 |
"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n" |
588 |
" [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jid]\n" |
590 |
" [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jail]\n" |
589 |
" [-s sid] [-t tty] [-u euid] pattern ...\n", |
591 |
" [-s sid] [-t tty] [-u euid] pattern ...\n", |
590 |
getprogname(), ustr); |
592 |
getprogname(), ustr); |
591 |
|
593 |
|
Lines 766-780
foundtty: if ((st.st_mode & S_IFCHR) == 0)
Link Here
|
766 |
|
768 |
|
767 |
li->li_number = st.st_rdev; |
769 |
li->li_number = st.st_rdev; |
768 |
break; |
770 |
break; |
769 |
case LT_JID: |
771 |
case LT_JID: { |
|
|
772 |
int jid; |
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); |