cURL / Mailing Lists / curl-users / Single Mail

curl-users

Problems

From: jianghao <realjiangms_at_hotmail.com>
Date: Fri, 15 Aug 2008 18:39:22 +0800

Hello,
     These days I had some trouble when testing my staff with curl, I've solved them,but I don't know if my solution is correct and whether it will cause other problems future.Please help me.
     1. At base64.c:Curl_base64_encode,line 162:
              if(0 == insize) insize = strlen(indata);
        It caused a segment fault when indata is NULL and insize = 0, I think it should be changed to:
              if(0 == insize) insize = (NULL == indata) ? 0 : strlen(indata);
     2.When doing ntlm authentication, curl will get into infinite loops(although it will stop after about 50 repeats) if server always close the connection after sending the response with the NTLM challenge string When curl recieves an NTLM www-authenticate string with challenge string from server, it set the ntlm state to NTLMSTATE_TYPE2(2) and save the challenge strings. Then it check the connection. it will find that the connection has been closed and then clean the connection datas. Unfortunately, my ntlm state infomation and challenge string in connection data will also be cleaned. Curl will reopen another connection at next request, and ntlm state will return to NTLMSTATE_NONE and the challenge string will be lost. Then server will send NTLM www-authenticate string with another challenge string and close the connection. And curl will repeat the same process. So curl will be at NTLMSTATE_NONE state for ever and never se!
 nd challenge response. I just temporarily changed the http_ntlm.c and added a global var "ntlmlast" to save the last ntlm properties so that curl can restore the ntlm state and the challenge string when connection changes. My test case can pass now. But it's not a good solution and I think it may cause other problems under some other conditions.
 
Thanks,
Zihao
_________________________________________________________________
快来看看这些猫咪有多逗,爆笑!
http://cnweb.search.live.com/video/results.aspx?q=%E5%8F%AF%E7%88%B1%E7%8C%AB%E5%92%AA&Form=MEVHAA

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2008-08-15