{"action":"opened","issue":{"url":"https://api.github.com/repos/chrsmith/reaver-wps/issues/470","labels_url":"https://api.github.com/repos/chrsmith/reaver-wps/issues/470/labels{/name}","comments_url":"https://api.github.com/repos/chrsmith/reaver-wps/issues/470/comments","events_url":"https://api.github.com/repos/chrsmith/reaver-wps/issues/470/events","html_url":"https://github.com/chrsmith/reaver-wps/issues/470","id":59385195,"number":470,"title":"Source code patch to correct the skipping of pin checks","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chrsmith/reaver-wps/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/reaver-wps/labels/Priority-Triage","name":"Priority-Triage","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/reaver-wps/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-01T06:45:44Z","updated_at":"2015-03-01T06:45:44Z","closed_at":null,"body":"```\nAs described in issue #461 the bug caused skipping pin tests when checking the \nsecond portion of the pin.\nLet me introduce this simple patch here. \n   \nYou have to have a source files tree of reaver (at best the svn checkout) and \ncomplete gcc toolchain installed and working to compile the sources.\n \nLocate the file ../src/exchange.c and somewhere around the line # 233 find this \ntext\n\n\telse if(premature_timeout)\n\t{\n\t\t/* \n\t\t * Some WPS implementations simply drop the connection on the floor instead of sending a NACK.\n\t\t * We need to be able to handle this, but at the same time using a timeout on the M5/M7 messages\n\t\t * can result in false negatives. Thus, treating M5/M7 receive timeouts as NACKs can be disabled.\n\t\t * Only treat the timeout as a NACK if this feature is enabled.\n\t\t */\n\t\tif(get_timeout_is_nack() &&\n\t\t  (last_msg == M3 || last_msg == M5) \n\nand in text editor replace the last condition line with the line\n\n\t\t  ((last_msg == M3 && (get_key_status() == KEY1_WIP)) || last_msg == M5))\n\nThis condition checks additionally the status of the state machine and type of \nthe last received message. So the condition is true only when we are in status \nKEY1_WIP [ie. trying the first portion of the pin] AND after receiving M3 OR \njust receiving M5. Without this check it returned the wrong ret_val = \nKEY_REJECTED  and skipped the actual pin re-try.\nFor completness, the same condition a few lines above of the previous \nif(got_nack) block should be written accordingly although I'm not sure if such \ncondition state could occurr. Tested and now it works as expected.\n\nMy setup is Debian Wheezy, rt73usb/zd1211rw, router Tenda W311, reaver 1.4 \nsouces svn rev 113.\nHope it helps. Please test and respond with results.\n\n\n\n\n```\n\nOriginal issue reported on code.google.com by `agent...@gmail.com` on 14 Feb 2013 at 4:34"}}