Add command-line options to disable module and policy checks.

git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@595 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2012-04-14 14:28:35 +00:00
parent 312b5753a5
commit d4b138c0e3
2 changed files with 17 additions and 4 deletions

View File

@ -28,7 +28,7 @@
.\" .\"
.\" $Id$ .\" $Id$
.\" .\"
.Dd November 2, 2011 .Dd April 14, 2012
.Dt PAMTEST 1 .Dt PAMTEST 1
.Os .Os
.Sh NAME .Sh NAME
@ -36,7 +36,7 @@
.Nd PAM policy tester .Nd PAM policy tester
.Sh SYNOPSYS .Sh SYNOPSYS
.Nm .Nm
.Op Fl dksv .Op Fl dkMPsv
.Op Fl H Ar rhost .Op Fl H Ar rhost
.Op Fl h Ar host .Op Fl h Ar host
.Op Fl t Ar tty .Op Fl t Ar tty
@ -119,6 +119,11 @@ The default is to use the result of calling
.Xr gethostname 3 . .Xr gethostname 3 .
.It Fl k .It Fl k
Keep going even if one of the commands fails. Keep going even if one of the commands fails.
.It Fl M
Disable path, ownership and permission checks on module files.
.It Fl P
Disable service name validation and path, ownership and permission
checks on policy files.
.It Fl s .It Fl s
Set the Set the
.Dv PAM_SILENT .Dv PAM_SILENT

View File

@ -265,7 +265,7 @@ usage(void)
{ {
fprintf(stderr, "usage: pamtest %s service command ...\n", fprintf(stderr, "usage: pamtest %s service command ...\n",
"[-dksv] [-H rhost] [-h host] [-t tty] [-U ruser] [-u user]"); "[-dkMPsv] [-H rhost] [-h host] [-t tty] [-U ruser] [-u user]");
exit(1); exit(1);
} }
@ -300,7 +300,7 @@ main(int argc, char *argv[])
int pame; int pame;
int opt; int opt;
while ((opt = getopt(argc, argv, "dH:h:kst:U:u:v")) != -1) while ((opt = getopt(argc, argv, "dH:h:kMPst:U:u:v")) != -1)
switch (opt) { switch (opt) {
case 'd': case 'd':
openpam_debug++; openpam_debug++;
@ -314,6 +314,14 @@ main(int argc, char *argv[])
case 'k': case 'k':
keepatit = 1; keepatit = 1;
break; break;
case 'M':
openpam_set_feature(OPENPAM_RESTRICT_MODULE_NAME, 0);
openpam_set_feature(OPENPAM_VERIFY_MODULE_FILE, 0);
break;
case 'P':
openpam_set_feature(OPENPAM_RESTRICT_SERVICE_NAME, 0);
openpam_set_feature(OPENPAM_VERIFY_POLICY_FILE, 0);
break;
case 's': case 's':
silent = PAM_SILENT; silent = PAM_SILENT;
break; break;