Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/libbb/obscure.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/libbb/obscure.c
r3232 r3621 77 77 78 78 /* clean up */ 79 memset(p, 0, size);79 nuke_str(p); 80 80 free(p); 81 81 … … 183 183 return 0; 184 184 } 185 186 #if ENABLE_UNIT_TEST 187 188 /* Test obscure_msg() instead of obscure() in order not to print anything. */ 189 190 static const struct passwd pw = { 191 .pw_name = (char *)"johndoe", 192 .pw_gecos = (char *)"John Doe", 193 }; 194 195 BBUNIT_DEFINE_TEST(obscure_weak_pass) 196 { 197 /* Empty password */ 198 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "", &pw)); 199 /* Pure numbers */ 200 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "23577315", &pw)); 201 /* Similar to pw_name */ 202 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "johndoe123%", &pw)); 203 /* Similar to pw_gecos, reversed */ 204 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "eoD nhoJ^44@", &pw)); 205 /* Similar to the old password */ 206 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "d4#21?'S", &pw)); 207 /* adjacent letters */ 208 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "qwerty123", &pw)); 209 /* Many similar chars */ 210 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "^33Daaaaaa1", &pw)); 211 212 BBUNIT_ENDTEST; 213 } 214 215 BBUNIT_DEFINE_TEST(obscure_strong_pass) 216 { 217 BBUNIT_ASSERT_NULL(obscure_msg("Rt4##2&:'|", "}(^#rrSX3S*22", &pw)); 218 219 BBUNIT_ENDTEST; 220 } 221 222 #endif /* ENABLE_UNIT_TEST */
Note:
See TracChangeset
for help on using the changeset viewer.