diff options
Diffstat (limited to 'logintest.c')
-rw-r--r-- | logintest.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/logintest.c b/logintest.c index 886052313..302034da0 100644 --- a/logintest.c +++ b/logintest.c | |||
@@ -27,7 +27,7 @@ | |||
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | /** | 30 | /** |
31 | ** logintest.c: simple test driver for platform-independent login recording | 31 | ** logintest.c: simple test driver for platform-independent login recording |
32 | ** and lastlog retrieval | 32 | ** and lastlog retrieval |
33 | **/ | 33 | **/ |
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | #include "loginrec.h" | 49 | #include "loginrec.h" |
50 | 50 | ||
51 | RCSID("$Id: logintest.c,v 1.6 2000/06/19 08:25:36 andre Exp $"); | 51 | RCSID("$Id: logintest.c,v 1.7 2001/02/05 12:42:18 stevesk Exp $"); |
52 | 52 | ||
53 | 53 | ||
54 | #define PAUSE_BEFORE_LOGOUT 3 | 54 | #define PAUSE_BEFORE_LOGOUT 3 |
@@ -74,10 +74,10 @@ dump_logininfo(struct logininfo *li, char *descname) | |||
74 | "\t\t\tfamily\t%d\n\t\t}\n" | 74 | "\t\t\tfamily\t%d\n\t\t}\n" |
75 | "\t}\n" | 75 | "\t}\n" |
76 | "}\n", | 76 | "}\n", |
77 | descname, li->progname, li->type, | 77 | descname, li->progname, li->type, |
78 | li->pid, li->uid, li->line, | 78 | li->pid, li->uid, li->line, |
79 | li->username, li->hostname, li->exit, | 79 | li->username, li->hostname, li->exit, |
80 | li->termination, li->tv_sec, li->tv_usec, | 80 | li->termination, li->tv_sec, li->tv_usec, |
81 | li->hostaddr.sa.sa_family); | 81 | li->hostaddr.sa.sa_family); |
82 | } | 82 | } |
83 | 83 | ||
@@ -134,7 +134,7 @@ testAPI() | |||
134 | 134 | ||
135 | if (nologtest) | 135 | if (nologtest) |
136 | return 1; | 136 | return 1; |
137 | 137 | ||
138 | line_stripname(stripline, li1->line, sizeof(stripline)); | 138 | line_stripname(stripline, li1->line, sizeof(stripline)); |
139 | 139 | ||
140 | printf("Performing an invalid login attempt (no type field)\n--\n"); | 140 | printf("Performing an invalid login attempt (no type field)\n--\n"); |
@@ -159,11 +159,11 @@ testAPI() | |||
159 | #endif | 159 | #endif |
160 | printf("--\n"); | 160 | printf("--\n"); |
161 | login_login(li1); | 161 | login_login(li1); |
162 | 162 | ||
163 | snprintf(cmdstring, sizeof(cmdstring), "who | grep '%s '", | 163 | snprintf(cmdstring, sizeof(cmdstring), "who | grep '%s '", |
164 | stripline); | 164 | stripline); |
165 | system(cmdstring); | 165 | system(cmdstring); |
166 | 166 | ||
167 | printf("--\nPausing for %d second(s)...\n", PAUSE_BEFORE_LOGOUT); | 167 | printf("--\nPausing for %d second(s)...\n", PAUSE_BEFORE_LOGOUT); |
168 | sleep(PAUSE_BEFORE_LOGOUT); | 168 | sleep(PAUSE_BEFORE_LOGOUT); |
169 | 169 | ||
@@ -205,12 +205,12 @@ testAPI() | |||
205 | #endif | 205 | #endif |
206 | 206 | ||
207 | printf("--\nThe output of 'last' shown next should have " | 207 | printf("--\nThe output of 'last' shown next should have " |
208 | "an entry for root \n on %s for the time shown above:\n--\n", | 208 | "an entry for root \n on %s for the time shown above:\n--\n", |
209 | stripline); | 209 | stripline); |
210 | snprintf(cmdstring, sizeof(cmdstring), "last | grep '%s ' | head -3", | 210 | snprintf(cmdstring, sizeof(cmdstring), "last | grep '%s ' | head -3", |
211 | stripline); | 211 | stripline); |
212 | system(cmdstring); | 212 | system(cmdstring); |
213 | 213 | ||
214 | printf("--\nEnd of login test.\n"); | 214 | printf("--\nEnd of login test.\n"); |
215 | 215 | ||
216 | login_free_entry(li1); | 216 | login_free_entry(li1); |
@@ -255,9 +255,9 @@ testOutput() | |||
255 | /* show which options got compiled in */ | 255 | /* show which options got compiled in */ |
256 | void | 256 | void |
257 | showOptions(void) | 257 | showOptions(void) |
258 | { | 258 | { |
259 | printf("**\n** Compile-time options\n**\n"); | 259 | printf("**\n** Compile-time options\n**\n"); |
260 | 260 | ||
261 | printf("login recording methods selected:\n"); | 261 | printf("login recording methods selected:\n"); |
262 | #ifdef USE_LOGIN | 262 | #ifdef USE_LOGIN |
263 | printf("\tUSE_LOGIN\n"); | 263 | printf("\tUSE_LOGIN\n"); |
@@ -293,17 +293,17 @@ main(int argc, char *argv[]) | |||
293 | else if (strncmp(argv[1], "-v", 3) == 0) | 293 | else if (strncmp(argv[1], "-v", 3) == 0) |
294 | be_verbose=1; | 294 | be_verbose=1; |
295 | } | 295 | } |
296 | 296 | ||
297 | if (!compile_opts_only) { | 297 | if (!compile_opts_only) { |
298 | if (be_verbose && !testOutput()) | 298 | if (be_verbose && !testOutput()) |
299 | return 1; | 299 | return 1; |
300 | 300 | ||
301 | if (!testAPI()) | 301 | if (!testAPI()) |
302 | return 1; | 302 | return 1; |
303 | } | 303 | } |
304 | 304 | ||
305 | showOptions(); | 305 | showOptions(); |
306 | 306 | ||
307 | return 0; | 307 | return 0; |
308 | } /* main() */ | 308 | } /* main() */ |
309 | 309 | ||