Sponsored Content
Top Forums Programming C NTLM Authorization via HTTP Post 302205972 by edvin on Monday 16th of June 2008 04:25:16 PM
Old 06-16-2008
Question C NTLM Authorization via HTTP

Greetings,

I am writing a C socket application that needs NTLM authorization before it can post HTTP requests, and
I am having trouble with NTLM authorization messages.

:b: I've found the following urls extremely valuable for creating message functions:Furthermore, I've been able to validate my response functions by utilizing input values from the examples found in the above URL.

Even though I am using XP client and W2003 server, I expected that NTLMv1 authentication work, see Implementing CIFS: SMB

Using Network Monitor I observed the traffic of another client (MSXML2.ServerXMLHTTP). After decoding base64 NTLMAuthorization and WWWAuthenticate messages, I found that “Negotiate NTLM2 Key” (0x00080000) is set, which is why I am assuming the NTLM session response is utilized:
The NTLM Authentication Protocol and Security Support Provider

As I mentioned earlier, when I plug-in sample client_challange (nonce), and server_challange, username, password in my functions I get the same NTLM response
as the above section. However, :confused: when I utilize my own information, I end up with
“HTTP/1.1 401 Unauthorized” in response for my message3.

I am authenticating against TARGET_TYPE_SERVER, thus, we are dealing with server level validation rather than domain.

I just have not been able to nail down the right sequence of flags and responses. I would be greatful to any guidance in resolving my issue.

Thanks in advance
 

7 More Discussions You Might Find Interesting

1. HP-UX

SMTP and NTLM

Hi, I have a HP Unix from which I'm trying to connect to an email server through telnet and test sending emails using commands. Why am I doing that is not important. The email server is an Exchange server and it looks like that the only Authentication method it supports is NTLM. The host name... (0 Replies)
Discussion started by: gheibia
0 Replies

2. Programming

sending http url through http socket programming..

hi am senthil am developing a software to send and receive SMS using HTTP connection first of all am forming a URL and sending that URL to a remote server using my Client Program i send that url through Socket(using Send() Function) if i send more than one URL one by one using the same... (0 Replies)
Discussion started by: senkerth
0 Replies

3. Shell Programming and Scripting

sending http url through http socket programming..

hi am senthil am developing a software to send and receive SMS using HTTP connection first of all am forming a URL and sending that URL to a remote server using my Client Program i send that url through Socket(using Send() Function) if i send more than one URL one by one using the same... (4 Replies)
Discussion started by: senkerth
4 Replies

4. UNIX for Dummies Questions & Answers

Configure Cyrus SASL NTLM Plugin with Postfix

Hello I hope somebody can help with this. I have a shell, that in case of failure, sends an email (relaying through an Exchange Server). This Exchange server only offers NTLM authentication. 250-AUTH NTLM This is the configuration I have: Postfix 2.1.1 as client. Cyrus-SASL... (1 Reply)
Discussion started by: viktor1985
1 Replies

5. Shell Programming and Scripting

Configure Cyrus SASL NTLM Plugin with Postfix

Hello I hope somebody can help with this. I have a shell, that in case of failure, sends an email (relaying through an Exchange Server). This Exchange server only offers NTLM authentication. 250-AUTH NTLM This is the configuration I have: Postfix 2.1.1 as client. Cyrus-SASL... (1 Reply)
Discussion started by: viktor1985
1 Replies

6. Web Development

HTTP Headers Reference: HTTP Status-Codes

Hypertext Transfer Protocol -- HTTP/1.1 for Reference - HTTP Headers 10 Status Code Definitions Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required in the response. (1 Reply)
Discussion started by: Neo
1 Replies

7. Shell Programming and Scripting

awk script to find time difference between HTTP PUT and HTTP DELETE requests in access.log

Hi, I'm trying to write a script to determine the time gap between HTTP PUT and HTTP DELETE requests in the HTTP Servers access log. Normally client will do HTTP PUT to push content e.g. file_1.txt and 21 seconds later it will do HTTP DELETE, but sometimes the time varies causing some issues... (3 Replies)
Discussion started by: Juha
3 Replies
LWP::Authen::Ntlm(3)					User Contributed Perl Documentation				      LWP::Authen::Ntlm(3)

NAME
LWP::Authen::Ntlm - Library for enabling NTLM authentication (Microsoft) in LWP SYNOPSIS
use LWP::UserAgent; use HTTP::Request::Common; my $url = 'http://www.company.com/protected_page.html'; # Set up the ntlm client and then the base64 encoded ntlm handshake message my $ua = new LWP::UserAgent(keep_alive=>1); $ua->credentials('www.company.com:80', '', "MyDomain\MyUserCode", 'MyPassword'); $request = GET $url; print "--Performing request now...----------- "; $response = $ua->request($request); print "--Done with request------------------- "; if ($response->is_success) {print "It worked!->" . $response->code . " "} else {print "It didn't work!->" . $response->code . " "} DESCRIPTION
"LWP::Authen::Ntlm" allows LWP to authenticate against servers that are using the NTLM authentication scheme popularized by Microsoft. This type of authentication is common on intranets of Microsoft-centric organizations. The module takes advantage of the Authen::NTLM module by Mark Bush. Since there is also another Authen::NTLM module available from CPAN by Yee Man Chan with an entirely different interface, it is necessary to ensure that you have the correct NTLM module. In addition, there have been problems with incompatibilities between different versions of Mime::Base64, which Bush's Authen::NTLM makes use of. Therefore, it is necessary to ensure that your Mime::Base64 module supports exporting of the encode_base64 and decode_base64 functions. USAGE
The module is used indirectly through LWP, rather than including it directly in your code. The LWP system will invoke the NTLM authentication when it encounters the authentication scheme while attempting to retrieve a URL from a server. In order for the NTLM authentication to work, you must have a few things set up in your code prior to attempting to retrieve the URL: o Enable persistent HTTP connections To do this, pass the "keep_alive=>1" option to the LWP::UserAgent when creating it, like this: my $ua = new LWP::UserAgent(keep_alive=>1); o Set the credentials on the UserAgent object The credentials must be set like this: $ua->credentials('www.company.com:80', '', "MyDomain\MyUserCode", 'MyPassword'); Note that you cannot use the HTTP::Request object's authorization_basic() method to set the credentials. Note, too, that the 'www.company.com:80' portion only sets credentials on the specified port AND it is case-sensitive (this is due to the way LWP is coded, and has nothing to do with LWP::Authen::Ntlm) AVAILABILITY
General queries regarding LWP should be made to the LWP Mailing List. Questions specific to LWP::Authen::Ntlm can be forwarded to jtillman@bigfoot.com COPYRIGHT
Copyright (c) 2002 James Tillman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
LWP, LWP::UserAgent, lwpcook. perl v5.12.1 2009-06-15 LWP::Authen::Ntlm(3)
All times are GMT -4. The time now is 05:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy