Changeset 894 in openpam
- Timestamp:
- Jan 17, 2017, 2:29:41 PM (4 years ago)
- Location:
- branches/nooath
- Files:
-
- 10 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/nooath
- Property svn:mergeinfo changed
/trunk merged: 863-867,871,874,880,883,891
- Property svn:mergeinfo changed
-
branches/nooath/lib/libpam/openpam_dispatch.c
r855 r894 41 41 42 42 #include <sys/param.h> 43 44 #include <stdint.h> 43 45 44 46 #include <security/pam_appl.h> -
branches/nooath/t
- Property svn:ignore
-
old new 4 4 Makefile.in 5 5 t_openpam_ctype 6 t_openpam_dispatch 6 7 t_openpam_readlinev 7 8 t_openpam_readword 8 t_rfc46489 9 *.log 10 10 *.trs
-
- Property svn:ignore
-
branches/nooath/t/Makefile.am
r855 r894 3 3 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/lib/libpam 4 4 5 noinst_HEADERS = t.h 5 AM_TESTS_ENVIRONMENT = \ 6 PAM_RETURN_SO=$(abs_top_builddir)/modules/pam_return/.libs/pam_return.so 7 8 noinst_HEADERS = t.h t_pam_conv.h 6 9 7 10 # tests 8 11 TESTS = 9 12 TESTS += t_openpam_ctype 13 TESTS += t_openpam_dispatch 10 14 TESTS += t_openpam_readword 11 15 TESTS += t_openpam_readlinev … … 14 18 # libt - common support code 15 19 check_LIBRARIES = libt.a 16 libt_a_SOURCES = t_main.c t_file.c 20 libt_a_SOURCES = t_main.c t_file.c t_pam_conv.c 17 21 18 22 # link with libpam and libt -
branches/nooath/t/t.h
r657 r894 33 33 #define T_H_INCLUDED 34 34 35 #if _BullseyeCoverage 36 _Pragma("BullseyeCoverage save off") 37 #endif 38 35 39 #include <security/openpam_attr.h> 36 40 … … 43 47 #define T_FUNC(n, d) \ 44 48 static int t_ ## n ## _func(void *); \ 45 static conststruct t_test t_ ## n = \49 static struct t_test t_ ## n = \ 46 50 { t_ ## n ## _func, d, NULL }; \ 47 51 static int t_ ## n ## _func(OPENPAM_UNUSED(void *arg)) … … 49 53 #define T_FUNC_ARG(n, d, a) \ 50 54 static int t_ ## n ## _func(void *); \ 51 static conststruct t_test t_ ## n = \55 static struct t_test t_ ## n = \ 52 56 { t_ ## n ## _func, d, a }; \ 53 57 static int t_ ## n ## _func(void *arg) … … 58 62 extern const char *t_progname; 59 63 60 conststruct t_test **t_prepare(int, char **);64 struct t_test **t_prepare(int, char **); 61 65 void t_cleanup(void); 62 66 -
branches/nooath/t/t_file.c
r648 r894 93 93 if (ferror(tf->file)) 94 94 err(1, "%s(): vfprintf()", __func__); 95 if (fflush(tf->file) != 0) 96 err(1, "%s(): fflush()", __func__); 95 97 return (len); 96 98 } -
branches/nooath/t/t_main.c
r651 r894 71 71 main(int argc, char *argv[]) 72 72 { 73 conststruct t_test **t_plan;73 struct t_test **t_plan; 74 74 const char *desc; 75 75 int n, pass, fail; -
branches/nooath/t/t_openpam_ctype.c
r855 r894 96 96 */ 97 97 98 static conststruct t_test *t_plan[] = {98 static struct t_test *t_plan[] = { 99 99 T(t_oc_digit), 100 100 T(t_oc_xdigit), … … 109 109 }; 110 110 111 conststruct t_test **111 struct t_test ** 112 112 t_prepare(int argc, char *argv[]) 113 113 { -
branches/nooath/t/t_openpam_dispatch.c
r867 r894 46 46 #include "t_pam_conv.h" 47 47 48 const char *pam_return_so; 49 50 T_FUNC(null, "null handle") 51 { 52 int pam_err; 53 54 #if __clang__ 55 #pragma clang diagnostic push 56 #pragma clang diagnostic ignored "-Wnonnull" 57 #elif __GNUC__ 58 #pragma GCC diagnostic push 59 #pragma GCC diagnostic ignored "-Wnonnull" 60 #endif 61 pam_err = pam_authenticate(NULL, 0); 62 #if __clang__ 63 #pragma clang diagnostic pop 64 #elif __GNUC__ 65 #pragma GCC diagnostic pop 66 #endif 67 return (pam_err == PAM_SYSTEM_ERR); 68 } 69 48 70 T_FUNC(empty_policy, "empty policy") 49 71 { … … 90 112 } 91 113 114 static struct t_pam_return_case { 115 int facility; 116 int primitive; 117 int flags; 118 struct { 119 int ctlflag; 120 int modret; 121 } mod[2]; 122 int result; 123 } t_pam_return_cases[] = { 124 { 125 PAM_AUTH, PAM_SM_AUTHENTICATE, 0, 126 { 127 { PAM_REQUIRED, PAM_SUCCESS }, 128 { PAM_REQUIRED, PAM_SUCCESS }, 129 }, 130 PAM_SUCCESS, 131 }, 132 }; 133 134 T_FUNC(mod_return, "module return value") 135 { 136 struct t_pam_return_case *tc; 137 struct t_pam_conv_script script; 138 struct pam_conv pamc; 139 struct t_file *tf; 140 pam_handle_t *pamh; 141 unsigned int i, j, n; 142 int pam_err; 143 144 memset(&script, 0, sizeof script); 145 pamc.conv = &t_pam_conv; 146 pamc.appdata_ptr = &script; 147 n = sizeof t_pam_return_cases / sizeof t_pam_return_cases[0]; 148 for (i = 0; i < n; ++i) { 149 tc = &t_pam_return_cases[i]; 150 tf = t_fopen(NULL); 151 for (j = 0; j < 2; ++j) { 152 t_fprintf(tf, "%s %s %s error=%s\n", 153 pam_facility_name[tc->facility], 154 pam_control_flag_name[tc->mod[j].ctlflag], 155 pam_return_so, 156 pam_err_name[tc->mod[j].modret]); 157 } 158 pam_err = pam_start(tf->name, "test", &pamc, &pamh); 159 t_verbose("pam_start() returned %d\n", pam_err); 160 if (pam_err != PAM_SUCCESS) 161 continue; 162 switch (tc->primitive) { 163 case PAM_SM_AUTHENTICATE: 164 pam_err = pam_authenticate(pamh, tc->flags); 165 break; 166 case PAM_SM_SETCRED: 167 pam_err = pam_setcred(pamh, tc->flags); 168 break; 169 case PAM_SM_ACCT_MGMT: 170 pam_err = pam_acct_mgmt(pamh, tc->flags); 171 break; 172 case PAM_SM_OPEN_SESSION: 173 pam_err = pam_open_session(pamh, tc->flags); 174 break; 175 case PAM_SM_CLOSE_SESSION: 176 pam_err = pam_close_session(pamh, tc->flags); 177 break; 178 case PAM_SM_CHAUTHTOK: 179 pam_err = pam_chauthtok(pamh, tc->flags); 180 break; 181 } 182 t_verbose("%s returned %d\n", 183 pam_func_name[tc->primitive], pam_err); 184 t_fclose(tf); 185 } 186 return (1); 187 } 188 92 189 93 190 … … 97 194 98 195 static struct t_test *t_plan[] = { 196 T(null), 99 197 T(empty_policy), 198 T(mod_return), 100 199 101 200 NULL … … 105 204 t_prepare(int argc, char *argv[]) 106 205 { 206 207 if ((pam_return_so = getenv("PAM_RETURN_SO")) == NULL) 208 return (NULL); 107 209 108 210 openpam_set_feature(OPENPAM_RESTRICT_MODULE_NAME, 0); -
branches/nooath/t/t_openpam_readlinev.c
r855 r894 307 307 */ 308 308 309 static conststruct t_test *t_plan[] = {309 static struct t_test *t_plan[] = { 310 310 T(empty_input), 311 311 T(empty_line), … … 324 324 }; 325 325 326 conststruct t_test **326 struct t_test ** 327 327 t_prepare(int argc, char *argv[]) 328 328 { -
branches/nooath/t/t_openpam_readword.c
r855 r894 958 958 */ 959 959 960 static conststruct t_test *t_plan[] = {960 static struct t_test *t_plan[] = { 961 961 T(empty_input), 962 962 T(empty_line), … … 1028 1028 }; 1029 1029 1030 conststruct t_test **1030 struct t_test ** 1031 1031 t_prepare(int argc, char *argv[]) 1032 1032 {
Note: See TracChangeset
for help on using the changeset viewer.