{"action":"created","issue":{"url":"https://api.github.com/repos/openbsm/openbsm/issues/33","repository_url":"https://api.github.com/repos/openbsm/openbsm","labels_url":"https://api.github.com/repos/openbsm/openbsm/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/openbsm/openbsm/issues/33/comments","events_url":"https://api.github.com/repos/openbsm/openbsm/issues/33/events","html_url":"https://github.com/openbsm/openbsm/pull/33","id":333231873,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1NDk2MDI3","number":33,"title":"Fix CPU spinning issue with empty trail and make -p option the default behaviour","user":{"login":"aniketp","id":24573641,"node_id":"MDQ6VXNlcjI0NTczNjQx","avatar_url":"https://avatars3.githubusercontent.com/u/24573641?v=4","gravatar_id":"","url":"https://api.github.com/users/aniketp","html_url":"https://github.com/aniketp","followers_url":"https://api.github.com/users/aniketp/followers","following_url":"https://api.github.com/users/aniketp/following{/other_user}","gists_url":"https://api.github.com/users/aniketp/gists{/gist_id}","starred_url":"https://api.github.com/users/aniketp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aniketp/subscriptions","organizations_url":"https://api.github.com/users/aniketp/orgs","repos_url":"https://api.github.com/users/aniketp/repos","events_url":"https://api.github.com/users/aniketp/events{/privacy}","received_events_url":"https://api.github.com/users/aniketp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-18T11:31:29Z","updated_at":"2018-07-03T17:33:29Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/openbsm/openbsm/pulls/33","html_url":"https://github.com/openbsm/openbsm/pull/33","diff_url":"https://github.com/openbsm/openbsm/pull/33.diff","patch_url":"https://github.com/openbsm/openbsm/pull/33.patch"},"body":"This PR introduces following changes\r\n* Enforce strict `exit(1)` return value at all reasonable failures\r\n* Remove `-p` option. Instead, make its behavior default.\r\n* Introduce a check for empty audit trail [Spinning CPU issue]\r\n\r\nThe `praudit -p` invocation syncs to the beginning of next legitimate audit record while ignoring the corrupted (incomplete) part. While the default option simply exits without even looking ahead. This behavior can cause uncertain decoding of audit trails which were say, picked up from the middle of an event.\r\n\r\nAlso, the code here:  [When -p option is enabled]\r\n``` C\r\ndo {\r\n\ttype = fgetc(fp);\r\n} while(type != AUT_HEADER32);\r\nungetc(type, fp);\r\n```\r\nLooks for next HEADER token. For an empty trail, with current \"-p\" option, this causes an infinite loop and the CPU starts shouting.\r\n\r\n### Test Plan\r\nHow the CPU issue is resolved\r\n``` bash\r\n$ touch emptyfile\r\n$ praudit emptyfile\r\n File is empty\r\n$ praudit emptyfile; echo $?\r\n File is empty\r\n 1\r\n```\r\nIntroduce a corrupted file\r\n``` bash\r\n$ cat trail\r\nSome random text in the beginning to make it corrupted\r\n  �[\u001ES�\u0002�-\u0001\u001Cdomain-\u0002\u0002type-\u0003\tprotocol$)7\u0012t�\u0004\r\n\u0002\u0002'\u0003\u0013�q\r\n$ praudit trail  # Earlier this could only be done with a -p option\r\nheader,113,11,socket(2),0,Mon Jun 11 10:50:20 2018, + 648 msec\r\nargument,1,0x1c,domain\r\nargument,2,0x2,type\r\nargument,3,0x0,protocol\r\nsubject,root,root,wheel,root,0,10551,4724,37636,10.0.2.2\r\nreturn,success,3\r\ntrailer,113\r\n```"},"comment":{"url":"https://api.github.com/repos/openbsm/openbsm/issues/comments/402235664","html_url":"https://github.com/openbsm/openbsm/pull/33#issuecomment-402235664","issue_url":"https://api.github.com/repos/openbsm/openbsm/issues/33","id":402235664,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjIzNTY2NA==","user":{"login":"asomers","id":129721,"node_id":"MDQ6VXNlcjEyOTcyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/129721?v=4","gravatar_id":"","url":"https://api.github.com/users/asomers","html_url":"https://github.com/asomers","followers_url":"https://api.github.com/users/asomers/followers","following_url":"https://api.github.com/users/asomers/following{/other_user}","gists_url":"https://api.github.com/users/asomers/gists{/gist_id}","starred_url":"https://api.github.com/users/asomers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asomers/subscriptions","organizations_url":"https://api.github.com/users/asomers/orgs","repos_url":"https://api.github.com/users/asomers/repos","events_url":"https://api.github.com/users/asomers/events{/privacy}","received_events_url":"https://api.github.com/users/asomers/received_events","type":"User","site_admin":false},"created_at":"2018-07-03T17:33:29Z","updated_at":"2018-07-03T17:33:29Z","author_association":"CONTRIBUTOR","body":"@aniketp are you planning to get back to this?"}}
{"actor":{"display_login":"asomers"}}