git.fiddlerwoaroof.com
Browse code

formatting

Greg Wiley authored on 19/04/2017 17:48:43
Showing 20 changed files
... ...
@@ -14,3 +14,4 @@ std::vector<const std::string> convert_arguments (int nargs,
14 14
 
15 15
     return std::vector<const std::string> (temp.begin(), temp.end());
16 16
 }
17
+
... ...
@@ -78,3 +78,4 @@ int main()
78 78
 {
79 79
     return !run_tests();
80 80
 }
81
+
... ...
@@ -63,3 +63,4 @@ std::string pam_token_conversation::user_name()
63 63
 {
64 64
     return user_;
65 65
 }
66
+
... ...
@@ -7,8 +7,6 @@
7 7
 
8 8
 #include "pam.h"
9 9
 
10
-
11
-
12 10
 class conversation_result
13 11
 {
14 12
 private:
... ...
@@ -28,7 +26,6 @@ public:
28 26
     }
29 27
 };
30 28
 
31
-
32 29
 class conversations_ifc
33 30
 {
34 31
 public:
... ...
@@ -7,7 +7,6 @@
7 7
 #include "test_util.h"
8 8
 #include "pam.h"
9 9
 
10
-
11 10
 class fake_pam_conversation : public pam_conversation
12 11
 {
13 12
 private:
... ...
@@ -133,7 +132,6 @@ public:
133 132
     }
134 133
 };
135 134
 
136
-
137 135
 int returns_correct_token()
138 136
 {
139 137
     //given
... ...
@@ -158,7 +156,6 @@ int returns_correct_user_name()
158 156
                                            fake_pam_conversation ("sally:token");
159 157
     pam_p pam = (pam_p)new fake_pam (fake_conversation);
160 158
 
161
-
162 159
     //when
163 160
     pam_token_conversation conversation (pamh, pam);
164 161
 
... ...
@@ -260,7 +257,6 @@ int prompts_user_with_correct_text()
260 257
                                             match_prompt_text_conversation ("Dual control token: ");
261 258
     pam_p pam = (pam_p)new fake_pam (match_conversation);
262 259
 
263
-
264 260
     // when / then
265 261
     try {
266 262
         pam_token_conversation conversation (pamh, pam);
... ...
@@ -279,7 +275,6 @@ int prompts_user_with_correct_style()
279 275
                                             match_prompt_style_conversation (PAM_PROMPT_ECHO_OFF);
280 276
     pam_p pam = (pam_p)new fake_pam (match_conversation);
281 277
 
282
-
283 278
     // when / then
284 279
     try {
285 280
         pam_token_conversation conversation (pamh, pam);
... ...
@@ -347,4 +342,3 @@ int main (int argc, char *args[])
347 342
     return !run_tests();
348 343
 }
349 344
 
350
-
... ...
@@ -48,5 +48,3 @@ dual_control create_dual_control (const dual_control_configuration
48 48
     return dual_control (new impl (configuration));
49 49
 }
50 50
 
51
-
52
-
... ...
@@ -7,14 +7,12 @@
7 7
 #include "logger.h"
8 8
 #include "test_util.h"
9 9
 
10
-
11 10
 template<class T>
12 11
 std::shared_ptr<T> share (T *t)
13 12
 {
14 13
     return std::shared_ptr<T> (t);
15 14
 }
16 15
 
17
-
18 16
 void use_validator (dual_control_configuration &config,
19 17
                     validator_ifc *value)
20 18
 {
... ...
@@ -88,7 +86,6 @@ public:
88 86
     }
89 87
 };
90 88
 
91
-
92 89
 int setcred_returns_success()
93 90
 {
94 91
     //given
... ...
@@ -221,7 +218,6 @@ int logs_authentication_failure()
221 218
     succeed();
222 219
 }
223 220
 
224
-
225 221
 RESET_VARS_START
226 222
 RESET_VARS_END
227 223
 
... ...
@@ -241,4 +237,3 @@ int main (int argc, char *argv[])
241 237
     return !runtests();
242 238
 }
243 239
 
244
-
... ...
@@ -3,7 +3,6 @@
3 3
 #include "logging.h"
4 4
 #include "test_support.h"
5 5
 
6
-
7 6
 static const char program_name[] = "pam_dual_control";
8 7
 
9 8
 void log_success()
... ...
@@ -20,4 +19,3 @@ void log_failure()
20 19
     closelog();
21 20
 }
22 21
 
23
-
... ...
@@ -45,3 +45,4 @@ pam_p get_system_pam()
45 45
 {
46 46
     return (pam_p)new pam_impl;
47 47
 }
48
+
... ...
@@ -24,3 +24,4 @@ typedef std::shared_ptr<pam> pam_p;
24 24
 pam_p get_system_pam();
25 25
 
26 26
 #endif
27
+
... ...
@@ -25,7 +25,6 @@ FILE *fake_fopen (const char *path, const char *mode);
25 25
 char *fake_fgets (char *buf, int n, FILE *fp);
26 26
 int fake_fclose (FILE *fp);
27 27
 
28
-
29 28
 #ifdef UNIT_TEST
30 29
 // SYSLOG
31 30
 #define openlog(IDENT, LOGOPT, FACILITY) fake_openlog(IDENT, LOGOPT, FACILITY)
... ...
@@ -10,10 +10,5 @@
10 10
 #include <memory>
11 11
 #include <fstream>
12 12
 
13
-
14 13
 #include "test_support.h"
15 14
 
16
-
17
-
18
-
19
-
... ...
@@ -5,7 +5,6 @@
5 5
 
6 6
 #include "user.h"
7 7
 
8
-
9 8
 class user_token_supplier
10 9
 {
11 10
 public:
... ...
@@ -13,5 +12,5 @@ public:
13 12
 };
14 13
 typedef std::shared_ptr<user_token_supplier> user_token_supplier_p;
15 14
 
16
-
17 15
 #endif
16
+
... ...
@@ -21,7 +21,6 @@ int fake_getpwnam_r (const char *nam, struct passwd *pwd, char *buffer,
21 21
     return !ok;
22 22
 }
23 23
 
24
-
25 24
 const char *fake_stat_path = "";
26 25
 int fake_stat (const char *path, struct stat *stat)
27 26
 {
... ...
@@ -61,11 +60,8 @@ int fake_fclose (FILE *fp)
61 60
     return 0;
62 61
 }
63 62
 
64
-
65 63
 // STDIO
66 64
 
67
-
68
-
69 65
 RESET_VARS_START
70 66
 fake_user = "msmith";
71 67
 fake_user_token = "123456";
... ...
@@ -75,7 +71,6 @@ fake_fopen_path = fake_stat_path;
75 71
 fake_fopen_mode = "r";
76 72
 RESET_VARS_END
77 73
 
78
-
79 74
 int validate_compares_to_user_token()
80 75
 {
81 76
 
... ...
@@ -129,4 +124,3 @@ int main (int argc, char **argv)
129 124
     return rval;
130 125
 }
131 126
 
132
-
... ...
@@ -55,6 +55,3 @@ const std::shared_ptr<user> create_user (const std::string &user_name)
55 55
     return rval;
56 56
 }
57 57
 
58
-
59
-
60
-
... ...
@@ -12,7 +12,6 @@ public:
12 12
     //        virtual std::string home_directory() = 0;
13 13
 };
14 14
 
15
-
16 15
 typedef std::shared_ptr<user> user_p;
17 16
 class directory
18 17
 {
... ...
@@ -3,7 +3,6 @@
3 3
 #include "user.h"
4 4
 #include "test_util.h"
5 5
 
6
-
7 6
 bool gets_home_directory()
8 7
 {
9 8
     //given
... ...
@@ -21,7 +20,6 @@ bool gets_home_directory()
21 20
     return expected_home_directory == actual_home_directory;
22 21
 }
23 22
 
24
-
25 23
 std::shared_ptr<struct passwd> fake_passwd;
26 24
 int fake_getpwnam_r (const char *nam, struct passwd *pwd, char *buffer,
27 25
                      size_t bufsize, struct passwd **result)
... ...
@@ -85,5 +83,3 @@ int main (int argc, char *argv[])
85 83
     return !run_tests();
86 84
 }
87 85
 
88
-
89
-
... ...
@@ -36,7 +36,6 @@ public:
36 36
     }
37 37
 };
38 38
 
39
-
40 39
 bool validator_validates()
41 40
 {
42 41
 
... ...
@@ -48,11 +47,9 @@ bool validator_validates()
48 47
     directory_p directory (new fake_directory (user_name));
49 48
     old_validator validator (directory, user_token_supplier);
50 49
 
51
-
52 50
     // when
53 51
     bool actual = validator.validate (user_name, "token");
54 52
 
55
-
56 53
     // then
57 54
     check (actual, "should be valid");
58 55
     succeed();
... ...
@@ -68,11 +65,9 @@ bool validator_fails_unknown_user()
68 65
     directory_p directory (new fake_directory);
69 66
     old_validator validator (directory, user_token_supplier);
70 67
 
71
-
72 68
     // when
73 69
     bool actual = validator.validate ("notuser", token);
74 70
 
75
-
76 71
     // then
77 72
     check (!actual, "should not be valid");
78 73
     succeed();
... ...
@@ -87,11 +82,9 @@ bool validator_fails_incorrect_token()
87 82
     directory_p directory (new fake_directory (user_name));
88 83
     old_validator validator (directory, user_token_supplier);
89 84
 
90
-
91 85
     // when
92 86
     bool actual = validator.validate (user_name, "token");
93 87
 
94
-
95 88
     // then
96 89
     check (!actual, "should not be valid");
97 90
     succeed();