git.fiddlerwoaroof.com
Browse code

change syslog message

Greg Wiley authored on 05/04/2017 22:37:20
Showing 3 changed files
... ...
@@ -6,7 +6,7 @@ static const char program_name[] = "pam_dual_control";
6 6
 
7 7
 void log_success() {
8 8
     dc_openlog(program_name, 0, LOG_AUTHPRIV);
9
-    dc_syslog(LOG_NOTICE, "Logged: ");
9
+    dc_syslog(LOG_NOTICE, "dual control succeeded");
10 10
     dc_closelog();
11 11
 }
12 12
 
13 13
Binary files a/logging_test and b/logging_test differ
... ...
@@ -5,8 +5,10 @@
5 5
 #include "logging.h"
6 6
 
7 7
 int test_priority = -1000;
8
+const char *logged_message = "";
8 9
 void dc_syslog(int priority, const char *message, ...) {
9 10
     test_priority = priority;
11
+    logged_message = message;
10 12
 }
11 13
 
12 14
 void dc_closelog(void) {
... ...
@@ -36,6 +38,7 @@ int test_log_success() {
36 38
     opened_program_name = "";
37 39
     opened_logopt = -1000;
38 40
     test_priority = -1000;
41
+    logged_message = "";
39 42
 
40 43
     // when
41 44
     log_success();
... ...
@@ -45,6 +48,7 @@ int test_log_success() {
45 48
     check(!strcmp(opened_program_name, "pam_dual_control"), "incorrect program name");
46 49
     check(opened_logopt == 0, "incorrect log option");
47 50
     check(test_priority == LOG_NOTICE, "incorrect priority");
51
+    check(!strcmp(logged_message, "dual control succeeded"), "incorrect logged message");
48 52
 
49 53
     succeed();
50 54
 }