Changeset 20
- Timestamp:
- Feb 13, 2006, 11:54:42 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/samhain.h
r19 r20 252 252 extern long int eintr__result; 253 253 254 extern int sh_argc_store; 255 extern char ** sh_argv_store; 256 254 257 #include "sh_calls.h" 255 258 -
trunk/include/sh_calls.h
r1 r20 53 53 struct sigaction *oldact); 54 54 55 int sh_calls_set_bind_addr (c har *);55 int sh_calls_set_bind_addr (const char *); 56 56 long int retry_connect(char * file, int line, 57 57 int fd, struct sockaddr *serv_addr, int addrlen); -
trunk/include/sh_error.h
r1 r20 91 91 92 92 93 int sh_error_verify (c har * s);94 int sh_error_logverify_mod (c har * s); /* just list, don't verify */95 int sh_error_logverify (c har * s);93 int sh_error_verify (const char * s); 94 int sh_error_logverify_mod (const char * s); /* just list, don't verify */ 95 int sh_error_logverify (const char * s); 96 96 97 97 void sh_error_dbg_switch(void); … … 124 124 /* set level for error logging 125 125 */ 126 int sh_error_setlog(c har * str_s);126 int sh_error_setlog(const char * str_s); 127 127 128 128 /* set severity levels … … 132 132 /* set priorities 133 133 */ 134 int sh_error_set_level(c har * str_s, int *facility);134 int sh_error_set_level(const char * str_s, int *facility); 135 135 136 136 /* set level for TCP export 137 137 */ 138 int sh_error_setexport(c har * str_s);138 int sh_error_setexport(const char * str_s); 139 139 140 140 /* set level for syslog 141 141 */ 142 int sh_error_set_syslog (c har * flag_s);142 int sh_error_set_syslog (const char * flag_s); 143 143 144 144 /* set level for printing 145 145 */ 146 int sh_error_setprint(c har * flag_s);146 int sh_error_setprint(const char * flag_s); 147 147 148 148 /* set severity for external 149 149 */ 150 int sh_error_set_external (c har * str_s);150 int sh_error_set_external (const char * str_s); 151 151 152 152 /* set severity for external 153 153 */ 154 int sh_error_set_database (c har * str_s);154 int sh_error_set_database (const char * str_s); 155 155 156 156 /* set severity for external 157 157 */ 158 int sh_error_set_prelude (c har * str_s);158 int sh_error_set_prelude (const char * str_s); 159 159 160 160 161 161 /* set level for mailing 162 162 */ 163 int sh_error_setseverity (c har * flag);163 int sh_error_setseverity (const char * flag); 164 164 165 165 /* set debug level -
trunk/include/sh_files.h
r1 r20 59 59 /* set maximum recursion level 60 60 */ 61 int sh_files_setrecursion (c har * flag_s);61 int sh_files_setrecursion (const char * flag_s); 62 62 63 63 /* select a directory stack 2=Two, else One (standard) -
trunk/include/sh_forward.h
r1 r20 22 22 23 23 #ifndef SH_STANDALONE 24 int sh_forward_set_strip (c har * str);24 int sh_forward_set_strip (const char * str); 25 25 26 26 #endif … … 28 28 /* generate a random password 29 29 */ 30 int sh_forward_create_password (c har * dummy);30 int sh_forward_create_password (const char * dummy); 31 31 32 32 /* set time limit … … 40 40 /* create client entry for given password 41 41 */ 42 int sh_forward_make_client (c har * str);42 int sh_forward_make_client (const char * str); 43 43 44 44 #ifdef SH_WITH_SERVER -
trunk/include/sh_hash.h
r1 r20 38 38 /* write database to stdout 39 39 */ 40 int sh_hash_pushdata_stdout (c har * str);40 int sh_hash_pushdata_stdout (const char * str); 41 41 42 42 /* version string for database … … 46 46 /* List database content 47 47 */ 48 int sh_hash_list_db (c har * db_file);48 int sh_hash_list_db (const char * db_file); 49 49 50 50 /* List database content with full detail 51 51 */ 52 int set_full_detail (c har * c);52 int set_full_detail (const char * c); 53 53 54 54 /* List database content with full detail, comma delimited 55 55 */ 56 int set_list_delimited (c har * c);56 int set_list_delimited (const char * c); 57 57 58 58 /* Read the database from disk. -
trunk/include/sh_mail.h
r1 r20 38 38 /* test mailbox 39 39 */ 40 int sh_mail_sigverify (c har * s);40 int sh_mail_sigverify (const char * s); 41 41 42 42 /* maximum number of mail attempts -
trunk/include/sh_tiger.h
r19 r20 17 17 /* the checksum function 18 18 */ 19 /*@owned@*/ char * sh_tiger_hash (c har * filename, TigerType what,19 /*@owned@*/ char * sh_tiger_hash (const char * filename, TigerType what, 20 20 UINT64 Length); 21 21 … … 37 37 /* GnuPG-like format 38 38 */ 39 /*@owned@*/ char * sh_tiger_hash_gpg (c har * filename, TigerType what,39 /*@owned@*/ char * sh_tiger_hash_gpg (const char * filename, TigerType what, 40 40 UINT64 Length); 41 41 #endif -
trunk/include/sh_unix.h
r19 r20 144 144 /* chroot directory 145 145 */ 146 int sh_unix_set_chroot(c har * str);146 int sh_unix_set_chroot(const char * str); 147 147 148 148 /* whether to use localtime for file timesatams in logs … … 233 233 /* deamon mode 234 234 */ 235 int sh_unix_setdeamon (c har * dummy);236 int sh_unix_setnodeamon(c har * dummy);235 int sh_unix_setdeamon (const char * dummy); 236 int sh_unix_setnodeamon(const char * dummy); 237 237 238 238 /* Test whether file exists -
trunk/include/sh_utils.h
r1 r20 74 74 /* eval boolean input 75 75 */ 76 int sh_util_flagval(c har * c, int * fval);76 int sh_util_flagval(const char * c, int * fval); 77 77 78 78 /* ask if a file should be updated (returns S_TRUE/S_FALSE) 79 79 */ 80 80 int sh_util_ask_update(char * path); 81 int sh_util_set_interactive(c har * str);81 int sh_util_set_interactive(const char * str); 82 82 83 83 /* don't log output files … … 95 95 /* change verifier 96 96 */ 97 int sh_util_set_newkey (c har * str);97 int sh_util_set_newkey (const char * str); 98 98 99 99 /* server mode 100 100 */ 101 int sh_util_setserver (c har * dummy);101 int sh_util_setserver (const char * dummy); 102 102 103 103 /* a simple compressor … … 116 116 /* set timer for main loop 117 117 */ 118 int sh_util_setlooptime (c har * str);118 int sh_util_setlooptime (const char * str); 119 119 120 120 /* whether init or check the database 121 121 */ 122 int sh_util_setchecksum (c har * str);122 int sh_util_setchecksum (const char * str); 123 123 124 124 /* compare an in_string against a regular expression regex_str -
trunk/include/slib.h
r11 r20 297 297 /* Open for writing. 298 298 */ 299 SL_TICKET sl_open_write (c har * fname, int priviledge_mode);299 SL_TICKET sl_open_write (const char * fname, int priviledge_mode); 300 300 301 301 /* Open for reading. 302 302 */ 303 SL_TICKET sl_open_read (c har * fname, int priviledge_mode);303 SL_TICKET sl_open_read (const char * fname, int priviledge_mode); 304 304 305 305 /* Open for reading w/minimum checking. 306 306 */ 307 SL_TICKET sl_open_fastread (c har * fname, int priviledge_mode);307 SL_TICKET sl_open_fastread (const char * fname, int priviledge_mode); 308 308 309 309 /* Open for read and write. 310 310 */ 311 SL_TICKET sl_open_rdwr (c har * fname, int priviledge_mode);311 SL_TICKET sl_open_rdwr (const char * fname, int priviledge_mode); 312 312 313 313 /* Open for read and write, fail if file exists. 314 314 */ 315 SL_TICKET sl_open_safe_rdwr (c har * fname, int priv);315 SL_TICKET sl_open_safe_rdwr (const char * fname, int priv); 316 316 317 317 /* Open for write, truncate. 318 318 */ 319 SL_TICKET sl_open_write_trunc (c har * fname, int priviledge_mode);319 SL_TICKET sl_open_write_trunc (const char * fname, int priviledge_mode); 320 320 321 321 /* Open for read and write, truncate. 322 322 */ 323 SL_TICKET sl_open_rdwr_trunc (c har * fname, int priviledge_mode);323 SL_TICKET sl_open_rdwr_trunc (const char * fname, int priviledge_mode); 324 324 325 325 /* Close file. … … 394 394 char * sl_trust_errfile(void); 395 395 396 /* Overflow tests 397 */ 398 int sl_ok_muli (int a, int b); 399 int sl_ok_divi (int a, int b); 400 int sl_ok_addi (int a, int b); 401 int sl_ok_subi (int a, int b); 396 402 397 403 #ifdef __cplusplus … … 500 506 void sl_trace_in (char * str, char * file, int line); 501 507 void sl_trace_out (char * str, char * file, int line); 502 int sl_trace_file (c har * str);503 int sl_trace_use (c har * str);508 int sl_trace_file (const char * str); 509 int sl_trace_use (const char * str); 504 510 505 511 -
trunk/src/samhain.c
r19 r20 1262 1262 1263 1263 #if !defined(SH_STEALTH_NOCL) 1264 sh_argc_store = argc; 1265 sh_argv_store = argv; 1264 1266 (void) sh_getopt_get (argc, argv); 1265 1267 #else … … 1283 1285 } 1284 1286 } while (my_argc < 32); 1287 1288 sh_argc_store = my_argc; 1289 sh_argv_store = my_argv; 1290 1285 1291 (void) sh_getopt_get (my_argc, my_argv); 1286 1292 SH_FREE (command_line); -
trunk/src/sh_calls.c
r3 r20 136 136 static int use_bind_addr = 0; 137 137 138 int sh_calls_set_bind_addr (c har * str)138 int sh_calls_set_bind_addr (const char * str) 139 139 { 140 140 static int reject = 0; -
trunk/src/sh_err_log.c
r19 r20 116 116 static int just_list = S_FALSE; 117 117 118 int sh_error_logverify_mod (c har * s)118 int sh_error_logverify_mod (const char * s) 119 119 { 120 120 just_list = S_TRUE; … … 125 125 } 126 126 127 int sh_error_logverify (c har * s)127 int sh_error_logverify (const char * s) 128 128 { 129 129 SL_TICKET fd; -
trunk/src/sh_error.c
r11 r20 115 115 *********************************************/ 116 116 117 int sh_error_verify (c har * s)117 int sh_error_verify (const char * s) 118 118 { 119 119 char * foo; … … 504 504 } 505 505 506 int sh_error_set_level(c har * str_in, int * facility)506 int sh_error_set_level(const char * str_in, int * facility) 507 507 { 508 508 register int i, j, f = BAD; 509 509 510 510 int old_facility; 511 c har * str_s = str_in;511 const char * str_s = str_in; 512 512 513 513 SL_ENTER(_("sh_error_set_level")); … … 636 636 /* set severity for TCP export 637 637 */ 638 int sh_error_setexport(c har * str_s)638 int sh_error_setexport(const char * str_s) 639 639 { 640 640 static int reject = 0; … … 653 653 extern void dlog_set_active(int flag); 654 654 655 int sh_error_setprint(c har * str_s)655 int sh_error_setprint(const char * str_s) 656 656 { 657 657 static int reject = 0; … … 676 676 /* set level for error logging 677 677 */ 678 int sh_error_setlog(c har * str_s)678 int sh_error_setlog(const char * str_s) 679 679 { 680 680 static int reject = 0; … … 691 691 /* set severity for syslog 692 692 */ 693 int sh_error_set_syslog (c har * str_s)693 int sh_error_set_syslog (const char * str_s) 694 694 { 695 695 static int reject = 0; … … 706 706 /* set severity for external 707 707 */ 708 int sh_error_set_external (c har * str_s)708 int sh_error_set_external (const char * str_s) 709 709 { 710 710 static int reject = 0; … … 722 722 /* set severity for database 723 723 */ 724 int sh_error_set_database (c har * str_s)724 int sh_error_set_database (const char * str_s) 725 725 { 726 726 static int reject = 0; … … 738 738 /* set severity for prelude 739 739 */ 740 int sh_error_set_prelude (c har * str_s)740 int sh_error_set_prelude (const char * str_s) 741 741 { 742 742 static int reject = 0; … … 784 784 /* set severity for mailing 785 785 */ 786 int sh_error_setseverity (c har * str_s)786 int sh_error_setseverity (const char * str_s) 787 787 { 788 788 static int reject = 0; -
trunk/src/sh_files.c
r19 r20 168 168 /* set default recursion level 169 169 */ 170 int sh_files_setrecursion (c har * flag_s)170 int sh_files_setrecursion (const char * flag_s) 171 171 { 172 172 long flag = 0; -
trunk/src/sh_forward.c
r19 r20 202 202 static int StripDomain = S_TRUE; 203 203 204 int sh_forward_set_strip (c har * str)204 int sh_forward_set_strip (const char * str) 205 205 { 206 206 static int fromcl = 0; … … 1720 1720 #ifndef USE_SRP_PROTOCOL 1721 1721 1722 int sh_forward_make_client (c har * str)1722 int sh_forward_make_client (const char * str) 1723 1723 { 1724 1724 /* char * safer; */ … … 1767 1767 #else 1768 1768 1769 int sh_forward_make_client (c har * str)1769 int sh_forward_make_client (const char * str) 1770 1770 { 1771 1771 char * foo_v; … … 1822 1822 1823 1823 1824 int sh_forward_create_password (c har * dummy)1824 int sh_forward_create_password (const char * dummy) 1825 1825 { 1826 1826 UINT32 val[2]; -
trunk/src/sh_getopt.c
r1 r20 40 40 #endif 41 41 42 extern int sh_calls_set_bind_addr (c har *);42 extern int sh_calls_set_bind_addr (const char *); 43 43 44 44 #undef FIL__ … … 56 56 char * usage; 57 57 int hasArg; 58 int (*func)(c har * opt);58 int (*func)(const char * opt); 59 59 } opttable_t; 60 60 61 61 /*@noreturn@*/ 62 static int sh_getopt_usage (c har * dummy);62 static int sh_getopt_usage (const char * dummy); 63 63 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 64 static int sh_getopt_forever (c har * dummy);65 #endif 66 static int sh_getopt_copyright (c har * dummy);64 static int sh_getopt_forever (const char * dummy); 65 #endif 66 static int sh_getopt_copyright (const char * dummy); 67 67 68 68 static opttable_t op_table[] = { … … 258 258 HAS_ARG_NO, 259 259 sh_getopt_usage }, 260 #if defined(HAVE_LIBPRELUDE) && defined(HAVE_LIBPRELUDE_9) 261 /* need to skip over these */ 262 { N_("prelude"), 263 '-', 264 N_("Prelude generic options"), 265 HAS_ARG_NO, 266 NULL }, 267 { N_("profile"), 268 '-', 269 N_("Profile to use for this analyzer"), 270 HAS_ARG_YES, 271 NULL }, 272 { N_("heartbeat-interval"), 273 '-', 274 N_("Number of seconds between two heartbeats"), 275 HAS_ARG_YES, 276 NULL }, 277 { N_("server-addr"), 278 '-', 279 N_("Address where this sensor should report to"), 280 HAS_ARG_YES, 281 NULL }, 282 { N_("analyzer-name"), 283 '-', 284 N_("Name for this analyzer"), 285 HAS_ARG_YES, 286 NULL }, 287 #endif 260 288 /* last entry -- required !! -- */ 261 289 { NULL, … … 266 294 }; 267 295 268 static int sh_getopt_copyright (c har * dummy)296 static int sh_getopt_copyright (const char * dummy) 269 297 { 270 298 fprintf (stdout, … … 331 359 332 360 /*@noreturn@*/ 333 static int sh_getopt_usage (c har * dummy)361 static int sh_getopt_usage (const char * dummy) 334 362 { 335 363 int i; … … 413 441 414 442 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 415 static int sh_getopt_forever (c har * dummy)443 static int sh_getopt_forever (const char * dummy) 416 444 { 417 445 dummy = (void *) dummy; … … 489 517 /* call function with argument */ 490 518 --argc; ++argv; 491 if (0 != (* op_table[i].func )(argv[1])) 519 if (NULL != op_table[i].func && 520 0 != (* op_table[i].func )(argv[1])) 492 521 fprintf (stderr, 493 522 _("Error processing option -%c"), … … 498 527 else 499 528 { 500 if (0 != (* op_table[i].func )(NULL)) 529 if (NULL != op_table[i].func && 530 0 != (* op_table[i].func )(NULL)) 501 531 fprintf (stderr, 502 532 _("Error processing option -%c"), … … 540 570 if ( (theequal = strchr(argv[1], '=')) == NULL) 541 571 { 542 fprintf (stderr, _("Error: missing argument\n")); 543 /* argument required, but no avail */ 544 (void) sh_getopt_usage(_("fail")); 572 if (argc < 3) 573 { 574 /* argument required, but no avail 575 */ 576 fprintf (stderr, _("Error: missing argument\n")); 577 (void) sh_getopt_usage(_("fail")); 578 } 579 else 580 { 581 /* call function with argument */ 582 --argc; ++argv; 583 if (NULL != op_table[i].func && 584 0 != (* op_table[i].func )(argv[1])) 585 fprintf (stderr, 586 _("Error processing option -%s"), 587 op_table[i].longopt); 588 break; 589 } 545 590 } 546 591 else … … 550 595 ++theequal; 551 596 /* call function with argument */ 552 if (0 != (* op_table[i].func )(theequal)) 597 if (NULL != op_table[i].func && 598 0 != (* op_table[i].func )(theequal)) 553 599 fprintf (stderr, 554 600 _("Error processing option -%s"), … … 566 612 else 567 613 { 568 if (0 != (* op_table[i].func )(NULL)) 614 if (NULL != op_table[i].func && 615 0 != (* op_table[i].func )(NULL)) 569 616 fprintf (stderr, 570 617 _("Error processing option -%s"), -
trunk/src/sh_hash.c
r19 r20 759 759 * 760 760 ******************************************************************/ 761 int sh_hash_setdataent (SL_TICKET fd, char * line, int size, c har * file)761 int sh_hash_setdataent (SL_TICKET fd, char * line, int size, const char * file) 762 762 { 763 763 long i; … … 1261 1261 static char * sh_db_version_string = NULL; 1262 1262 1263 int sh_hash_pushdata_stdout (c har * str)1263 int sh_hash_pushdata_stdout (const char * str) 1264 1264 { 1265 1265 if (!str) … … 3127 3127 static int ListWithDelimiter = S_FALSE; 3128 3128 3129 int set_full_detail (c har * c)3129 int set_full_detail (const char * c) 3130 3130 { 3131 3131 ListFullDetail = S_TRUE; … … 3137 3137 } 3138 3138 3139 int set_list_delimited (c har * c)3139 int set_list_delimited (const char * c) 3140 3140 { 3141 3141 ListFullDetail = S_TRUE; … … 3259 3259 } 3260 3260 3261 int sh_hash_list_db (c har * db_file)3261 int sh_hash_list_db (const char * db_file) 3262 3262 { 3263 3263 sh_file_t * p; -
trunk/src/sh_mail.c
r1 r20 93 93 static mail_trail_type * mail_trail = NULL; 94 94 95 int sh_mail_sigverify (c har * s)95 int sh_mail_sigverify (const char * s) 96 96 { 97 97 SL_TICKET fd; -
trunk/src/sh_prelude.c
r15 r20 55 55 #include <pwd.h> 56 56 #include <grp.h> 57 58 int sh_argc_store; 59 char ** sh_argv_store; 57 60 58 61 #if defined(HAVE_LIBPRELUDE) && defined(HAVE_LIBPRELUDE_9) … … 933 936 idmef_analyzer_t *analyzer; 934 937 prelude_client_flags_t flags; 938 #ifdef SH_NOFAILOVER 939 prelude_connection_pool_t *pool; 940 prelude_connection_pool_flags_t conn_flags; 941 #endif 935 942 936 943 if (ready_for_init == 0) … … 941 948 942 949 prelude_thread_init(NULL); 943 prelude_init( NULL, NULL);950 prelude_init(&sh_argc_store, sh_argv_store); 944 951 945 952 ret = prelude_client_new(&client, profile ? profile : _("samhain")); … … 968 975 prelude_string_set_dup(str, IDMEF_ANALYZER_VERSION); 969 976 977 #ifdef SH_NOFAILOVER 978 pool = prelude_client_get_connection_pool(client); 979 conn_flags = prelude_connection_pool_get_flags(pool); 980 981 conn_flags &= ~PRELUDE_CONNECTION_POOL_FLAGS_FAILOVER; 982 prelude_connection_pool_set_flags(pool, conn_flags); 983 #endif 984 970 985 ret = prelude_client_start(client); 971 986 if ( ret < 0 ) { -
trunk/src/sh_readconf.c
r1 r20 731 731 #endif 732 732 733 /* Yes, this isn't very elegant ;) 734 */ 735 #if defined(WITH_EXTERNAL) 736 int sh_error_set_external_wrap (char * str) { 737 return sh_error_set_external ((const char *) str); 738 } 739 #endif 740 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 741 int sh_files_setrecursion_wrap (char * str) { 742 return sh_files_setrecursion ((const char *) str); 743 } 744 int sh_util_setchecksum_wrap (char * str) { 745 return sh_util_setchecksum ((const char *) str); 746 } 747 #endif 748 int sh_util_setlooptime_wrap (char * str) { 749 return sh_util_setlooptime ((const char *) str); 750 } 751 #ifdef SH_WITH_MAIL 752 int sh_error_setseverity_wrap (char * str) { 753 return sh_error_setseverity ((const char *) str); 754 } 755 #endif 756 int sh_calls_set_bind_addr_wrap (char * str) { 757 return sh_calls_set_bind_addr ((const char *) str); 758 } 759 int sh_unix_setdeamon_wrap (char * str) { 760 return sh_unix_setdeamon ((const char *) str); 761 } 762 int sh_error_setprint_wrap (char * str) { 763 return sh_error_setprint ((const char *) str); 764 } 765 int sh_error_setlog_wrap (char * str) { 766 return sh_error_setlog ((const char *) str); 767 } 768 int sh_error_set_syslog_wrap (char * str) { 769 return sh_error_set_syslog ((const char *) str); 770 } 771 #ifdef HAVE_LIBPRELUDE 772 int sh_error_set_prelude_wrap (char * str) { 773 return sh_error_set_prelude ((const char *) str); 774 } 775 #endif 776 #ifdef SH_WITH_CLIENT 777 int sh_error_setexport_wrap (char * str) { 778 return sh_error_setexport ((const char *) str); 779 } 780 #endif 781 #ifdef SH_WITH_SERVER 782 int sh_forward_set_strip_wrap (char * str) { 783 return sh_forward_set_strip ((const char *) str); 784 } 785 int sh_unix_set_chroot_wrap (char * str) { 786 return sh_unix_set_chroot ((const char *) str); 787 } 788 #endif 789 #if defined(WITH_DATABASE) 790 int sh_error_set_database_wrap (char * str) { 791 return sh_error_set_database ((const char *) str); 792 } 793 #endif 794 733 795 cfg_options ext_table[] = { 734 796 #if defined(WITH_EXTERNAL) … … 756 818 sh_ext_add_or }, 757 819 { N_("externalseverity"),SH_SECTION_LOG, SH_SECTION_EXTERNAL, 758 sh_error_set_external },820 sh_error_set_external_wrap }, 759 821 { N_("externalclass"), SH_SECTION_LOG, SH_SECTION_EXTERNAL, 760 822 sh_error_external_mask }, … … 840 902 sh_util_obscure_ok }, 841 903 { N_("setrecursionlevel"), SH_SECTION_MISC, SH_SECTION_NONE, 842 sh_files_setrecursion },904 sh_files_setrecursion_wrap }, 843 905 { N_("checksumtest"), SH_SECTION_MISC, SH_SECTION_NONE, 844 sh_util_setchecksum },906 sh_util_setchecksum_wrap }, 845 907 { N_("reportonlyonce"), SH_SECTION_MISC, SH_SECTION_NONE, 846 908 sh_files_reportonce }, … … 915 977 sh_socket_password }, 916 978 { N_("setstripdomain"), SH_SECTION_SRV, SH_SECTION_MISC, 917 sh_forward_set_strip },979 sh_forward_set_strip_wrap }, 918 980 { N_("useseparatelogs"), SH_SECTION_SRV, SH_SECTION_MISC, 919 981 set_flag_sep_log }, 920 982 { N_("setchrootdir"), SH_SECTION_SRV, SH_SECTION_MISC, 921 sh_unix_set_chroot },983 sh_unix_set_chroot_wrap }, 922 984 { N_("setclienttimelimit"), SH_SECTION_SRV, SH_SECTION_MISC, 923 985 sh_forward_set_time_limit }, … … 940 1002 #ifdef SH_WITH_CLIENT 941 1003 { N_("exportseverity"), SH_SECTION_LOG, SH_SECTION_NONE, 942 sh_error_setexport },1004 sh_error_setexport_wrap }, 943 1005 { N_("exportclass"), SH_SECTION_LOG, SH_SECTION_NONE, 944 1006 sh_error_export_mask }, … … 949 1011 sh_readconf_setFiletime }, 950 1012 { N_("setlooptime"), SH_SECTION_MISC, SH_SECTION_NONE, 951 sh_util_setlooptime },1013 sh_util_setlooptime_wrap }, 952 1014 953 1015 #ifdef SH_WITH_MAIL 954 1016 { N_("mailseverity"), SH_SECTION_LOG, SH_SECTION_NONE, 955 sh_error_setseverity },1017 sh_error_setseverity_wrap }, 956 1018 { N_("mailclass"), SH_SECTION_LOG, SH_SECTION_NONE, 957 1019 sh_error_mail_mask }, … … 978 1040 #endif 979 1041 { N_("setbindaddress"), SH_SECTION_MISC, SH_SECTION_NONE, 980 sh_calls_set_bind_addr },1042 sh_calls_set_bind_addr_wrap }, 981 1043 { N_("daemon"), SH_SECTION_MISC, SH_SECTION_NONE, 982 sh_unix_setdeamon },1044 sh_unix_setdeamon_wrap }, 983 1045 { N_("samhainpath"), SH_SECTION_MISC, SH_SECTION_NONE, 984 1046 sh_unix_self_hash }, … … 989 1051 990 1052 { N_("printseverity"), SH_SECTION_LOG, SH_SECTION_NONE, 991 sh_error_setprint },1053 sh_error_setprint_wrap }, 992 1054 { N_("printclass"), SH_SECTION_LOG, SH_SECTION_NONE, 993 1055 sh_error_print_mask }, 994 1056 995 1057 { N_("logseverity"), SH_SECTION_LOG, SH_SECTION_NONE, 996 sh_error_setlog },1058 sh_error_setlog_wrap }, 997 1059 { N_("logclass"), SH_SECTION_LOG, SH_SECTION_NONE, 998 1060 sh_error_log_mask }, 999 1061 1000 1062 { N_("syslogseverity"), SH_SECTION_LOG, SH_SECTION_NONE, 1001 sh_error_set_syslog },1063 sh_error_set_syslog_wrap }, 1002 1064 { N_("syslogclass"), SH_SECTION_LOG, SH_SECTION_NONE, 1003 1065 sh_error_syslog_mask }, 1004 1066 #ifdef HAVE_LIBPRELUDE 1005 1067 { N_("preludeseverity"), SH_SECTION_LOG, SH_SECTION_NONE, 1006 sh_error_set_prelude },1068 sh_error_set_prelude_wrap }, 1007 1069 { N_("preludeclass"), SH_SECTION_LOG, SH_SECTION_NONE, 1008 1070 sh_error_prelude_mask }, -
trunk/src/sh_tiger0.c
r19 r20 103 103 #if defined(TIGER_64_BIT) 104 104 static 105 word64 * sh_tiger_hash_val (c har * filename, TigerType what,105 word64 * sh_tiger_hash_val (const char * filename, TigerType what, 106 106 UINT64 Length, int timeout) 107 107 #else 108 108 static 109 sh_word32 * sh_tiger_hash_val (c har * filename, TigerType what,109 sh_word32 * sh_tiger_hash_val (const char * filename, TigerType what, 110 110 UINT64 Length, int timeout) 111 111 #endif … … 1418 1418 } 1419 1419 1420 static char * sh_tiger_hash_internal (c har * filename, TigerType what,1420 static char * sh_tiger_hash_internal (const char * filename, TigerType what, 1421 1421 UINT64 Length, int timeout); 1422 1422 1423 char * sh_tiger_hash (c har * filename, TigerType what,1423 char * sh_tiger_hash (const char * filename, TigerType what, 1424 1424 UINT64 Length) 1425 1425 { … … 1444 1444 * ------- end new --------- */ 1445 1445 1446 static char * sh_tiger_hash_internal (c har * filename, TigerType what,1446 static char * sh_tiger_hash_internal (const char * filename, TigerType what, 1447 1447 UINT64 Length, int timeout) 1448 1448 { … … 1490 1490 } 1491 1491 1492 char * sh_tiger_hash_gpg (c har * filename, TigerType what,1492 char * sh_tiger_hash_gpg (const char * filename, TigerType what, 1493 1493 UINT64 Length) 1494 1494 { -
trunk/src/sh_unix.c
r19 r20 1601 1601 char * chroot_dir = NULL; 1602 1602 1603 int sh_unix_set_chroot(c har * str)1603 int sh_unix_set_chroot(const char * str) 1604 1604 { 1605 1605 size_t len; … … 1652 1652 static int block_setdeamon = 0; 1653 1653 1654 int sh_unix_setdeamon(c har * dummy)1654 int sh_unix_setdeamon(const char * dummy) 1655 1655 { 1656 1656 int res = 0; … … 1675 1675 #endif 1676 1676 1677 int sh_unix_setnodeamon(c har * dummy)1677 int sh_unix_setnodeamon(const char * dummy) 1678 1678 { 1679 1679 int res = 0; -
trunk/src/sh_utils.c
r13 r20 51 51 UINT32 ErrFlag[2]; 52 52 53 int sh_util_flagval(c har * c, int * fval)53 int sh_util_flagval(const char * c, int * fval) 54 54 { 55 55 SL_ENTER(_("sh_util_flagval")); … … 101 101 static int sh_ask_update = S_FALSE; 102 102 103 int sh_util_set_interactive(char * str) 104 { 105 if (str == NULL) 106 sh_ask_update = S_TRUE; 107 else 108 sh_ask_update = S_TRUE; 103 int sh_util_set_interactive(const char * str) 104 { 105 (void) str; 106 107 sh_ask_update = S_TRUE; 109 108 110 109 sh_unix_setnodeamon(NULL); … … 950 949 static void copy_four (unsigned char * dest, UINT32 in); 951 950 952 int sh_util_set_newkey (c har * new)951 int sh_util_set_newkey (const char * new_in) 953 952 { 954 953 size_t i, j = 0; … … 964 963 long ii, k = 0; 965 964 UINT32 * h1; 965 char * new; 966 966 967 967 if (0 != sl_is_suid()) … … 973 973 } 974 974 975 if (new == NULL || new[0] == '\0')975 if (new_in == NULL || new_in[0] == '\0') 976 976 { 977 977 fprintf(stderr, … … 981 981 return -1; 982 982 } 983 984 if (NULL == (new = malloc(strlen(new_in) + 1))) 985 goto bail_mem; 986 sl_strncpy(new, new_in, strlen(new_in) + 1); 987 983 988 key = new; 984 989 len = strlen(new); … … 1158 1163 /* server mode 1159 1164 */ 1160 int sh_util_setserver (c har * dummy)1165 int sh_util_setserver (const char * dummy) 1161 1166 { 1162 1167 SL_ENTER(_("sh_util_setserver")); 1163 1168 1164 if (dummy) 1165 sh.flag.isserver = GOOD; 1166 else 1167 sh.flag.isserver = GOOD; 1169 (void) dummy; 1170 sh.flag.isserver = GOOD; 1168 1171 SL_RETURN((0),_("sh_util_setserver")); 1169 1172 } 1170 1173 1171 1174 1172 int sh_util_setlooptime (c har * str)1175 int sh_util_setlooptime (const char * str) 1173 1176 { 1174 1177 int i = atoi (str); … … 1187 1190 1188 1191 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 1189 int sh_util_setchecksum (c har * str)1192 int sh_util_setchecksum (const char * str) 1190 1193 { 1191 1194 static int reject = 0; -
trunk/src/slib.c
r12 r20 6 6 #include <stdarg.h> 7 7 #include <string.h> 8 8 #include <limits.h> 9 9 10 10 #include <unistd.h> … … 98 98 static FILE * trace_fp = NULL; 99 99 100 int sl_trace_use (c har * dummy)100 int sl_trace_use (const char * dummy) 101 101 { 102 102 if (dummy) … … 107 107 } 108 108 109 int sl_trace_file (c har * str)109 int sl_trace_file (const char * str) 110 110 { 111 111 if (!str) … … 1638 1638 1639 1639 static 1640 int sl_open_file (c har *filename, int mode, int priv)1640 int sl_open_file (const char *filename, int mode, int priv) 1641 1641 { 1642 1642 struct stat lbuf; … … 1848 1848 1849 1849 static 1850 int check_fname_priv (c har * fname, int priv)1850 int check_fname_priv (const char * fname, int priv) 1851 1851 { 1852 1852 SL_ENTER(_("check_fname_priv")); … … 1858 1858 } 1859 1859 1860 SL_TICKET sl_open_write (c har * fname, int priv)1860 SL_TICKET sl_open_write (const char * fname, int priv) 1861 1861 { 1862 1862 long status; … … 1870 1870 } 1871 1871 1872 SL_TICKET sl_open_read (c har * fname, int priv)1872 SL_TICKET sl_open_read (const char * fname, int priv) 1873 1873 { 1874 1874 long status; … … 1887 1887 } 1888 1888 1889 SL_TICKET sl_open_fastread (c har * fname, int priv)1889 SL_TICKET sl_open_fastread (const char * fname, int priv) 1890 1890 { 1891 1891 long status; … … 1899 1899 } 1900 1900 1901 SL_TICKET sl_open_rdwr (c har * fname, int priv)1901 SL_TICKET sl_open_rdwr (const char * fname, int priv) 1902 1902 { 1903 1903 long status; … … 1911 1911 } 1912 1912 1913 SL_TICKET sl_open_safe_rdwr (c har * fname, int priv)1913 SL_TICKET sl_open_safe_rdwr (const char * fname, int priv) 1914 1914 { 1915 1915 long status; … … 1923 1923 } 1924 1924 1925 SL_TICKET sl_open_write_trunc (c har * fname, int priv)1925 SL_TICKET sl_open_write_trunc (const char * fname, int priv) 1926 1926 { 1927 1927 long status; … … 1935 1935 } 1936 1936 1937 SL_TICKET sl_open_rdwr_trunc (c har * fname, int priv)1937 SL_TICKET sl_open_rdwr_trunc (const char * fname, int priv) 1938 1938 { 1939 1939 long status; … … 2490 2490 } 2491 2491 2492 2492 /* ---------------------------------------------------------------- 2493 * 2494 * Overflow tests 2495 * 2496 * ---------------------------------------------------------------- */ 2497 2498 int sl_ok_muli (int a, int b) /* a*b */ 2499 { 2500 if (a >= (INT_MIN / b) && a <= (INT_MAX / b)) 2501 return SL_TRUE; /* no overflow */ 2502 return SL_FALSE; 2503 } 2504 2505 int sl_ok_divi (int a, int b) /* a/b */ 2506 { 2507 (void) a; 2508 if (b != 0) 2509 return SL_TRUE; /* no overflow */ 2510 return SL_FALSE; 2511 } 2512 2513 int sl_ok_addi (int a, int b) /* a+b */ 2514 { 2515 if (a >= 0 && b >= 0) 2516 { 2517 if (a <= (INT_MAX - b)) 2518 return SL_TRUE; /* no overflow */ 2519 else 2520 return SL_FALSE; 2521 } 2522 else if (a < 0 && b < 0) 2523 { 2524 if (a >= (INT_MIN - b)) 2525 return SL_TRUE; /* no overflow */ 2526 else 2527 return SL_FALSE; 2528 } 2529 return SL_TRUE; 2530 } 2531 2532 int sl_ok_subi (int a, int b) /* a-b */ 2533 { 2534 if (a >= 0 && b < 0) 2535 { 2536 if (a <= (INT_MAX + b)) 2537 return SL_TRUE; /* no overflow */ 2538 else 2539 return SL_FALSE; 2540 } 2541 else if (a < 0 && b >= 0) 2542 { 2543 if (a >= (INT_MIN + b)) 2544 return SL_TRUE; /* no overflow */ 2545 else 2546 return SL_FALSE; 2547 } 2548 return SL_TRUE; 2549 } -
trunk/test/testrun_1b.sh
r19 r20 102 102 rm -f $PW_DIR/test_log_prelude 103 103 104 ( "$PM" --textmod -l $PW_DIR/test_log_prelude >/dev/null 2>&1 )&104 "$PM" --textmod -l $PW_DIR/test_log_prelude --listen 127.0.0.1:5500 >/dev/null 2>&1 & 105 105 PID=$! 106 106 107 ./samhain -t check -p none -l info --set-prelude-severity=info >/dev/null 107 sleep 5 108 109 ./samhain -t check -p none -l info --set-prelude-severity=info --prelude --server-addr 127.0.0.1:5500 >/dev/null 108 110 109 111 if test x$? = x0; then … … 166 168 else 167 169 BUILDOPTS="--quiet $TRUST --enable-debug --with-prelude --with-gpg=${GPG} --with-checksum=no --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file" 168 testrun1b_internal "${BUILDOPTS} "170 testrun1b_internal "${BUILDOPTS} CFLAGS=-DSH_NOFAILOVER=1" 169 171 do_test_1b_2 170 172 if [ $? -eq 0 ]; then
Note:
See TracChangeset
for help on using the changeset viewer.