pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/databases/py-ldap3
Module Name: pkgsrc
Committed By: leot
Date: Thu Jan 31 11:02:14 UTC 2019
Modified Files:
pkgsrc/databases/py-ldap3: Makefile distinfo
Added Files:
pkgsrc/databases/py-ldap3/patches:
patch-ldap3_protocol_sasl_digestMd5.py
Log Message:
py-ldap3: Populate an accidental empty file
In the released distfile on PyPI for ldap3-2.5.2
ldap3/protocol/sasl/digestMd5.py was accidentally empty.
Populate it based on the v2.5.2.tar.gz distfile on GitHub.
PKGREVISION++
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 pkgsrc/databases/py-ldap3/Makefile
cvs rdiff -u -r1.9 -r1.10 pkgsrc/databases/py-ldap3/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/databases/py-ldap3/patches/patch-ldap3_protocol_sasl_digestMd5.py
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/databases/py-ldap3/Makefile
diff -u pkgsrc/databases/py-ldap3/Makefile:1.11 pkgsrc/databases/py-ldap3/Makefile:1.12
--- pkgsrc/databases/py-ldap3/Makefile:1.11 Mon Dec 31 11:26:03 2018
+++ pkgsrc/databases/py-ldap3/Makefile Thu Jan 31 11:02:14 2019
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.11 2018/12/31 11:26:03 adam Exp $
+# $NetBSD: Makefile,v 1.12 2019/01/31 11:02:14 leot Exp $
DISTNAME= ldap3-2.5.2
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION= 1
CATEGORIES= databases python
MASTER_SITES= ${MASTER_SITE_PYPI:=l/ldap3/}
Index: pkgsrc/databases/py-ldap3/distinfo
diff -u pkgsrc/databases/py-ldap3/distinfo:1.9 pkgsrc/databases/py-ldap3/distinfo:1.10
--- pkgsrc/databases/py-ldap3/distinfo:1.9 Mon Dec 31 11:26:03 2018
+++ pkgsrc/databases/py-ldap3/distinfo Thu Jan 31 11:02:14 2019
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.9 2018/12/31 11:26:03 adam Exp $
+$NetBSD: distinfo,v 1.10 2019/01/31 11:02:14 leot Exp $
SHA1 (ldap3-2.5.2.tar.gz) = c5b6d80c274c358270db102f9a9b6c8284d7aa48
RMD160 (ldap3-2.5.2.tar.gz) = afe5b19bce9acf7438a3fc42b71951f875f81c4f
SHA512 (ldap3-2.5.2.tar.gz) = 2889fbf917b828eaa54a935b2cc9c4909b3e2eb5c5c50cc38f6c561335d5341837f8a16d3aa135144c8ac12cd6fefdd9c3421c8de36a9573aed1aaa6a3051afa
Size (ldap3-2.5.2.tar.gz) = 352903 bytes
+SHA1 (patch-ldap3_protocol_sasl_digestMd5.py) = 315e38d20362b30c7a3f7930c9fbb1f994d1207d
Added files:
Index: pkgsrc/databases/py-ldap3/patches/patch-ldap3_protocol_sasl_digestMd5.py
diff -u /dev/null pkgsrc/databases/py-ldap3/patches/patch-ldap3_protocol_sasl_digestMd5.py:1.1
--- /dev/null Thu Jan 31 11:02:14 2019
+++ pkgsrc/databases/py-ldap3/patches/patch-ldap3_protocol_sasl_digestMd5.py Thu Jan 31 11:02:14 2019
@@ -0,0 +1,164 @@
+$NetBSD: patch-ldap3_protocol_sasl_digestMd5.py,v 1.1 2019/01/31 11:02:14 leot Exp $
+
+Populate accidental empty file in released pypi distfile based on
+the 2.5.2 tagged release on GitHub repository.
+
+Reported upstream via:
+
+ <https://github.com/cannatag/ldap3/issues/636>
+
+--- ldap3/protocol/sasl/digestMd5.py.orig 2019-01-31 10:50:56.089214275 +0000
++++ ldap3/protocol/sasl/digestMd5.py
+@@ -0,0 +1,152 @@
++"""
++"""
++
++# Created on 2014.01.04
++#
++# Author: Giovanni Cannata
++#
++# Copyright 2014 - 2018 Giovanni Cannata
++#
++# This file is part of ldap3.
++#
++# ldap3 is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License as published
++# by the Free Software Foundation, either version 3 of the License, or
++# (at your option) any later version.
++#
++# ldap3 is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU Lesser General Public License for more details.
++#
++# You should have received a copy of the GNU Lesser General Public License
++# along with ldap3 in the COPYING and COPYING.LESSER files.
++# If not, see <http://www.gnu.org/licenses/>.
++
++from binascii import hexlify
++import hashlib
++import hmac
++
++from ... import SEQUENCE_TYPES
++from ...protocol.sasl.sasl import abort_sasl_negotiation, send_sasl_negotiation, random_hex_string
++
++
++STATE_KEY = 0
++STATE_VALUE = 1
++
++
++def md5_h(value):
++ if not isinstance(value, bytes):
++ value = value.encode()
++
++ return hashlib.md5(value).digest()
++
++
++def md5_kd(k, s):
++ if not isinstance(k, bytes):
++ k = k.encode()
++
++ if not isinstance(s, bytes):
++ s = s.encode()
++
++ return md5_h(k + b':' + s)
++
++
++def md5_hex(value):
++ if not isinstance(value, bytes):
++ value = value.encode()
++
++ return hexlify(value)
++
++
++def md5_hmac(k, s):
++ if not isinstance(k, bytes):
++ k = k.encode()
++
++ if not isinstance(s, bytes):
++ s = s.encode()
++
++ return hmac.new(k, s).hexdigest()
++
++
++def sasl_digest_md5(connection, controls):
++ # sasl_credential must be a tuple made up of the following elements: (realm, user, password, authorization_id)
++ # if realm is None will be used the realm received from the server, if available
++ if not isinstance(connection.sasl_credentials, SEQUENCE_TYPES) or not len(connection.sasl_credentials) == 4:
++ return None
++
++ # step One of RFC2831
++ result = send_sasl_negotiation(connection, controls, None)
++ if 'saslCreds' in result and result['saslCreds'] is not None:
++ server_directives = decode_directives(result['saslCreds'])
++ else:
++ return None
++
++ if 'realm' not in server_directives or 'nonce' not in server_directives or 'algorithm' not in server_directives: # mandatory directives, as per RFC2831
++ abort_sasl_negotiation(connection, controls)
++ return None
++
++ # step Two of RFC2831
++ charset = server_directives['charset'] if 'charset' in server_directives and server_directives['charset'].lower() == 'utf-8' else 'iso8859-1'
++ user = connection.sasl_credentials[1].encode(charset)
++ realm = (connection.sasl_credentials[0] if connection.sasl_credentials[0] else (server_directives['realm'] if 'realm' in server_directives else '')).encode(charset)
++ password = connection.sasl_credentials[2].encode(charset)
++ authz_id = connection.sasl_credentials[3].encode(charset) if connection.sasl_credentials[3] else b''
++ nonce = server_directives['nonce'].encode(charset)
++ cnonce = random_hex_string(16).encode(charset)
++ uri = b'ldap/'
++ qop = b'auth'
++
++ digest_response = b'username="' + user + b'",'
++ digest_response += b'realm="' + realm + b'",'
++ digest_response += (b'authzid="' + authz_id + b'",') if authz_id else b''
++ digest_response += b'nonce="' + nonce + b'",'
++ digest_response += b'cnonce="' + cnonce + b'",'
++ digest_response += b'digest-uri="' + uri + b'",'
++ digest_response += b'qop=' + qop + b','
++ digest_response += b'nc=00000001' + b','
++ if charset == 'utf-8':
++ digest_response += b'charset="utf-8",'
++
++ a0 = md5_h(b':'.join([user, realm, password]))
++ a1 = b':'.join([a0, nonce, cnonce, authz_id]) if authz_id else b':'.join([a0, nonce, cnonce])
++ a2 = b'AUTHENTICATE:' + uri + (':00000000000000000000000000000000' if qop in [b'auth-int', b'auth-conf'] else b'')
++
++ digest_response += b'response="' + md5_hex(md5_kd(md5_hex(md5_h(a1)), b':'.join([nonce, b'00000001', cnonce, qop, md5_hex(md5_h(a2))]))) + b'"'
++
++ result = send_sasl_negotiation(connection, controls, digest_response)
++ return result
++
++
++def decode_directives(directives_string):
++ """
++ converts directives to dict, unquote values
++ """
++
++ # old_directives = dict((attr[0], attr[1].strip('"')) for attr in [line.split('=') for line in directives_string.split(',')])
++ state = STATE_KEY
++ tmp_buffer = ''
++ quoting = False
++ key = ''
++ directives = dict()
++ for c in directives_string.decode('utf-8'):
++ if state == STATE_KEY and c == '=':
++ key = tmp_buffer
++ tmp_buffer = ''
++ state = STATE_VALUE
++ elif state == STATE_VALUE and c == '"' and not quoting and not tmp_buffer:
++ quoting = True
++ elif state == STATE_VALUE and c == '"' and quoting:
++ quoting = False
++ elif state == STATE_VALUE and c == ',' and not quoting:
++ directives[key] = tmp_buffer
++ tmp_buffer = ''
++ key = ''
++ state = STATE_KEY
++ else:
++ tmp_buffer += c
++
++ if key and tmp_buffer:
++ directives[key] = tmp_buffer
++
++ return directives
Home |
Main Index |
Thread Index |
Old Index