From d400af51fa7d0d04c949abbcf554d99667787874 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sat, 20 Sep 2008 20:20:19 +0000 Subject: [PATCH] * src/login.c, man/login.1.xml: the username is not an optional parameter of -f. Fix the getopt optstring, remove the parsing of username in the -f processing block, and remove unnecessary checks (username cannot be parsed twice anymore), better documentation of the synopsis. --- ChangeLog | 5 +++++ man/login.1.xml | 17 ++++++++++++----- src/login.c | 20 +------------------- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 586a5be2..8cd81110 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,11 @@ sections. * src/login.c: Erase the username later since it it used for the fake password check (in case of empty password). + * src/login.c, man/login.1.xml: the username is not an optional + parameter of -f. Fix the getopt optstring, remove the parsing of + username in the -f processing block, and remove unnecessary checks + (username cannot be parsed twice anymore), better documentation of + the synopsis. 2008-09-20 Nicolas François diff --git a/man/login.1.xml b/man/login.1.xml index 2380f242..a789f9a1 100644 --- a/man/login.1.xml +++ b/man/login.1.xml @@ -50,20 +50,22 @@ login - -p + -p + -h host username ENV=VAR login - -p + -p -h host - -f username + -f + username login - -p + -p -r host @@ -161,7 +163,12 @@ - Do not perform authentication, user is preauthenticated. + + Do not perform authentication, user is preauthenticated. + + + Note: In that case, username is + mandatory. diff --git a/src/login.c b/src/login.c index eb500825..2b4d8482 100644 --- a/src/login.c +++ b/src/login.c @@ -265,27 +265,13 @@ static void process_flags (int argc, char *const *argv) /* * Process options. */ - while ((flag = getopt (argc, argv, "d:f::h:pr:")) != EOF) { + while ((flag = getopt (argc, argv, "d:fh:pr:")) != EOF) { switch (flag) { case 'd': /* "-d device" ignored for compatibility */ break; case 'f': - /* - * username must be a separate token - * (-f root, *not* -froot). --marekm - * - * if -f has an arg, use that, else use the - * normal user name passed after all options - * --benc - */ - if (optarg != NULL && optarg != argv[optind - 1]) { - usage (); - } fflg = true; - if (optarg) { - username = xstrdup (optarg); - } break; case 'h': hflg = true; @@ -330,10 +316,6 @@ static void process_flags (int argc, char *const *argv) * Get the user name. */ if (optind < argc) { - if (rflg || (fflg && (NULL != username))) { - usage (); - } - username = xstrdup (argv[optind]); strzero (argv[optind]); ++optind;