- Timestamp:
- Feb 17, 2009, 10:37:42 PM (16 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/samhain_setpwd.c
r171 r212 252 252 if (argc < 4) 253 253 { 254 fprintf (stderr, _("\nUsage: samhain_setpwd <filename> <suffix> "\254 fprintf (stderr, "%s", _("\nUsage: samhain_setpwd <filename> <suffix> "\ 255 255 "<new_password>\n\n")); 256 fprintf (stderr, _(" This program is a utility that will:\n"));257 fprintf (stderr, _(" - search in the binary executable <filename>"\258 " for samhain's\n"));259 fprintf (stderr, _(" compiled-in default password,\n"));260 fprintf (stderr, _(" - change it to <new_password>,\n"));261 fprintf (stderr, _(" - and output the modified binary to "\256 fprintf (stderr, "%s", _(" This program is a utility that will:\n")); 257 fprintf (stderr, "%s", _(" - search in the binary executable "\ 258 "<filename> for samhain's\n")); 259 fprintf (stderr, "%s", _(" compiled-in default password,\n")); 260 fprintf (stderr, "%s", _(" - change it to <new_password>,\n")); 261 fprintf (stderr, "%s", _(" - and output the modified binary to "\ 262 262 "<filename>.<suffix>\n\n")); 263 fprintf (stderr, _(" To allow for non-printable chars, "\263 fprintf (stderr, "%s", _(" To allow for non-printable chars, "\ 264 264 "<new_password> must be\n")); 265 fprintf (stderr, _(" a 16-digit hexadecimal "\265 fprintf (stderr, "%s", _(" a 16-digit hexadecimal "\ 266 266 "number (only 0-9,A-F allowed in input),\n")); 267 fprintf (stderr, _(" thus corresponding"\267 fprintf (stderr, "%s", _(" thus corresponding"\ 268 268 " to an 8-byte password.\n\n")); 269 fprintf (stderr, _(" Example: 'samhain_setpwd samhain new "\269 fprintf (stderr, "%s", _(" Example: 'samhain_setpwd samhain new "\ 270 270 "4142434445464748'\n")); 271 fprintf (stderr, _(" takes the file 'samhain', sets the password to"\272 " 'ABCDEFGH'\n"));273 fprintf (stderr, _(" ('A' = 41 hex, 'B' = 42 hex, ...) "\271 fprintf (stderr, "%s", _(" takes the file 'samhain', sets the "\ 272 "password to 'ABCDEFGH'\n")); 273 fprintf (stderr, "%s", _(" ('A' = 41 hex, 'B' = 42 hex, ...) "\ 274 274 "and outputs the result\n")); 275 fprintf (stderr, _(" to 'samhain.new'.\n"));275 fprintf (stderr, "%s", _(" to 'samhain.new'.\n")); 276 276 return EXIT_FAILURE; 277 277 } … … 360 360 { 361 361 suc = 1; 362 fprintf (stdout, _("INFO old password found\n"));362 fprintf (stdout, "%s", _("INFO old password found\n")); 363 363 fflush(stdout); 364 364 for (i = 0; i < 8; ++i) … … 409 409 if (suc == 1 && badcnt == 7) 410 410 { 411 fprintf (stdout, _("INFO finished\n"));411 fprintf (stdout, "%s", _("INFO finished\n")); 412 412 close (newf); 413 413 close (oldf); … … 419 419 lseek (newf, 0, SEEK_SET); 420 420 421 fprintf (stdout, _("INFO Not found in first pass.\n"));422 fprintf (stdout, _("INFO Second pass ..\n"));421 fprintf (stdout, "%s", _("INFO Not found in first pass.\n")); 422 fprintf (stdout, "%s", _("INFO Second pass ..\n")); 423 423 424 424 /* offset the start point … … 449 449 { 450 450 suc = 1; 451 fprintf (stdout, _("INFO old password found\n"));451 fprintf (stdout, "%s", _("INFO old password found\n")); 452 452 for (i = 0; i < 8; ++i) 453 453 { … … 497 497 if (suc == 1 && badcnt == 7) 498 498 { 499 fprintf (stdout, _("INFO finished\n"));499 fprintf (stdout, "%s", _("INFO finished\n")); 500 500 fflush(stdout); 501 501 return 0; … … 504 504 if (suc == 0 || badcnt < 7) 505 505 { 506 fprintf (stdout, _("ERROR incomplete replacement\n"));506 fprintf (stdout, "%s", _("ERROR incomplete replacement\n")); 507 507 } 508 508 else 509 509 { 510 fprintf (stdout, _("ERROR bad replacement\n"));510 fprintf (stdout, "%s", _("ERROR bad replacement\n")); 511 511 } 512 512 fflush(stdout); -
trunk/src/samhain_stealth.c
r205 r212 270 270 static void usage () 271 271 { 272 fprintf(stdout, _("\nUsage: samhain_stealth -i|s|g|o <where> "\ 273 "[what]\n\n")); 274 275 fprintf(stdout, _(" -i info on PS image 'where'\n")); 276 fprintf(stdout, _(" (how much bytes can be hidden in it).\n")); 277 fprintf(stdout, _(" -s hide file 'what' in PS image 'where'\n")); 278 fprintf(stdout, _(" -g get hidden data from PS image 'where'\n")); 279 fprintf(stdout, _(" (output to stdout)\n")); 280 fprintf(stdout, _(" -o size of file 'where' = offset to "\ 281 "end-of-file\n")); 282 fprintf(stdout, _(" (same as wc -c).\n\n")); 283 fprintf(stdout, _(" Example: let bar.ps be the ps file, and foo the config file\n")); 284 fprintf(stdout, _(" 1) extract with: samhain_stealth -g bar.ps >foo\n")); 285 fprintf(stdout, _(" 2) hide with: samhain_stealth -s bar.ps foo\n\n")); 286 287 fprintf(stdout, _(" This program hides a file in an UNCOMPRESSED "\ 288 "postscript\n")); 289 fprintf(stdout, _(" image. To generate such an image, you may "\ 290 "use e.g.:\n")); 291 fprintf(stdout, _(" 'convert +compress foo.jpg bar.ps'.\n")); 292 fprintf(stdout, _(" 'gimp' apparently saves postscript uncompressed "\ 293 "by default\n")); 294 fprintf(stdout, _(" (V 1.06 of the postscript plugin).\n")); 295 fprintf(stdout, _(" 'xv' seems to save with run-length compression, "\ 296 "which is unsuitable.\n")); 297 fprintf(stdout, _(" The program does not check the compression type of "\ 298 "the PS file.\n")); 299 fprintf(stdout, _(" Just have a look at the result to check.\n")); 272 fprintf(stdout, "%s", _("\nUsage: samhain_stealth -i|s|g|o <where> "\ 273 "[what]\n\n")); 274 275 fprintf(stdout, "%s", _(" -i info on PS image 'where'\n")); 276 fprintf(stdout, "%s", _(" (how much bytes can be hidden in it).\n")); 277 fprintf(stdout, "%s", _(" -s hide file 'what' in PS image 'where'\n")); 278 fprintf(stdout, "%s", _(" -g get hidden data from PS image 'where'\n")); 279 fprintf(stdout, "%s", _(" (output to stdout)\n")); 280 fprintf(stdout, "%s", _(" -o size of file 'where' = offset to "\ 281 "end-of-file\n")); 282 fprintf(stdout, "%s", _(" (same as wc -c).\n\n")); 283 fprintf(stdout, "%s", _(" Example: let bar.ps be the ps file, and"\ 284 "foo the config file\n")); 285 fprintf(stdout, "%s", _(" 1) extract with: samhain_stealth "\ 286 "-g bar.ps >foo\n")); 287 fprintf(stdout, "%s", _(" 2) hide with: samhain_stealth "\ 288 "-s bar.ps foo\n\n")); 289 290 fprintf(stdout, "%s", _(" This program hides a file in an UNCOMPRESSED "\ 291 "postscript\n")); 292 fprintf(stdout, "%s", _(" image. To generate such an image, you may " \ 293 "use e.g.:\n")); 294 fprintf(stdout, "%s", _(" 'convert +compress foo.jpg bar.ps'.\n")); 295 fprintf(stdout, "%s", _(" 'gimp' apparently saves postscript "\ 296 "uncompressed by default\n")); 297 fprintf(stdout, "%s", _(" (V 1.06 of the postscript plugin).\n")); 298 fprintf(stdout, "%s", _(" 'xv' seems to save with run-length "\ 299 "compression, which is unsuitable.\n")); 300 fprintf(stdout, "%s", _(" The program does not check the "\ 301 "compression type of the PS file.\n")); 302 fprintf(stdout, "%s", _(" Just have a look at the result to check.\n")); 300 303 return; 301 304 } … … 338 341 if (fd == -1) 339 342 { 340 fprintf(stderr, _("Error: could not open() %s for reading\n"), argv[2]); 343 fprintf(stderr, _("Error: could not open() %s for reading\n"), 344 argv[2]); 341 345 return (1); 342 346 } … … 417 421 return (1); 418 422 } 419 fprintf(stdout, _(" .. finished\n"));423 fprintf(stdout, "%s", _(" .. finished\n")); 420 424 return (0); 421 425 } … … 458 462 return (1); 459 463 } 460 461 464 -
trunk/src/sh_err_log.c
r210 r212 665 665 /* don't write second EOF mark 666 666 */ 667 if (current->log_start != S_TRUE )667 if (current->log_start != S_TRUE && sh.flag.islocked == GOOD) 668 668 { 669 669 /* Don't use inet_peer == NULL, userwise a lock file will -
trunk/src/sh_extern.c
r211 r212 31 31 * for debugging 32 32 */ 33 #if 134 #define PDGBFILE "/ home/rainer/PROJECTS/samhain/devel/pdbg."33 #if 0 34 #define PDGBFILE "/pdbg." 35 35 #endif 36 36 … … 781 781 struct sigaction new_act; 782 782 struct sigaction old_act; 783 char dir[SH_PATHBUF];784 char * p;785 783 char * out = NULL; 786 784 int status; … … 1469 1467 while (listval != NULL) 1470 1468 { 1469 PDBG_OPEN; 1471 1470 PDBG(-2); 1472 1471 if (t1 == listval->type[0] && -
trunk/src/sh_hash.c
r210 r212 1552 1552 sh_error_handle((-1), FIL__, __LINE__, pushdata_fd, MSG_E_ACCESS, 1553 1553 geteuid(), file_path('D', 'W')); 1554 SL_RET0(_("sh_hash_pushdata_int"));1554 aud_exit(FIL__, __LINE__, EXIT_FAILURE); 1555 1555 } 1556 1557 if (SL_ISERROR(status = sl_lock (pushdata_fd))) 1558 { 1559 SH_FREE(fullpath); 1560 SH_FREE(linkpath); 1561 sh_error_handle((-1), FIL__, __LINE__, status, MSG_E_SUBGPATH, 1562 _("Failed to lock baseline database"), _("sh_hash_pushdata_int"), 1563 file_path('D', 'W')); 1564 aud_exit(FIL__, __LINE__, EXIT_FAILURE); 1565 } 1566 1556 1567 if ( SL_ISERROR(status = sl_forward(pushdata_fd))) 1557 1568 { … … 1559 1570 SH_FREE(linkpath); 1560 1571 sh_error_handle((-1), FIL__, __LINE__, status, MSG_E_SUBGPATH, 1561 _("Fa st forward failed"), _("sh_hash_pushdata_int"),1572 _("Failed to seek to end of baseline database"), _("sh_hash_pushdata_int"), 1562 1573 file_path('D', 'W')); 1563 SL_RET0(_("sh_hash_pushdata_int"));1574 aud_exit(FIL__, __LINE__, EXIT_FAILURE); 1564 1575 } 1565 1576 } … … 1570 1581 { 1571 1582 TPT((0, FIL__, __LINE__, _("msg=<Update.>\n"))) 1572 if ( SL_ISERROR(pushdata_fd = sl_open_rdwr(file_path('D', 'W'), SL_YESPRIV))){ 1573 SH_FREE(fullpath); 1574 SH_FREE(linkpath); 1575 sh_error_handle((-1), FIL__, __LINE__, pushdata_fd, MSG_E_ACCESS, 1576 geteuid(), file_path('D', 'W')); 1577 SL_RET0(_("sh_hash_pushdata_int")); 1578 } 1583 if ( SL_ISERROR(pushdata_fd = sl_open_rdwr(file_path('D', 'W'), SL_YESPRIV))){ 1584 SH_FREE(fullpath); 1585 SH_FREE(linkpath); 1586 sh_error_handle((-1), FIL__, __LINE__, pushdata_fd, MSG_E_ACCESS, 1587 geteuid(), file_path('D', 'W')); 1588 aud_exit(FIL__, __LINE__, EXIT_FAILURE); 1589 } 1590 1591 if (SL_ISERROR(status = sl_lock (pushdata_fd))) 1592 { 1593 SH_FREE(fullpath); 1594 SH_FREE(linkpath); 1595 sh_error_handle((-1), FIL__, __LINE__, status, MSG_E_SUBGPATH, 1596 _("Failed to lock baseline database"), _("sh_hash_pushdata_int"), 1597 file_path('D', 'W')); 1598 aud_exit(FIL__, __LINE__, EXIT_FAILURE); 1599 } 1600 1579 1601 line = SH_ALLOC(MAX_PATH_STORE+1); 1580 1602 if (SL_ISERROR(sh_hash_setdataent_old (pushdata_fd, line, … … 1585 1607 SH_FREE(linkpath); 1586 1608 SH_FREE(line); 1587 SL_RET0(_("sh_hash_pushdata_int"));1609 aud_exit(FIL__, __LINE__, EXIT_FAILURE); 1588 1610 } 1589 1611 SH_FREE(line); -
trunk/src/sh_portcheck.c
r210 r212 1218 1218 /* Subroutine to add an interface 1219 1219 */ 1220 static void * sh_dummy_str = NULL; /* fix clobbered by.. warning */ 1221 1220 1222 static int sh_portchk_add_interface (const char * str) 1221 1223 { 1222 1224 struct in_addr haddr; 1223 1225 char errbuf[256]; 1226 char buf[64]; 1227 1228 sh_dummy_str = (void*) &str; 1224 1229 1225 1230 if (iface_initialized == 0) … … 1229 1234 } 1230 1235 1231 if (0 == inet_aton(str, &haddr)) 1232 return -1; 1233 1234 if (iface_list.used == SH_IFACE_MAX) 1235 return -1; 1236 1237 sl_snprintf(errbuf, sizeof(errbuf), _("interface: %s"), inet_ntoa(haddr)); 1238 SH_MUTEX_LOCK(mutex_thread_nolog); 1239 sh_error_handle(SH_ERR_INFO, FIL__, __LINE__, 0, MSG_E_SUBGEN, 1240 errbuf, _("sh_portchk_add_interface")); 1241 SH_MUTEX_UNLOCK(mutex_thread_nolog); 1242 1243 memcpy (&(iface_list.iface[iface_list.used].s_addr), &(haddr.s_addr), sizeof(in_addr_t)); 1244 ++iface_list.used; 1236 do { 1237 1238 while (*str == ',' || *str == ' ' || *str == '\t') ++str; 1239 1240 if (*str) 1241 { 1242 unsigned int i = 0; 1243 while (*str && i < (sizeof(buf)-1) && *str != ',' && *str != ' ' && *str != '\t') 1244 { 1245 buf[i] = *str; ++str; ++i; 1246 } 1247 buf[i] = '\0'; 1248 1249 if (0 == inet_aton(buf, &haddr)) 1250 return -1; 1251 1252 if (iface_list.used == SH_IFACE_MAX) 1253 return -1; 1254 1255 sl_snprintf(errbuf, sizeof(errbuf), _("interface: %s"), inet_ntoa(haddr)); 1256 SH_MUTEX_LOCK(mutex_thread_nolog); 1257 sh_error_handle(SH_ERR_INFO, FIL__, __LINE__, 0, MSG_E_SUBGEN, 1258 errbuf, _("sh_portchk_add_interface")); 1259 SH_MUTEX_UNLOCK(mutex_thread_nolog); 1260 1261 memcpy (&(iface_list.iface[iface_list.used].s_addr), &(haddr.s_addr), sizeof(in_addr_t)); 1262 ++iface_list.used; 1263 } 1264 } while (*str); 1245 1265 1246 1266 return 0; -
trunk/src/slib.c
r203 r212 2152 2152 } 2153 2153 2154 int sl_lock (SL_TICKET ticket) 2155 { 2156 int fd; 2157 struct flock lock; 2158 int retval; 2159 2160 SL_ENTER(_("sl_lock")); 2161 2162 if (SL_ISERROR(fd = get_the_fd (ticket))) 2163 SL_IRETURN(fd, _("sl_lock")); 2164 2165 lock.l_type = F_WRLCK; 2166 lock.l_whence = SEEK_SET; 2167 lock.l_start = 0; 2168 lock.l_len = 0; 2169 2170 /* F_SETLK returns if the lock cannot be obtained */ 2171 do { 2172 retval = fcntl(fd, F_SETLK, &lock); 2173 } while (retval < 0 && errno == EINTR); 2174 2175 if (retval < 0 && errno == EBADF) 2176 SL_IRETURN(SL_ETICKET, _("sl_lock")); 2177 else if (retval < 0) 2178 SL_IRETURN(SL_EBADFILE, _("sl_lock")); 2179 else 2180 SL_IRETURN(SL_ENONE, _("sl_lock")); 2181 } 2182 2154 2183 int sl_close (SL_TICKET ticket) 2155 2184 {
Note:
See TracChangeset
for help on using the changeset viewer.