JamesArmes
JamesArmes

Reputation: 1373

cURL Always Returns 401 With NTLM

I'm working on a library to communicate with Microsoft Exchange using PHP. Everything works fine on my production servers, but I keep getting a 401 Unauthorized on my development machine. I tried using curl from the command line and I get the same results.

Using the following returns "401" on my machine:

curl https://mail.example.com/EWS/Exchange.asmx -w %{http_code} --ntlm -u username:password

The same exact call returns "302" on my production machines, which is what I expect.

My development machine is using curl 7.19.7 and my production machine is using curl 7.18.0.

Upvotes: 8

Views: 11755

Answers (2)

Pierre
Pierre

Reputation: 521

This is an old question but if it can eventually help anybody, I figured I'd post an answer.

There's a bug with NTLM and curl on certain recent version of Ubuntu (10.04 and up I believe).

If you're using the curl module of PHP on ubuntu and your libcurl version is affected by this bug, this could explain why your authentication requests are failing.

If you add the verbose flag to your command (-v), you should see something like this in the response part:

  • gss_init_sec_context() failed: : Credentials cache file '/tmp/krb5cc_1000' not found

If you do see this, you're affected by the bug and you'll have to either downgrade your library or find another machine.

I hope this helps :P

Upvotes: 7

Ruben Herold
Ruben Herold

Reputation: 1

For all Centos / RHEL 6.X Users please take a look into:

https://bugzilla.redhat.com/show_bug.cgi?id=953864

Upvotes: 0

Related Questions