[Cvs-nserver-commits] CVS: cvs-nserver/src chkpwd-audit-log.c,1.1.2.3,1.1.2.4
Brought to you by:
tyranny
From: Alexey M. <ty...@us...> - 2002-05-25 15:57:54
|
Update of /cvsroot/cvs-nserver/cvs-nserver/src In directory usw-pr-cvs1:/tmp/cvs-serv1262 Modified Files: Tag: NCLI-1-11-1 chkpwd-audit-log.c Log Message: Update to reflect changes in audit-log.[ch] Index: chkpwd-audit-log.c =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/src/Attic/chkpwd-audit-log.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -d -r1.1.2.3 -r1.1.2.4 --- chkpwd-audit-log.c 23 May 2002 23:13:27 -0000 1.1.2.3 +++ chkpwd-audit-log.c 25 May 2002 15:57:49 -0000 1.1.2.4 @@ -27,7 +27,6 @@ #include <string.h> #include <sys/types.h> #include <sys/wait.h> -#include <time.h> #include <unistd.h> #include "audit-log.h" @@ -67,13 +66,7 @@ main (int argc, char** argv) { char* logging_helper; - struct stringbuf* auth_line; - char timestamp[16]; - char pid_as_string[16]; int pid; - char* ip_address; - char* repository; - char* username; /* process command-line options */ opterr = 0; @@ -139,44 +132,9 @@ exit(2); } - auth_line = new_stringbuf("auth "); - if (!auth_line) + if (!start_audit_log_line("auth")) goto nomem; - /* timestamp */ - snprintf(timestamp, sizeof(timestamp) - 1, "%lu", (unsigned long) time(NULL)); - cat_stringbuf(auth_line, timestamp); - catc_stringbuf(auth_line, ' '); - - /* pid */ - snprintf(pid_as_string, sizeof(pid_as_string) - 1, "%u", (unsigned int) getpid()); - cat_stringbuf(auth_line, pid_as_string); - catc_stringbuf(auth_line, ' '); - - /* IP address */ - ip_address = get_client_ip_address(); - if (!ip_address) { - fprintf(stderr, "Error getting client IP address: %s\n", strerror(errno)); - exit(111); - } - cat_stringbuf(auth_line, ip_address); - catc_stringbuf(auth_line, ' '); - - /* repository*/ - /* we are running under the cvs-pserver, so the $REPOSITORY is always set */ - repository = getenv("REPOSITORY"); - if (repository == NULL) - repository = "***UNKNOWN***"; - cat_stringbuf(auth_line, repository); - catc_stringbuf(auth_line, ' '); - - /* username */ - username = getenv("CVSUSER"); - if (username == NULL) - username = "***UNKNOWN***"; - cat_stringbuf(auth_line, username); - catc_stringbuf(auth_line, ' '); - /* Order of logging the event and running the program (which is @@ -195,8 +153,8 @@ */ if (opt_log_success) { - cat_stringbuf(auth_line, "success"); - log_audit_event(auth_line->buf); + append_audit_log_line("success"); + log_audit_event(); } pid = fork(); @@ -219,8 +177,8 @@ } else { /* if checkpassword returned 1 */ if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { - cat_stringbuf(auth_line, "failure"); - log_audit_event(auth_line->buf); + append_audit_log_line("failure"); + log_audit_event(); } exit(WEXITSTATUS(status)); } |