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.

Answers


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


Need Your Help

How do you clear a twitter session in Rails 3 app using devise

ruby-on-rails-3 twitter devise omniauth logout

I am using the devise, omniauth, omniauth-twitter and twitter gems in a rails 3 app. I want to make it so when a user signs out it also removes the twitter gem configuration. What I'm referring to ...

Pass values + upload file

c# asp.net file-upload telerik

I am using asp.net c# and Telerik tools. My question is, I am tring to pass the values

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.