diff --git a/greeter/autotests/fakekcheckpass.c b/greeter/autotests/fakekcheckpass.c --- a/greeter/autotests/fakekcheckpass.c +++ b/greeter/autotests/fakekcheckpass.c @@ -216,7 +216,6 @@ const char *caller = KSCREENSAVER_PAM_SERVICE; #endif const char *method = "classic"; - const char *username = 0; int c, nfd; #ifdef HAVE_OSF_C2_PASSWD @@ -239,7 +238,7 @@ havetty = isatty(0); - while ((c = getopt(argc, argv, "hc:m:U:S:")) != -1) { + while ((c = getopt(argc, argv, "hc:m:S:")) != -1) { switch (c) { case 'c': #ifdef HAVE_PAM @@ -249,9 +248,6 @@ case 'm': method = optarg; break; - case 'U': - username = optarg; - break; case 'S': sfd = atoi(optarg); break; diff --git a/kcheckpass/kcheckpass.c b/kcheckpass/kcheckpass.c --- a/kcheckpass/kcheckpass.c +++ b/kcheckpass/kcheckpass.c @@ -292,10 +292,9 @@ usage(int exitval) { message( - "usage: kcheckpass {-h|[-c caller] [-m method] [-U username|-S handle]}\n" + "usage: kcheckpass {-h|[-c caller] [-m method] [-S handle]}\n" " options:\n" " -h this help message\n" - " -U username authenticate the specified user instead of current user\n" " -S handle operate in binary server mode on file descriptor handle\n" " -c caller the calling application, effectively the PAM service basename\n" " -m method use the specified authentication method (default: \"classic\")\n" @@ -351,7 +350,7 @@ havetty = isatty(0); - while ((c = getopt(argc, argv, "hc:m:U:S:")) != -1) { + while ((c = getopt(argc, argv, "hc:m:S:")) != -1) { switch (c) { case 'h': usage(0); @@ -364,9 +363,6 @@ case 'm': method = optarg; break; - case 'U': - username = optarg; - break; case 'S': sfd = atoi(optarg); break; @@ -377,17 +373,15 @@ } uid = getuid(); - if (!username) { - if (!(p = getenv("LOGNAME")) || !(pw = getpwnam(p)) || pw->pw_uid != uid) - if (!(p = getenv("USER")) || !(pw = getpwnam(p)) || pw->pw_uid != uid) - if (!(pw = getpwuid(uid))) { - message("Cannot determinate current user\n"); - return AuthError; - } - if (!(username = strdup(pw->pw_name))) { - message("Out of memory\n"); - return AuthError; - } + if (!(p = getenv("LOGNAME")) || !(pw = getpwnam(p)) || pw->pw_uid != uid) + if (!(p = getenv("USER")) || !(pw = getpwnam(p)) || pw->pw_uid != uid) + if (!(pw = getpwuid(uid))) { + message("Cannot determinate current user\n"); + return AuthError; + } + if (!(username = strdup(pw->pw_name))) { + message("Out of memory\n"); + return AuthError; } /* Now do the fandango */