Changeset 22 for trunk/src/sh_prelude.c
- Timestamp:
- Feb 23, 2006, 12:03:58 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_prelude.c
r20 r22 133 133 } 134 134 135 static int set_prelude_severity_int (char * str, int prelude_sev) 136 { 137 char * p = strtok (str, ", \t"); 135 static int set_prelude_severity_int (const char * str, int prelude_sev) 136 { 137 char * p; 138 char * dup = strdup (str); 139 140 p = strtok (dup, ", \t"); 138 141 139 142 if (p) { … … 160 163 } while (p); 161 164 } 165 free(dup); 162 166 return 0; 163 167 } 164 168 165 int sh_prelude_map_info (c har * str)169 int sh_prelude_map_info (const char * str) 166 170 { 167 171 return (set_prelude_severity_int(str,(int)IDMEF_IMPACT_SEVERITY_INFO)); 168 172 } 169 int sh_prelude_map_low (c har * str)173 int sh_prelude_map_low (const char * str) 170 174 { 171 175 return (set_prelude_severity_int(str,(int)IDMEF_IMPACT_SEVERITY_LOW)); 172 176 } 173 int sh_prelude_map_medium (c har * str)177 int sh_prelude_map_medium (const char * str) 174 178 { 175 179 return (set_prelude_severity_int(str,(int)IDMEF_IMPACT_SEVERITY_MEDIUM)); 176 180 } 177 int sh_prelude_map_high (c har * str)181 int sh_prelude_map_high (const char * str) 178 182 { 179 183 return (set_prelude_severity_int(str,(int)IDMEF_IMPACT_SEVERITY_HIGH)); … … 300 304 } 301 305 306 /* flawfinder: ignore *//* is part of name, not access() */ 302 307 static void get_access_info(idmef_file_access_t *access, char * mode, int pos, int mpos) 303 308 { … … 308 313 do { 309 314 if ( mode[pos] == 'r' ) { 315 /* flawfinder: ignore *//* is part of name, not access() */ 310 316 ret = idmef_file_access_new_permission(access, &str, -1); 311 317 if ( ret < 0 ) … … 315 321 } 316 322 else if ( mode[pos] == 'w' ) { 323 /* flawfinder: ignore *//* is part of name, not access() */ 317 324 ret = idmef_file_access_new_permission(access, &str, -1); 318 325 if ( ret < 0 ) … … 322 329 } 323 330 else if ( mode[pos] == 'x' || mode[pos] == 's' || mode[pos] == 't') { 331 /* flawfinder: ignore *//* is part of name, not access() */ 324 332 ret = idmef_file_access_new_permission(access, &str, -1); 325 333 if ( ret < 0 ) … … 340 348 341 349 if ( got == 0 ) { 350 /* flawfinder: ignore *//* is part of name, not access() */ 342 351 ret = idmef_file_access_new_permission(access, &str, -1); 343 352 if ( ret < 0 ) … … 360 369 prelude_string_t *str; 361 370 idmef_checksum_t *checksum; 362 idmef_file_access_t *access; 371 idmef_file_access_t *access; /* flawfinder: ignore */ 363 372 idmef_user_id_t *userid; 364 373 const char *suffix = (category == IDMEF_FILE_CATEGORY_CURRENT) ? "_new" : "_old"; … … 459 468 mode = get_value(msg, _("mode"), suffix); 460 469 if ( mode ) { 470 /* flawfinder: ignore *//* is part of name, not access() */ 461 471 ret = idmef_file_new_file_access(file, &access, -1); 462 472 if ( ret < 0 ) 463 473 return; 464 474 475 /* flawfinder: ignore *//* is part of name, not access() */ 465 476 ret = idmef_file_access_new_user_id(access, &userid); 466 477 if ( ret < 0 ) … … 468 479 idmef_user_id_set_type(userid, IDMEF_USER_ID_TYPE_OTHER_PRIVS); 469 480 481 /* flawfinder: ignore *//* is part of name, not access() */ 470 482 get_access_info ( access, mode, 7, 9 ); 471 483 } … … 475 487 struct passwd *pw; 476 488 489 /* flawfinder: ignore *//* is part of name, not access() */ 477 490 ret = idmef_file_new_file_access(file, &access, 0); 478 491 if ( ret < 0 ) 479 492 return; 480 493 494 /* flawfinder: ignore *//* is part of name, not access() */ 481 495 ret = idmef_file_access_new_user_id(access, &userid); 482 496 if ( ret < 0 ) … … 497 511 498 512 if ( mode ) { 513 /* flawfinder: ignore *//* is part of name, not access() */ 499 514 get_access_info ( access, mode, 1, 3 ); 500 515 } … … 505 520 struct group *gr; 506 521 522 /* flawfinder: ignore *//* is part of name, not access() */ 507 523 ret = idmef_file_new_file_access(file, &access, -1); 508 524 if ( ret < 0 ) 509 525 return; 510 526 527 /* flawfinder: ignore *//* is part of name, not access() */ 511 528 ret = idmef_file_access_new_user_id(access, &userid); 512 529 if ( ret < 0 ) … … 527 544 528 545 if ( mode ) { 529 get_access_info ( access, mode, 4, 6 ); 546 get_access_info ( access, mode, 4, 6 ); /* flawfinder: ignore */ 530 547 } 531 548 } … … 890 907 891 908 892 int sh_prelude_set_profile(c har *arg)909 int sh_prelude_set_profile(const char *arg) 893 910 { 894 911 if ( profile ) {
Note:
See TracChangeset
for help on using the changeset viewer.