pegasy / python-ntlm

Automatically exported from code.google.com/p/python-ntlm
0 stars 0 forks source link

ValueError: AbstractDigestAuthHandler doesn't know about Negotiate #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. I manually installed haslib 20081119 from 
http://code.krypto.org/python/hashlib/

Using OpenSSL version 0x0090802f from
 Headers:       /usr/include
 Library:       /usr/lib/libssl.so
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.4
copying hashlib.py -> build/lib.linux-x86_64-2.4
running build_ext
building '_hashlib' extension
creating build/temp.linux-x86_64-2.4
creating build/temp.linux-x86_64-2.4/Modules
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC 
-I/usr/include -I/usr/include/python2.4 -c Modules/_hashopenssl.c -o 
build/temp.linux-x86_64-2.4/Modules/_hashopenssl.o
gcc -pthread -shared build/temp.linux-x86_64-2.4/Modules/_hashopenssl.o 
-L/usr/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.4/_hashlib.so
/usr/bin/ld: skipping incompatible /usr/lib/libssl.so when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/lib/libssl.a when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/lib/libcrypto.so when searching for 
-lcrypto
/usr/bin/ld: skipping incompatible /usr/lib/libcrypto.a when searching for 
-lcrypto
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for 
-lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for 
-lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
running install_lib
copying build/lib.linux-x86_64-2.4/hashlib.py -> 
python/lib64/python2.4/site-packages
copying build/lib.linux-x86_64-2.4/_hashlib.so -> 
python/lib64/python2.4/site-packages
byte-compiling python/lib64/python2.4/site-packages/hashlib.py to hashlib.pyc

2. I had to change the setup.py file to use the newer hashlib version. 
Installed python-ntlm without any issues. (by the way, setup installs the newer 
hashlib whether it's already in the PYTHONPATH or not). 

3. Ran the extended test script with small modifications

import urllib2
from urlparse import urlparse, urlunparse
from ntlm import HTTPNtlmAuthHandler

user = 'DOMAIN\login'
password = "****"
url = "http://server/"
# determine a base_uri for which the username and password can be used
# parsed_url = urlparse(url)
# base_uri = urlunparse((parsed_url[0],parsed_url[1],"","","",""))
base_uri = url

passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, base_uri, user, password)
# create the NTLM authentication handler
auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman)

# other authentication handlers
auth_basic = urllib2.HTTPBasicAuthHandler(passman)
auth_digest = urllib2.HTTPDigestAuthHandler(passman)

# disable proxies (if you want to stay within the corporate network)
proxy_handler = urllib2.ProxyHandler({})

# create and install the opener
opener = urllib2.build_opener(proxy_handler, auth_NTLM, auth_digest, auth_basic)
urllib2.install_opener(opener)

# retrieve the result
response = urllib2.urlopen(url)
print(response.read())

What is the expected output? What do you see instead?

Traceback (most recent call last):
  File "./test_advanced.py", line 32, in ?
    response = urllib2.urlopen(url)
  File "/usr/lib64/python2.4/urllib2.py", line 130, in urlopen
    return _opener.open(url, data)
  File "/usr/lib64/python2.4/urllib2.py", line 364, in open
    response = meth(req, response)
  File "/usr/lib64/python2.4/urllib2.py", line 471, in http_response
    response = self.parent.error(
  File "/usr/lib64/python2.4/urllib2.py", line 396, in error
    result = self._call_chain(*args)
  File "/usr/lib64/python2.4/urllib2.py", line 337, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.4/urllib2.py", line 554, in http_error_302
    return self.parent.open(new)
  File "/usr/lib64/python2.4/urllib2.py", line 364, in open
    response = meth(req, response)
  File "/usr/lib64/python2.4/urllib2.py", line 471, in http_response
    response = self.parent.error(
  File "/usr/lib64/python2.4/urllib2.py", line 396, in error
    result = self._call_chain(*args)
  File "/usr/lib64/python2.4/urllib2.py", line 337, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.4/urllib2.py", line 916, in http_error_401
    host, req, headers)
  File "/usr/lib64/python2.4/urllib2.py", line 807, in http_error_auth_reqed
    raise ValueError("AbstractDigestAuthHandler doesn't know "
ValueError: AbstractDigestAuthHandler doesn't know about Negotiate,

What version of the product are you using? On what operating system?

Using the latest code from the site for python26.

Please provide any additional information below.

Thanks in advance. 

Original issue reported on code.google.com by python6...@gmail.com on 10 Jun 2010 at 6:21

GoogleCodeExporter commented 9 years ago
This is on RHEL 5, Linux 2.6.18-194.3.1.el5 #1 SMP Sun May 2 04:17:42 EDT 2010 
x86_64 x86_64 x86_64 GNU/Linux. Python 2.4.3. Let me know if you need any 
additional information. 

Original comment by python6...@gmail.com on 16 Jun 2010 at 4:28