mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
Changed to OpenBSD indent and function declaration style
Added display of time when logging out, to try to catch lastlog bugs
This commit is contained in:
parent
55661d99b8
commit
6e5d3475a5
34
logintest.c
34
logintest.c
@ -48,7 +48,7 @@
|
||||
|
||||
#include "loginrec.h"
|
||||
|
||||
RCSID("$Id: logintest.c,v 1.4 2000/06/13 00:29:34 andre Exp $");
|
||||
RCSID("$Id: logintest.c,v 1.5 2000/06/13 00:43:47 andre Exp $");
|
||||
|
||||
|
||||
int nologtest = 0;
|
||||
@ -57,7 +57,8 @@ int be_verbose = 0;
|
||||
|
||||
|
||||
/* Dump a logininfo to stdout. Assumes a tab size of 8 chars. */
|
||||
void dump_logininfo(struct logininfo *li, char *descname)
|
||||
void
|
||||
dump_logininfo(struct logininfo *li, char *descname)
|
||||
{
|
||||
/* yes I know how nasty this is */
|
||||
printf("struct logininfo %s = {\n\t"
|
||||
@ -80,7 +81,8 @@ void dump_logininfo(struct logininfo *li, char *descname)
|
||||
}
|
||||
|
||||
|
||||
int testAPI()
|
||||
int
|
||||
testAPI()
|
||||
{
|
||||
struct logininfo *li1;
|
||||
struct passwd *pw;
|
||||
@ -89,8 +91,8 @@ int testAPI()
|
||||
char cmdstring[256], stripline[8];
|
||||
char username[32];
|
||||
#ifdef HAVE_TIME_H
|
||||
time_t t0, t1, t2;
|
||||
char s_t0[64],s_t1[64],s_t2[64]; /* ctime() strings */
|
||||
time_t t0, t1, t2, logouttime;
|
||||
char s_t0[64],s_t1[64],s_t2[64], s_logouttime[64]; /* ctime() strings */
|
||||
#endif
|
||||
|
||||
printf("**\n** Testing the API...\n**\n");
|
||||
@ -156,8 +158,13 @@ int testAPI()
|
||||
printf("--\nWaiting for a few seconds...\n");
|
||||
sleep(2);
|
||||
|
||||
printf("Performing a logout (the root login "
|
||||
"shown above should be gone)\n"
|
||||
printf("Performing a logout ");
|
||||
#ifdef HAVE_TIME_H
|
||||
(void)time(&logouttime);
|
||||
strlcpy(s_logouttime, ctime(&logouttime), sizeof(s_logouttime));
|
||||
printf("at %d - %s", (int)logouttime, s_logouttime);
|
||||
#endif
|
||||
printf("(the root login shown above should be gone)\n"
|
||||
"If the root login hasn't gone, but another user on the same\n"
|
||||
"pty has, this is OK - we're hacking it here, and there\n"
|
||||
"shouldn't be two users on one pty in reality...\n"
|
||||
@ -199,7 +206,8 @@ int testAPI()
|
||||
} /* testAPI() */
|
||||
|
||||
|
||||
void testLineName(char *line)
|
||||
void
|
||||
testLineName(char *line)
|
||||
{
|
||||
/* have to null-terminate - these functions are designed for
|
||||
* structures with fixed-length char arrays, and don't null-term.*/
|
||||
@ -217,7 +225,9 @@ void testLineName(char *line)
|
||||
} /* testLineName() */
|
||||
|
||||
|
||||
int testOutput() {
|
||||
int
|
||||
testOutput()
|
||||
{
|
||||
printf("**\n** Testing linename functions\n**\n");
|
||||
testLineName("/dev/pts/1");
|
||||
testLineName("pts/1");
|
||||
@ -230,7 +240,8 @@ int testOutput() {
|
||||
|
||||
|
||||
/* show which options got compiled in */
|
||||
void showOptions(void)
|
||||
void
|
||||
showOptions(void)
|
||||
{
|
||||
printf("**\n** Compile-time options\n**\n");
|
||||
|
||||
@ -258,7 +269,8 @@ void showOptions(void)
|
||||
} /* showOptions() */
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
printf("Platform-independent login recording test driver\n");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user