Changes in trunk/src/sh_prelude.c [26:20]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_prelude.c
r26 r20 133 133 } 134 134 135 static int set_prelude_severity_int (const char * str, int prelude_sev) 136 { 137 char * p; 138 char * dup = strdup (str); 139 140 if (!dup) 141 return -1; 142 143 p = strtok (dup, ", \t"); 135 static int set_prelude_severity_int (char * str, int prelude_sev) 136 { 137 char * p = strtok (str, ", \t"); 138 144 139 if (p) { 145 140 do { … … 160 155 else if (0 == strcmp (p, _("info"))) 161 156 clear_and_set (prelude_sev, SH_ERR_INFO); 162 else { 163 free (dup); 157 else 164 158 return -1; 165 }166 159 p = strtok (NULL, ", \t"); 167 160 } while (p); 168 161 } 169 free(dup);170 162 return 0; 171 163 } 172 164 173 int sh_prelude_map_info (c onst char * str)165 int sh_prelude_map_info (char * str) 174 166 { 175 167 return (set_prelude_severity_int(str,(int)IDMEF_IMPACT_SEVERITY_INFO)); 176 168 } 177 int sh_prelude_map_low (c onst char * str)169 int sh_prelude_map_low (char * str) 178 170 { 179 171 return (set_prelude_severity_int(str,(int)IDMEF_IMPACT_SEVERITY_LOW)); 180 172 } 181 int sh_prelude_map_medium (c onst char * str)173 int sh_prelude_map_medium (char * str) 182 174 { 183 175 return (set_prelude_severity_int(str,(int)IDMEF_IMPACT_SEVERITY_MEDIUM)); 184 176 } 185 int sh_prelude_map_high (c onst char * str)177 int sh_prelude_map_high (char * str) 186 178 { 187 179 return (set_prelude_severity_int(str,(int)IDMEF_IMPACT_SEVERITY_HIGH)); … … 308 300 } 309 301 310 /* flawfinder: ignore *//* is part of name, not access() */311 302 static void get_access_info(idmef_file_access_t *access, char * mode, int pos, int mpos) 312 303 { … … 317 308 do { 318 309 if ( mode[pos] == 'r' ) { 319 /* flawfinder: ignore *//* is part of name, not access() */ 320 ret = idmef_file_access_new_permission(access, &str, IDMEF_LIST_APPEND); 310 ret = idmef_file_access_new_permission(access, &str, -1); 321 311 if ( ret < 0 ) 322 312 return; … … 325 315 } 326 316 else if ( mode[pos] == 'w' ) { 327 /* flawfinder: ignore *//* is part of name, not access() */ 328 ret = idmef_file_access_new_permission(access, &str, IDMEF_LIST_APPEND); 317 ret = idmef_file_access_new_permission(access, &str, -1); 329 318 if ( ret < 0 ) 330 319 return; … … 333 322 } 334 323 else if ( mode[pos] == 'x' || mode[pos] == 's' || mode[pos] == 't') { 335 /* flawfinder: ignore *//* is part of name, not access() */ 336 ret = idmef_file_access_new_permission(access, &str, IDMEF_LIST_APPEND); 324 ret = idmef_file_access_new_permission(access, &str, -1); 337 325 if ( ret < 0 ) 338 326 return; … … 352 340 353 341 if ( got == 0 ) { 354 /* flawfinder: ignore *//* is part of name, not access() */ 355 ret = idmef_file_access_new_permission(access, &str, IDMEF_LIST_APPEND); 342 ret = idmef_file_access_new_permission(access, &str, -1); 356 343 if ( ret < 0 ) 357 344 return; … … 373 360 prelude_string_t *str; 374 361 idmef_checksum_t *checksum; 375 idmef_file_access_t *access; /* flawfinder: ignore */362 idmef_file_access_t *access; 376 363 idmef_user_id_t *userid; 377 364 const char *suffix = (category == IDMEF_FILE_CATEGORY_CURRENT) ? "_new" : "_old"; 378 365 char *mode = NULL; 379 366 380 ret = idmef_target_new_file(target, &file, IDMEF_LIST_APPEND);367 ret = idmef_target_new_file(target, &file, -1); 381 368 if ( ret < 0 ) 382 369 return; … … 442 429 ptr = get_value(msg, _("chksum"), suffix); 443 430 if ( ptr ) { 444 ret = idmef_file_new_checksum(file, &checksum, IDMEF_LIST_APPEND);431 ret = idmef_file_new_checksum(file, &checksum, 0); 445 432 if ( ret < 0 ) 446 433 return; … … 472 459 mode = get_value(msg, _("mode"), suffix); 473 460 if ( mode ) { 474 /* flawfinder: ignore *//* is part of name, not access() */ 475 ret = idmef_file_new_file_access(file, &access, IDMEF_LIST_APPEND); 476 if ( ret < 0 ) 477 return; 478 479 /* flawfinder: ignore *//* is part of name, not access() */ 461 ret = idmef_file_new_file_access(file, &access, -1); 462 if ( ret < 0 ) 463 return; 464 480 465 ret = idmef_file_access_new_user_id(access, &userid); 481 466 if ( ret < 0 ) … … 483 468 idmef_user_id_set_type(userid, IDMEF_USER_ID_TYPE_OTHER_PRIVS); 484 469 485 /* flawfinder: ignore *//* is part of name, not access() */486 470 get_access_info ( access, mode, 7, 9 ); 487 471 } … … 491 475 struct passwd *pw; 492 476 493 /* flawfinder: ignore *//* is part of name, not access() */ 494 ret = idmef_file_new_file_access(file, &access, IDMEF_LIST_APPEND); 495 if ( ret < 0 ) 496 return; 497 498 /* flawfinder: ignore *//* is part of name, not access() */ 477 ret = idmef_file_new_file_access(file, &access, 0); 478 if ( ret < 0 ) 479 return; 480 499 481 ret = idmef_file_access_new_user_id(access, &userid); 500 482 if ( ret < 0 ) … … 515 497 516 498 if ( mode ) { 517 /* flawfinder: ignore *//* is part of name, not access() */518 499 get_access_info ( access, mode, 1, 3 ); 519 500 } … … 524 505 struct group *gr; 525 506 526 /* flawfinder: ignore *//* is part of name, not access() */ 527 ret = idmef_file_new_file_access(file, &access, IDMEF_LIST_APPEND); 528 if ( ret < 0 ) 529 return; 530 531 /* flawfinder: ignore *//* is part of name, not access() */ 507 ret = idmef_file_new_file_access(file, &access, -1); 508 if ( ret < 0 ) 509 return; 510 532 511 ret = idmef_file_access_new_user_id(access, &userid); 533 512 if ( ret < 0 ) … … 548 527 549 528 if ( mode ) { 550 get_access_info ( access, mode, 4, 6 ); /* flawfinder: ignore */529 get_access_info ( access, mode, 4, 6 ); 551 530 } 552 531 } … … 650 629 if ( ptr ) { 651 630 if ( ! source ) { 652 ret = idmef_alert_new_source(alert, &source, IDMEF_LIST_APPEND);631 ret = idmef_alert_new_source(alert, &source, -1); 653 632 if ( ret < 0 ) { 654 633 free(ptr); … … 663 642 } 664 643 665 ret = idmef_node_new_address(node, &address, IDMEF_LIST_APPEND);644 ret = idmef_node_new_address(node, &address, -1); 666 645 if ( ret < 0 ) { 667 646 free(ptr); … … 684 663 else { 685 664 if ( ! source ) { 686 ret = idmef_alert_new_source(alert, &source, IDMEF_LIST_APPEND);665 ret = idmef_alert_new_source(alert, &source, -1); 687 666 if ( ret < 0 ) { 688 667 free(ptr); … … 717 696 idmef_user_set_category(user, IDMEF_USER_CATEGORY_OS_DEVICE); 718 697 719 ret = idmef_user_new_user_id(user, &user_id, IDMEF_LIST_APPEND);698 ret = idmef_user_new_user_id(user, &user_id, -1); 720 699 if ( ret < 0 ) { 721 700 free(ptr); … … 791 770 goto err; 792 771 793 idmef_alert_set_analyzer(alert, idmef_analyzer_ref(prelude_client_get_analyzer(client)), IDMEF_LIST_PREPEND);772 idmef_alert_set_analyzer(alert, idmef_analyzer_ref(prelude_client_get_analyzer(client)), 0); 794 773 795 774 ret = idmef_time_new_from_gettimeofday(&time); … … 807 786 goto err; 808 787 809 ret = idmef_alert_new_target(alert, &target, IDMEF_LIST_APPEND);788 ret = idmef_alert_new_target(alert, &target, -1); 810 789 if ( ret < 0 ) 811 790 goto err; … … 865 844 idmef_confidence_set_rating(confidence, IDMEF_CONFIDENCE_RATING_HIGH); 866 845 867 ret = idmef_alert_new_additional_data(alert, &data, IDMEF_LIST_APPEND);846 ret = idmef_alert_new_additional_data(alert, &data, -1); 868 847 if ( ret < 0 ) 869 848 goto err; … … 911 890 912 891 913 int sh_prelude_set_profile(c onst char *arg)892 int sh_prelude_set_profile(char *arg) 914 893 { 915 894 if ( profile ) {
Note:
See TracChangeset
for help on using the changeset viewer.