X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/4fc05dfe1a090a70b874fdf744ebabdad2867fdc..0073b70fa18e81070f70ab64bc95d89f866b23fe:/logintest.c diff --git a/logintest.c b/logintest.c index e942bbef..aa3f5f41 100644 --- a/logintest.c +++ b/logintest.c @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/** +/** ** logintest.c: simple test driver for platform-independent login recording ** and lastlog retrieval **/ @@ -50,6 +50,11 @@ RCSID("$Id$"); +#ifdef HAVE___PROGNAME +extern char *__progname; +#else +char *__progname; +#endif #define PAUSE_BEFORE_LOGOUT 3 @@ -74,10 +79,10 @@ dump_logininfo(struct logininfo *li, char *descname) "\t\t\tfamily\t%d\n\t\t}\n" "\t}\n" "}\n", - descname, li->progname, li->type, + descname, li->progname, li->type, li->pid, li->uid, li->line, - li->username, li->hostname, li->exit, - li->termination, li->tv_sec, li->tv_usec, + li->username, li->hostname, li->exit, + li->termination, li->tv_sec, li->tv_usec, li->hostaddr.sa.sa_family); } @@ -134,7 +139,7 @@ testAPI() if (nologtest) return 1; - + line_stripname(stripline, li1->line, sizeof(stripline)); printf("Performing an invalid login attempt (no type field)\n--\n"); @@ -159,11 +164,11 @@ testAPI() #endif printf("--\n"); login_login(li1); - + snprintf(cmdstring, sizeof(cmdstring), "who | grep '%s '", stripline); system(cmdstring); - + printf("--\nPausing for %d second(s)...\n", PAUSE_BEFORE_LOGOUT); sleep(PAUSE_BEFORE_LOGOUT); @@ -205,12 +210,12 @@ testAPI() #endif printf("--\nThe output of 'last' shown next should have " - "an entry for root \n on %s for the time shown above:\n--\n", + "an entry for root \n on %s for the time shown above:\n--\n", stripline); snprintf(cmdstring, sizeof(cmdstring), "last | grep '%s ' | head -3", stripline); system(cmdstring); - + printf("--\nEnd of login test.\n"); login_free_entry(li1); @@ -255,9 +260,9 @@ testOutput() /* show which options got compiled in */ void showOptions(void) -{ +{ printf("**\n** Compile-time options\n**\n"); - + printf("login recording methods selected:\n"); #ifdef USE_LOGIN printf("\tUSE_LOGIN\n"); @@ -287,23 +292,24 @@ main(int argc, char *argv[]) { printf("Platform-independent login recording test driver\n"); + __progname = get_progname(argv[0]); if (argc == 2) { if (strncmp(argv[1], "-i", 3) == 0) compile_opts_only = 1; else if (strncmp(argv[1], "-v", 3) == 0) be_verbose=1; } - + if (!compile_opts_only) { if (be_verbose && !testOutput()) return 1; - + if (!testAPI()) return 1; } showOptions(); - + return 0; } /* main() */