Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [diff] [blame] | 1 | # $Id$ |
| 2 | import inc_sip as sip |
| 3 | import inc_sdp as sdp |
| 4 | |
| 5 | # Authentication failure test with same nonce |
| 6 | |
| 7 | |
| 8 | pjsua = "--null-audio --id=sip:CLIENT --registrar sip:127.0.0.1:$PORT " + \ |
| 9 | "--realm=python --user=username --password=password" |
| 10 | |
| 11 | req1 = sip.RecvfromTransaction("Initial request", 401, |
| 12 | include=["REGISTER sip"], |
| 13 | exclude=["Authorization"], |
| 14 | resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"1\""] |
| 15 | ) |
| 16 | |
| 17 | req2 = sip.RecvfromTransaction("REGISTER retry", 401, |
| 18 | include=["REGISTER sip", "Authorization", "nonce=\"1\""], |
| 19 | exclude=["Authorization:[\\s\\S]+Authorization:"], |
| 20 | resp_hdr=["WWW-Authenticate: Digest realm=\"python\", nonce=\"1\""], |
| 21 | expect="PJSIP_EFAILEDCREDENTIAL" |
| 22 | ) |
| 23 | |
| 24 | |
| 25 | recvfrom_cfg = sip.RecvfromCfg("Authentication failure with same nonce", |
| 26 | pjsua, [req1, req2]) |