Группа :: Доступность
Пакет: pamtester
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: pamtester-0.1.2-nulluser.patch
Скачать
Скачать
doc/pamtester.1.in | 4 +++-
src/app.c | 2 +-
src/pamtester.c | 7 ++++++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/doc/pamtester.1.in b/doc/pamtester.1.in
index c9b90d6..a042fab 100644
--- a/doc/pamtester.1.in
+++ b/doc/pamtester.1.in
@@ -8,7 +8,9 @@ pamtester - test pluggable authentication module (PAM) facility
.SH DESCRIPTION
Test pluggable authentication module (PAM) facility.
.PP
-\fIservice\fR is the PAM service name. \fIuser\fR is the name of the user account to operate with the PAM facility. The following operations are supported.
+\fIservice\fR is the PAM service name. \fIuser\fR is the name of the user account to operate with the PAM facility. Pass "" or "NULL" to skip the user name setting.
+.PP
+The following operations are supported:
.TP
authenticate
Authenticate \fIuser\fR. A conversation may subsequently take place to prompt
diff --git a/src/app.c b/src/app.c
index 9bb0aef..693bc49 100644
--- a/src/app.c
+++ b/src/app.c
@@ -210,7 +210,7 @@ int pamtester_app_run(pamtester_app_t *params)
}
if ((err = pam_start((params->service == NULL ? "": params->service),
- (params->user == NULL ? "": params->user), &conv, &pamh))) {
+ params->user, &conv, &pamh))) {
err_msg = xstrdup("Initialization failure");
pamh = NULL;
goto out;
diff --git a/src/pamtester.c b/src/pamtester.c
index c1b143e..f962b31 100644
--- a/src/pamtester.c
+++ b/src/pamtester.c
@@ -170,7 +170,12 @@ int main(int argc, const char **argv)
goto out;
}
- params.user = xstrdup(argv[op_idx++]);
+ if (0 != strcmp(argv[op_idx], "") &&
+ 0 != strcmp(argv[op_idx], "NULL"))
+ {
+ params.user = xstrdup(argv[op_idx]);
+ }
+ op_idx++;
if (op_idx >= argc) {
fprintf(stderr, "%s: specify one or more operations.\n", prog_name);