* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/**
+/**
** logintest.c: simple test driver for platform-independent login recording
** and lastlog retrieval
**/
RCSID("$Id$");
+#ifdef HAVE___PROGNAME
+extern char *__progname;
+#else
+char *__progname;
+#endif
#define PAUSE_BEFORE_LOGOUT 3
"\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);
}
if (nologtest)
return 1;
-
+
line_stripname(stripline, li1->line, sizeof(stripline));
printf("Performing an invalid login attempt (no type field)\n--\n");
#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);
#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);
/* 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");
{
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() */