Tim Johnson | 1 Sep 03:26 2011
Picon

Re: curl_slist_append segfault



>
> I've got an application where I'm using cURL in a C program.  The general
> flow is going about like this:
>
> -----------------------------------------------------
>  struct curl_httppost *formpost=NULL;
>  struct curl_httppost *lastptr=NULL;
>  struct curl_slist *headerlist=NULL;
>  static const char buf[] = "Expect:";
>
>  curl_global_init(CURL_GLOBAL_ALL);
>
> while (1)
> {
> ......
>  curl_formadd(.......);
> ........
>   curl = curl_easy_init();
>   headerlist = curl_slist_append(headerlist, buf);
> ........
>    curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
>    res = curl_easy_perform(curl);
>    curl_easy_cleanup(curl);
>    curl_formfree(formpost);
>    curl_slist_free_all (headerlist);
> }
> -----------------------------------------------------------
>
> I've explicitly listed all functions that should be using headerlist.
>
> On the second iteration through the loop, I get a segfault  at the
> curl_slist_append call.  I'm hoping it's just something simple I'm doing.
>  I
> searched around, the only thing I saw that looked like this was an issue
> that appeared to be fixed by a patch back in 2003.   I'm linking against
> libcurl.so.4, which is a symlink to libcurl.so.4.2.0.
>
> Thanks for any help.
>
> -Tim
> -------------- next part --------------
>
> On Mon, Aug 29, 2011 at 10:48 PM, Tim Johnson <tbj002 <at> gmail.com> wrote:
> [snip]
> > ? ? curl_slist_free_all (headerlist);
> [snip]
> > I've?explicitly?listed all functions that should be using headerlist.
> > On the second iteration through the loop, I get a segfault ?at the
> > curl_slist_append call. ?I'm hoping it's just something simple I'm doing.
> ?I
> > searched around, the only thing I saw that looked like this was an issue
> > that appeared to be fixed by a patch back in 2003. ? I'm linking against
> > libcurl.so.4, which is a symlink to libcurl.so.4.2.0.
> > Thanks for any help.
> > -Tim
>
> Maybe add
>
>  headerlist = NULL;
>
> after the above line to make curl_slist_append() start fresh in the
> loop on each iteration?
>
> Lars Nilsson
>
>
>
> ------------------------------
>
>

Thanks Lars, I just gave that a try.  Still no luck.

Any other ideas out there?  Maybe try another version of libcurl?  Or is
there a way to extract out some information about the curl_slist to try and
detect what is going wrong?

Thanks

-Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cool.haxx.se/pipermail/curl-users/attachments/20110830/54665f48/attachment-0001.html>

------------------------------

Message: 2
Date: Tue, 30 Aug 2011 13:36:39 +0200 (CEST)
From: Daniel Stenberg <daniel <at> haxx.se>
To: the curl tool <curl-users <at> cool.haxx.se>
Subject: Re: curl_slist_append segfault
Message-ID: <alpine.DEB.2.00.1108301333160.11462 <at> tvnag.unkk.fr>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Tue, 30 Aug 2011, Tim Johnson wrote:

Please be aware that you would reach the bunch of libcurl hackers properly on
the curl-library list. This list is for users of the curl command line tool.

I strongly suggest that you take follow-ups on this issue to that list
instead.

>> Maybe add
>>
>>  headerlist = NULL;
>>
>> after the above line to make curl_slist_append() start fresh in the
>> loop on each iteration?
>
> Thanks Lars, I just gave that a try.  Still no luck.
>
> Any other ideas out there?

You need to show us more exact details for us to tell. Like a complete program
that repeats the problem

> Maybe try another version of libcurl?

I don't think so. I'm convinced the problem you're having is due to a mistake
in your code and not in libcurl...

> Or is there a way to extract out some information about the curl_slist to
> try and detect what is going wrong?

The curl_slist is just a linked list. You can easily browser and traverse that
yourself using your code or a debugger etc.



Fair enough.  Thanks for the help, and I'll strip this program down to more general version that can show the issue, and I'll repost in curl-library.  

Thanks again,

-Tim 
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Stefan.Joss@t-online.de | 1 Sep 09:36 2011
Picon

NTLM Authentication on Windows not work

Hello,

 

I try to get an (https-)URL from a server that uses NTLM Authentication. The curl-version tells me that NTLM support is available, and also I set the "--ntlm" switch, curl uses Basic authentication. Therefore the request is rejected. Can someone tell me what I'm doing wrong?

 

Thanks in advance.

 

Regards,

Stefan

 

Version-Info:

C:\curl>curl --version
curl 7.21.7 (i386-pc-win32) libcurl/7.21.7 OpenSSL/0.9.8r zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp
smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate Largefile NTLM SSL SSPI libz

C:\curl>


Call:

curl -k -D --ntlm --user xxx:xxx --trace-ascii tmp.txt https://...


Trace:

== Info: About to connect() to xxxport 443 (#0)
== Info:   Trying 160.50.93.18... == Info: connected
== Info: Connected to iwalogin.bmwgroup.net (160.50.93.18) port 443 (#0)
== Info: SSLv3, TLS handshake, Client hello (1):
=> Send SSL data, 117 bytes (0x75)
== Info: SSLv3, TLS handshake, Server hello (2):
<= Recv SSL data, 81 bytes (0x51)
== Info: SSLv3, TLS handshake, CERT (11):
<= Recv SSL data, 3217 bytes (0xc91)
== Info: SSLv3, TLS handshake, Server finished (14):
<= Recv SSL data, 4 bytes (0x4)
== Info: SSLv3, TLS handshake, Client key exchange (16):
=> Send SSL data, 134 bytes (0x86)
== Info: SSLv3, TLS change cipher, Client hello (1):
=> Send SSL data, 1 bytes (0x1)
== Info: SSLv3, TLS handshake, Finished (20):
=> Send SSL data, 16 bytes (0x10)
== Info: SSLv3, TLS change cipher, Client hello (1):
<= Recv SSL data, 1 bytes (0x1)
== Info: SSLv3, TLS handshake, Finished (20):
<= Recv SSL data, 16 bytes (0x10)
== Info: SSL connection using RC4-MD5
== Info: Server certificate:
== Info:   subject: O=xxx; OU=SSL-Server; CN=xxx
== Info:   start date: 2010-10-21 07:58:40 GMT
== Info:   expire date: 2013-10-05 07:58:40 GMT
== Info:   common name: xxx (matched)
== Info:   issuer: DC=corp; DC=bmw; DC=europe; CN=xxx Issuing CA 1
== Info:   SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
== Info: Server auth using Basic with user 'xxx'
=> Send header, 242 bytes (0xf2)
0000: GET /xxx HTTP/
0040: 1.1
0045: Authorization: Basic xxx
0074: User-Agent: curl/7.21.7 (i386-pc-win32) libcurl/7.21.7 OpenSSL/0
00b4: .9.8r zlib/1.2.5
00c6: Host: xxx
00e3: Accept: */*
00f0:
<= Recv header, 27 bytes (0x1b)
0000: HTTP/1.1 401 Unauthorized
<= Recv header, 22 bytes (0x16)
0000: Content-Length: 1656
<= Recv header, 25 bytes (0x19)
0000: Content-Type: text/html
<= Recv header, 27 bytes (0x1b)
0000: Server: Microsoft-IIS/6.0
<= Recv header, 24 bytes (0x18)
0000: WWW-Authenticate: NTLM
<= Recv header, 23 bytes (0x17)
0000: X-Powered-By: ASP.NET
<= Recv header, 37 bytes (0x25)
0000: Date: Thu, 01 Sep 2011 07:30:48 GMT
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 1656 bytes (0x678)
0000: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3
0040: .org/TR/html4/strict.dtd">
005c: <HTML><HEAD><TITLE>You are not authorized to view this page</TIT
009c: LE>

...

0656: </TD></TR></TABLE></BODY></HTML>
== Info: Connection #0 to host xxx left intact
== Info: Closing connection #0
== Info: SSLv3, TLS alert, Client hello (1):
=> Send SSL data, 2 bytes (0x2)
0000: ..

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Daniel Stenberg | 1 Sep 22:35 2011
Picon

Re: curl crashes on Windows 2008 64bit [event log Faulting module name: ntdll.dll]

On Wed, 31 Aug 2011, Lukas Lehner wrote:

>> curl.exe -v --proxytunnel -x proxy:8080 -T test.exe -u username:password 
>> ftp://destination

> * About to connect() to proxy proxy port 8080 (#0)
> * Connection time-out
> * Closing connection #0
> curl: (28) Connection time-out

Oh. That's weird enough. I don't understand how just connecting to a proxy 
could be a problem...

> what to try?

Bring out the network analyzer and your debugger. Figure out what happens and 
why...

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Eric Seubert | 2 Sep 20:56 2011

upload to FTP site w/ proxy user & pass and w/ site user & pass

Hi,

 

I am trying upload to an FTP site that requires a username & password but I have to go through an HTTP proxy that requires me to enter another username & password.

I posted a while back how to download using the same configuration and I have this line working:

 

curl --proxy myproxy:80 --proxy-user proxyuser:proxypass -u siteuser:sitepass ftp://site.com -o downloadedfile.txt

 

So I tried modifying it to do the FTP upload, but does not work for me.  Here is my latest attempt:

 

curl --proxy myproxy:80 --proxy-user proxyuser:proxypass -T uploadedfile.txt-u siteuser:sitepass ftp://site.com);

 

Could someone explain where I am going wrong?

 

Thanks,

 

Eric

****************************************************************************** This communication (including any attachments) may contain privileged or confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this communication and/or shred the materials and any attachments and are hereby notified that any disclosure, copying, or distribution of this communication, or the taking of any action based on it, is strictly prohibited. Thank you.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Dan Fandrich | 2 Sep 22:37 2011

Re: upload to FTP site w/ proxy user & pass and w/ site user & pass

On Fri, Sep 02, 2011 at 11:56:20AM -0700, Eric Seubert wrote:
> I am trying upload to an FTP site that requires a username & password but I
> have to go through an HTTP proxy that requires me to enter another username &
> password.
> 
> I posted a while back how to download using the same configuration and I have
> this line working:
> 
> curl --proxy myproxy:80 --proxy-user proxyuser:proxypass -u siteuser:sitepass
> ftp://site.com -o downloadedfile.txt
> 
> So I tried modifying it to do the FTP upload, but does not work for me.  Here
> is my latest attempt:
> 
> curl --proxy myproxy:80 --proxy-user proxyuser:proxypass -T uploadedfile.txt-u
> siteuser:sitepass ftp://site.com);
> 
> Could someone explain where I am going wrong?

You're missing a space before the -u in the latter command, and the ); at the end
looks like garbage, but otherwise, it looks ok. What exactly does "does
not work for me" mean? An answer containing debug logs would be best.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Daniel Stenberg | 2 Sep 23:28 2011
Picon

Re: NTLM Authentication on Windows not work

On Thu, 1 Sep 2011, Stefan.Joss <at> t-online.de wrote:

> curl -k -D --ntlm --user xxx:xxx --trace-ascii tmp.txt https://...

The -D option takes a file name. You gave it the file name "--ntlm" so it was 
not treated as the option --ntlm... Try this:

   curl -k -D headers.txt --ntlm --user xxx:xxx --trace-ascii tmp.txt [URL]...

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Jay Whipple III | 5 Sep 03:23 2011

Re: curl crashes on Windows 2008 64bit [event log Faulting module name: ntdll.dll]

Dan,

I have love CURL and been on my own for quite a while but I am stumped....


curl   -L  http://www.cuebid.com

returns a 406 error.....yet I can get this page from any browser...what is going on?


_______________

What's Next?

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Ralph Mitchell | 5 Sep 04:38 2011
Picon

Re: curl crashes on Windows 2008 64bit [event log Faulting module name: ntdll.dll]

On Sun, Sep 4, 2011 at 9:23 PM, Jay Whipple III <jay3 <at> ospreypartners.com> wrote:
Dan,

I have love CURL and been on my own for quite a while but I am stumped....


curl   -L  http://www.cuebid.com

returns a 406 error.....yet I can get this page from any browser...what is going on?

Turns out it *really* wants you to be using a real browser...  You can fake it like this:

     curl -v -L -s -S -A 'Mozilla-4.0' http://www.cuebid.com

Ralph Mitchell
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Stefan.Joss@t-online.de | 6 Sep 12:04 2011
Picon

Re: curl-users Digest, Vol 73, Issue 3

Thanks, the authentication works now. But I have an other problem now.

 

I do not get the requested page. The trace-file shows a message "HTTP/1.1 302 Object Moved". So I've added  "--max-redirs 9", but curl finishes and I do not get any page-content.

 

Can you help me with this, too?.

 

Regards,

Stefan



------------------------------

Message: 3
Date: Fri, 2 Sep 2011 23:28:51 +0200 (CEST)
From: Daniel Stenberg
To: "Stefan.Joss <at> t-online.de" , the curl tool

Subject: Re: NTLM Authentication on Windows not work
Message-ID:
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Thu, 1 Sep 2011, Stefan.Joss <at> t-online.de wrote:

> curl -k -D --ntlm --user xxx:xxx --trace-ascii tmp.txt https://...

The -D option takes a file name. You gave it the file name "--ntlm" so it was
not treated as the option --ntlm... Try this:

curl -k -D headers.txt --ntlm --user xxx:xxx --trace-ascii tmp.txt [URL]...

--

/ daniel.haxx.se


------------------------------

_______________________________________________
curl-users mailing list
curl-users <at> cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users


End of curl-users Digest, Vol 73, Issue 3
*****************************************


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Moumita Banerjee | 6 Sep 17:14 2011
Picon

not able to access intranet

Hi,

I want to access the internal sites of my company using curl but I am not able to do so.

I gives me the error "http://internal site.company_name.net could not be resolved by the DNS"

Please help me resolve the problem.

Thanks,

Moumita

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Gmane