From a13004608d1d37c060adf4dfcca1ffcb65df1ee1 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Mon, 11 Dec 2017 22:02:28 -0800 Subject: [PATCH] Trim trailing whitespace throughout project - Trim whitespace from end of lines - Trim whitespace from end of files Helps avoid spurious changes during pull requests, which leads to cleaner diffs during code reviews. --- .github/ISSUE_TEMPLATE.md | 8 ++-- .gitignore | 1 - Build/build-openbsd/Makefile | 2 +- Build/build-openbsd/pkg/DESCR | 2 +- Build/setup.cfg.mingw | 4 +- Build/setup.cfg.suse-linux | 2 +- Demo/Lib/ldap/async/deltree.py | 2 +- Demo/Lib/ldif/ldifcopy.py | 1 - Demo/matchedvalues.py | 1 - Demo/options.py | 4 -- Demo/pyasn1/sessiontrack.py | 1 - Demo/pyasn1/syncrepl.py | 4 +- Demo/schema.py | 2 +- Demo/schema_tree.py | 1 - Demo/simple.py | 5 +-- Demo/simplebrowse.py | 5 +-- Doc/installing.rst | 1 - Doc/reference/ldap-async.rst | 1 - Doc/reference/ldap-dn.rst | 1 - Doc/reference/ldap-extop.rst | 1 - Doc/reference/ldap-filter.rst | 1 - Doc/reference/ldap-sasl.rst | 3 +- Doc/reference/ldap-syncrepl.rst | 1 - Doc/reference/ldap.rst | 3 +- Doc/reference/ldapurl.rst | 1 - Doc/reference/ldif.rst | 1 - Doc/sample_workflow.rst | 1 - LICENCE | 1 - Lib/ldap/constants.py | 2 +- Lib/ldap/controls/deref.py | 2 +- Lib/ldapurl.py | 1 - Lib/slapdtest/certs/ca.pem | 4 +- Lib/slapdtest/certs/client.pem | 4 +- Lib/slapdtest/certs/server.pem | 6 +-- Modules/LDAPObject.c | 78 ++++++++++++++++----------------- Modules/LDAPObject.h | 5 +-- Modules/berval.h | 4 +- Modules/common.c | 2 +- Modules/common.h | 5 +-- Modules/functions.c | 4 +- Modules/ldapcontrol.c | 10 ++--- Modules/message.c | 4 +- Modules/message.h | 4 +- Modules/options.c | 10 ++--- Tests/t_ldap_asyncsearch.py | 1 - Tests/t_ldap_sasl.py | 1 - Tests/t_ldif.py | 4 +- setup.cfg | 4 +- setup.py | 2 +- tox.ini | 2 +- 50 files changed, 96 insertions(+), 124 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 41306bec..9cae6c11 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -12,12 +12,12 @@ Issue description: -Steps to reproduce: +Steps to reproduce: -Operating system: +Operating system: -Python version: +Python version: -python-ldap version: +python-ldap version: diff --git a/.gitignore b/.gitignore index 962248fe..0034b3a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ - # Auto-generated .*.swp *.pyc diff --git a/Build/build-openbsd/Makefile b/Build/build-openbsd/Makefile index ce91fafe..40ad81cb 100644 --- a/Build/build-openbsd/Makefile +++ b/Build/build-openbsd/Makefile @@ -10,7 +10,7 @@ HOMEPAGE= https://www.python-ldap.org/ FAKE= Yes CONFIGURE_STYLE= gnu SEPARATE_BUILD= Yes -EXTRACT_ONLY= +EXTRACT_ONLY= CONFIGURE_ARGS+= --with-ldap=${LOCALBASE} diff --git a/Build/build-openbsd/pkg/DESCR b/Build/build-openbsd/pkg/DESCR index d3cf0ccf..9e58e627 100644 --- a/Build/build-openbsd/pkg/DESCR +++ b/Build/build-openbsd/pkg/DESCR @@ -1,2 +1,2 @@ -This Python library provides access to the LDAP (Lightweight Directory Access +This Python library provides access to the LDAP (Lightweight Directory Access Protocol) RFC1823 C interface. diff --git a/Build/setup.cfg.mingw b/Build/setup.cfg.mingw index 16ab57fc..ffbd0d8a 100644 --- a/Build/setup.cfg.mingw +++ b/Build/setup.cfg.mingw @@ -15,8 +15,8 @@ defines = WIN32 library_dirs = C:/msys/1.0/home/mcicogni/openldap-mingw-build-4/openldap-2.2.18/libraries/libldap_r/.libs C:/msys/1.0/home/mcicogni/openldap-mingw-build-4/openldap-2.2.18/libraries/liblber/.libs C:\msys\1.0\home\mcicogni\openldap-mingw-build-4\openssl-0.9.7e include_dirs = C:/msys/1.0/home/mcicogni/openldap-mingw-build-4/openldap-2.2.18/include -extra_compile_args = -extra_objects = +extra_compile_args = +extra_objects = libs = ldap_r lber ssl crypto ws2_32 gdi32 diff --git a/Build/setup.cfg.suse-linux b/Build/setup.cfg.suse-linux index 3ea064d2..0a48ef2d 100644 --- a/Build/setup.cfg.suse-linux +++ b/Build/setup.cfg.suse-linux @@ -8,7 +8,7 @@ library_dirs = /usr/lib/sasl2 include_dirs = /usr/include/sasl -extra_compile_args = +extra_compile_args = extra_objects = # Example for full-featured SuSE build: diff --git a/Demo/Lib/ldap/async/deltree.py b/Demo/Lib/ldap/async/deltree.py index 68d3643e..d3fc6203 100644 --- a/Demo/Lib/ldap/async/deltree.py +++ b/Demo/Lib/ldap/async/deltree.py @@ -5,7 +5,7 @@ class DeleteLeafs(ldap.async.AsyncSearchHandler): """ Class for deleting entries which are results of a search. - + DNs of Non-leaf entries are collected in DeleteLeafs.nonLeafEntries. """ _entryResultTypes = ldap.async._entryResultTypes diff --git a/Demo/Lib/ldif/ldifcopy.py b/Demo/Lib/ldif/ldifcopy.py index 62cb3919..3bbe3f30 100644 --- a/Demo/Lib/ldif/ldifcopy.py +++ b/Demo/Lib/ldif/ldifcopy.py @@ -20,4 +20,3 @@ process_url_schemes=['file','ftp','http'] ) ldif_collector.parse() - diff --git a/Demo/matchedvalues.py b/Demo/matchedvalues.py index 59c594ff..7a6e7b6b 100644 --- a/Demo/matchedvalues.py +++ b/Demo/matchedvalues.py @@ -61,4 +61,3 @@ def print_result(search_result): res = ld.search_ext_s(base, scope, filter, attrlist = ['mail'], serverctrls = [mv]) print("Matched values control: %s" % control_filter) print_result(res) - diff --git a/Demo/options.py b/Demo/options.py index 8b4e2159..28a04374 100644 --- a/Demo/options.py +++ b/Demo/options.py @@ -24,7 +24,3 @@ #print("time limit:",l.get_option(ldap.OPT_TIMELIMIT)) print("Binding...") l.simple_bind_s("","") - - - - diff --git a/Demo/pyasn1/sessiontrack.py b/Demo/pyasn1/sessiontrack.py index 33ddddab..58a34e82 100644 --- a/Demo/pyasn1/sessiontrack.py +++ b/Demo/pyasn1/sessiontrack.py @@ -58,4 +58,3 @@ ldap_url.attrs or ['*'], serverctrls=[st_ctrl] ) - diff --git a/Demo/pyasn1/syncrepl.py b/Demo/pyasn1/syncrepl.py index 36147920..906e2689 100644 --- a/Demo/pyasn1/syncrepl.py +++ b/Demo/pyasn1/syncrepl.py @@ -93,8 +93,8 @@ def syncrepl_present(self,uuids,refreshDeletes=False): # If we have not been given any UUID values, # then we have recieved all the present controls... if uuids is None: - # We only do things if refreshDeletes is false as the syncrepl - # extension will call syncrepl_delete instead when it detects a + # We only do things if refreshDeletes is false as the syncrepl + # extension will call syncrepl_delete instead when it detects a # delete notice if refreshDeletes is False: deletedEntries = [ diff --git a/Demo/schema.py b/Demo/schema.py index 4d350f02..03f90a83 100644 --- a/Demo/schema.py +++ b/Demo/schema.py @@ -47,7 +47,7 @@ attr_type_filter = [ ('no_user_mod',[0]), ('usage',range(2)), - ] + ] ) except KeyError as e: print('***KeyError',str(e)) diff --git a/Demo/schema_tree.py b/Demo/schema_tree.py index 79c8a837..648bb86f 100644 --- a/Demo/schema_tree.py +++ b/Demo/schema_tree.py @@ -98,4 +98,3 @@ def HTMLSchemaTree(schema,se_class,se_tree,se_oid,level): print('\n*** Attribute types tree ***\n') PrintSchemaTree(schema,ldap.schema.AttributeType,at_tree,'_',0) - diff --git a/Demo/simple.py b/Demo/simple.py index 6004c9ef..5fa04250 100644 --- a/Demo/simple.py +++ b/Demo/simple.py @@ -97,11 +97,10 @@ # res = l.search_s( - "ou=CSEE, o=UQ, c=AU", - _ldap.SCOPE_SUBTREE, + "ou=CSEE, o=UQ, c=AU", + _ldap.SCOPE_SUBTREE, "objectclass=*", ) print(res) l.unbind() - diff --git a/Demo/simplebrowse.py b/Demo/simplebrowse.py index d13c3680..9d138003 100644 --- a/Demo/simplebrowse.py +++ b/Demo/simplebrowse.py @@ -50,7 +50,7 @@ # We're not interested in attributes at this stage, so # we specify [] as the list of attribute names to retreive. # - for name,attrs in l.search_s(dn, ldap.SCOPE_ONELEVEL, + for name,attrs in l.search_s(dn, ldap.SCOPE_ONELEVEL, "objectclass=*", []): #-- shorten resulting dns for output brevity if name.startswith(dn+", "): @@ -100,7 +100,7 @@ print(" %-24s" % name) for k,vals in attrs.items(): for v in vals: - if len(v) > 200: + if len(v) > 200: v = `v[:200]` + \ ("... (%d bytes)" % len(v)) else: @@ -125,4 +125,3 @@ except: print_exc() - diff --git a/Doc/installing.rst b/Doc/installing.rst index 01d39c7f..28045092 100644 --- a/Doc/installing.rst +++ b/Doc/installing.rst @@ -253,4 +253,3 @@ Debugging symbols are preserved with compile option ``-g``. extra_objects = libs = ldap_r lber sasl2 ssl crypto - diff --git a/Doc/reference/ldap-async.rst b/Doc/reference/ldap-async.rst index 76245f60..d7a18405 100644 --- a/Doc/reference/ldap-async.rst +++ b/Doc/reference/ldap-async.rst @@ -112,4 +112,3 @@ for writing search results as LDIF to stdout. :: s.endResultBreak-s.beginResultsDropped ) ) - diff --git a/Doc/reference/ldap-dn.rst b/Doc/reference/ldap-dn.rst index c22a64c4..3e0bbb5f 100644 --- a/Doc/reference/ldap-dn.rst +++ b/Doc/reference/ldap-dn.rst @@ -107,4 +107,3 @@ Splitting a LDAPv3 DN with a multi-valued RDN into its AVA parts: >>> ldap.dn.str2dn('cn=John Doe+mail=john.doe@example.com,dc=example,dc=com') [[('cn', 'John Doe', 1), ('mail', 'john.doe@example.com', 1)], [('dc', 'example', 1)], [('dc', 'com', 1)]] - diff --git a/Doc/reference/ldap-extop.rst b/Doc/reference/ldap-extop.rst index 607f3f00..8fe49f42 100644 --- a/Doc/reference/ldap-extop.rst +++ b/Doc/reference/ldap-extop.rst @@ -38,4 +38,3 @@ This requires :py:mod:`pyasn1` and :py:mod:`pyasn1_modules` to be installed. .. autoclass:: ldap.extop.dds.RefreshResponse :members: - diff --git a/Doc/reference/ldap-filter.rst b/Doc/reference/ldap-filter.rst index 577befbc..b08d5e9b 100644 --- a/Doc/reference/ldap-filter.rst +++ b/Doc/reference/ldap-filter.rst @@ -35,4 +35,3 @@ The :mod:`ldap.filter` module defines the following functions: whole filter string. .. % -> string - diff --git a/Doc/reference/ldap-sasl.rst b/Doc/reference/ldap-sasl.rst index 96f13aa5..9a8c96aa 100644 --- a/Doc/reference/ldap-sasl.rst +++ b/Doc/reference/ldap-sasl.rst @@ -35,7 +35,7 @@ Classes .. autoclass:: ldap.sasl.sasl :members: - + This class is used with :py:meth:`ldap.LDAPObject.sasl_interactive_bind_s()`. @@ -82,4 +82,3 @@ and sends a SASL external bind request. ldap_conn.sasl_non_interactive_bind_s('EXTERNAL') # Find out the SASL Authorization Identity print ldap_conn.whoami_s() - diff --git a/Doc/reference/ldap-syncrepl.rst b/Doc/reference/ldap-syncrepl.rst index d3717dfb..b3b2cf9a 100644 --- a/Doc/reference/ldap-syncrepl.rst +++ b/Doc/reference/ldap-syncrepl.rst @@ -20,4 +20,3 @@ This module defines the following classes: .. autoclass:: ldap.syncrepl.SyncreplConsumer :members: - diff --git a/Doc/reference/ldap.rst b/Doc/reference/ldap.rst index 277520e8..3b706a5f 100644 --- a/Doc/reference/ldap.rst +++ b/Doc/reference/ldap.rst @@ -956,7 +956,7 @@ and wait for and return with the server's result, or with .. py:method:: LDAPObject.sasl_interactive_bind_s(who, auth[, serverctrls=None [, clientctrls=None [, sasl_flags=ldap.SASL_QUIET]]]) -> None This call is used to bind to the directory with a SASL bind request. - + *auth* is an :py:class:`ldap.sasl.sasl()` instance. *serverctrls* and *clientctrls* like described in section :ref:`ldap-controls`. @@ -1196,4 +1196,3 @@ subtree search. >>> for dn,entry in r: >>> print('Processing',repr(dn)) >>> handle_ldap_entry(entry) - diff --git a/Doc/reference/ldapurl.rst b/Doc/reference/ldapurl.rst index 86d0817b..96b5ed24 100644 --- a/Doc/reference/ldapurl.rst +++ b/Doc/reference/ldapurl.rst @@ -124,4 +124,3 @@ with \module{ldapurl} module. >>> ldap_url = ldapurl.LDAPUrl(hostport='localhost:1389',dn='dc=stroeder,dc=com',attrs=['cn','mail'],who='cn=Michael,dc=stroeder,dc=com',cred='secret') >>> ldap_url.unparse() 'ldap://localhost:1389/dc=stroeder,dc=com?cn,mail?base?(objectclass=*)?bindname=cn=Michael%2Cdc=stroeder%2Cdc=com,X-BINDPW=secret' - diff --git a/Doc/reference/ldif.rst b/Doc/reference/ldif.rst index 1a9eabc3..84242676 100644 --- a/Doc/reference/ldif.rst +++ b/Doc/reference/ldif.rst @@ -82,4 +82,3 @@ with :mod:`ldif` module, skip some entries and write the result to stdout. :: parser = MyLDIF(open("input.ldif", 'rb'), sys.stdout) parser.parse() - diff --git a/Doc/sample_workflow.rst b/Doc/sample_workflow.rst index 97e51c67..c2010c1a 100644 --- a/Doc/sample_workflow.rst +++ b/Doc/sample_workflow.rst @@ -1,4 +1,3 @@ - .. _sample workflow: Sample workflow for python-ldap development diff --git a/LICENCE b/LICENCE index 1338962e..733e8cfc 100644 --- a/LICENCE +++ b/LICENCE @@ -1,4 +1,3 @@ - The python-ldap package is distributed under Python-style license. Standard disclaimer: diff --git a/Lib/ldap/constants.py b/Lib/ldap/constants.py index 4c109ac4..0445b02c 100644 --- a/Lib/ldap/constants.py +++ b/Lib/ldap/constants.py @@ -16,7 +16,7 @@ from __future__ import print_function class Constant(object): - """Base class for a definition of an OpenLDAP constant + """Base class for a definition of an OpenLDAP constant """ def __init__(self, name, optional=False, requirements=(), doc=None): diff --git a/Lib/ldap/controls/deref.py b/Lib/ldap/controls/deref.py index 762ab855..a18b6b2f 100644 --- a/Lib/ldap/controls/deref.py +++ b/Lib/ldap/controls/deref.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -ldap.controls.deref - classes for +ldap.controls.deref - classes for (see https://tools.ietf.org/html/draft-masarati-ldap-deref) See https://www.python-ldap.org/ for project details. diff --git a/Lib/ldapurl.py b/Lib/ldapurl.py index 262b6b02..13fbff8a 100644 --- a/Lib/ldapurl.py +++ b/Lib/ldapurl.py @@ -429,4 +429,3 @@ def __delattr__(self,name): pass else: del self.__dict__[name] - diff --git a/Lib/slapdtest/certs/ca.pem b/Lib/slapdtest/certs/ca.pem index cf2ff33c..55b0b884 100644 --- a/Lib/slapdtest/certs/ca.pem +++ b/Lib/slapdtest/certs/ca.pem @@ -36,9 +36,9 @@ Certificate: CA:TRUE X509v3 Key Usage: critical Certificate Sign, CRL Sign - X509v3 Subject Key Identifier: + X509v3 Subject Key Identifier: 3B:1F:32:F4:FE:57:D1:6F:49:91:55:F2:24:F1:0A:66:3B:A5:EE:D4 - X509v3 Authority Key Identifier: + X509v3 Authority Key Identifier: keyid:3B:1F:32:F4:FE:57:D1:6F:49:91:55:F2:24:F1:0A:66:3B:A5:EE:D4 Signature Algorithm: sha256WithRSAEncryption diff --git a/Lib/slapdtest/certs/client.pem b/Lib/slapdtest/certs/client.pem index 33b95a73..cdcae7c6 100644 --- a/Lib/slapdtest/certs/client.pem +++ b/Lib/slapdtest/certs/client.pem @@ -38,9 +38,9 @@ Certificate: Digital Signature X509v3 Extended Key Usage: critical TLS Web Client Authentication - X509v3 Subject Key Identifier: + X509v3 Subject Key Identifier: 67:63:38:F4:B4:BC:F3:6B:BC:74:0E:7C:27:C9:BB:C2:CC:58:AC:16 - X509v3 Authority Key Identifier: + X509v3 Authority Key Identifier: keyid:3B:1F:32:F4:FE:57:D1:6F:49:91:55:F2:24:F1:0A:66:3B:A5:EE:D4 Signature Algorithm: sha256WithRSAEncryption diff --git a/Lib/slapdtest/certs/server.pem b/Lib/slapdtest/certs/server.pem index 7e750596..2dcf81d4 100644 --- a/Lib/slapdtest/certs/server.pem +++ b/Lib/slapdtest/certs/server.pem @@ -38,12 +38,12 @@ Certificate: Digital Signature, Key Encipherment X509v3 Extended Key Usage: critical TLS Web Server Authentication - X509v3 Subject Key Identifier: + X509v3 Subject Key Identifier: 1B:78:45:40:0D:50:8A:8B:3B:C1:0A:F8:3F:7A:48:7B:A6:3C:28:09 - X509v3 Authority Key Identifier: + X509v3 Authority Key Identifier: keyid:3B:1F:32:F4:FE:57:D1:6F:49:91:55:F2:24:F1:0A:66:3B:A5:EE:D4 - X509v3 Subject Alternative Name: + X509v3 Subject Alternative Name: DNS:localhost, IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1 Signature Algorithm: sha256WithRSAEncryption ad:08:3f:7d:b1:09:a1:a5:6c:c3:58:80:1d:e5:33:a5:bb:c0: diff --git a/Modules/LDAPObject.c b/Modules/LDAPObject.c index addbe961..166f10fd 100644 --- a/Modules/LDAPObject.c +++ b/Modules/LDAPObject.c @@ -21,10 +21,10 @@ static void free_attrs(char***); /* constructor */ LDAPObject* -newLDAPObject( LDAP* l ) +newLDAPObject( LDAP* l ) { LDAPObject* self = (LDAPObject*) PyObject_NEW(LDAPObject, &LDAP_Type); - if (self == NULL) + if (self == NULL) return NULL; self->ldap = l; self->_save = NULL; @@ -53,8 +53,8 @@ dealloc( LDAPObject* self ) * utility functions */ -/* - * check to see if the LDAPObject is valid, +/* + * check to see if the LDAPObject is valid, * ie has been opened, and not closed. An exception is set if not valid. */ @@ -86,8 +86,8 @@ LDAPMod_DEL( LDAPMod* lm ) PyMem_DEL(lm); } -/* - * convert a tuple of the form (int,str,[str,...]) +/* + * convert a tuple of the form (int,str,[str,...]) * or (str, [str,...]) if no_op is true, into an LDAPMod structure. * See ldap_modify(3) for details. * @@ -99,7 +99,7 @@ LDAPMod_DEL( LDAPMod* lm ) /* XXX - there is no way to pass complex-structured BER objects in here! */ static LDAPMod* -Tuple_to_LDAPMod( PyObject* tup, int no_op ) +Tuple_to_LDAPMod( PyObject* tup, int no_op ) { int op; char *type; @@ -177,7 +177,7 @@ Tuple_to_LDAPMod( PyObject* tup, int no_op ) nomem: PyErr_NoMemory(); error: - if (lm) + if (lm) LDAPMod_DEL(lm); return NULL; @@ -193,8 +193,8 @@ LDAPMods_DEL( LDAPMod** lms ) { PyMem_DEL(lms); } -/* - * convert a list of tuples into a LDAPMod*[] array structure +/* + * convert a list of tuples into a LDAPMod*[] array structure * NOTE: list of tuples must live longer than the LDAPMods */ @@ -218,13 +218,13 @@ List_to_LDAPMods( PyObject *list, int no_op ) { } lms = PyMem_NEW(LDAPMod *, len + 1); - if (lms == NULL) + if (lms == NULL) goto nomem; for (i = 0; i < len; i++) { lms[i] = NULL; item = PySequence_GetItem(list, i); - if (item == NULL) + if (item == NULL) goto error; lms[i] = Tuple_to_LDAPMod(item, no_op); Py_DECREF(item); @@ -546,7 +546,7 @@ l_ldap_simple_bind( LDAPObject* self, PyObject* args ) auth modules ("mechanisms"), or try ldapsearch -b "" -s base -LLL -x supportedSASLMechanisms - + (perhaps with an additional -h and -p argument for ldap host and port). The latter will show you which SASL mechanisms are known to the LDAP server. If you do not want to set up Kerberos, you @@ -566,7 +566,7 @@ l_ldap_simple_bind( LDAPObject* self, PyObject* args ) argument specifies, which information should be passed back to the SASL lib (see SASL_CB_xxx in sasl.h) */ -static int interaction ( unsigned flags, +static int interaction ( unsigned flags, sasl_interact_t *interact, PyObject* SASLObject ) { @@ -578,14 +578,14 @@ static int interaction ( unsigned flags, "isss", interact->id, /* see sasl.h */ interact->challenge, - interact->prompt, + interact->prompt, interact->defresult); - if (result == NULL) + if (result == NULL) /*searching for a better error code */ - return LDAP_OPERATIONS_ERROR; + return LDAP_OPERATIONS_ERROR; c_result = PyBytes_AsString(result); /*xxx Error checking?? */ - + /* according to the sasl docs, we should malloc() the returned string only for calls where interact->id == SASL_CB_PASS, so we probably leak a few bytes per ldap bind. However, if I restrict @@ -599,15 +599,15 @@ static int interaction ( unsigned flags, /* We _should_ overwrite the python string buffer for security reasons, however we may not (api/stringObjects.html). Any ideas? */ - + Py_DECREF(result); /*not needed any longer */ result = NULL; - + return LDAP_SUCCESS; } -/* +/* This function will be called by ldap_sasl_interactive_bind(). The "*in" is an array of sasl_interact_t's (see sasl.h for a reference). The last interact in the array has an interact->id of @@ -615,8 +615,8 @@ static int interaction ( unsigned flags, */ -int py_ldap_sasl_interaction( LDAP *ld, - unsigned flags, +int py_ldap_sasl_interaction( LDAP *ld, + unsigned flags, void *defaults, void *in ) { @@ -672,7 +672,7 @@ l_ldap_sasl_bind_s( LDAPObject* self, PyObject* args ) dn, mechanism, cred.bv_val ? &cred : NULL, - (LDAPControl**) server_ldcs, + (LDAPControl**) server_ldcs, (LDAPControl**) client_ldcs, &servercred); LDAP_END_ALLOW_THREADS( self ); @@ -688,7 +688,7 @@ l_ldap_sasl_bind_s( LDAPObject* self, PyObject* args ) return PyInt_FromLong( ldaperror ); } -static PyObject* +static PyObject* l_ldap_sasl_interactive_bind_s( LDAPObject* self, PyObject* args ) { char *c_mechanism; @@ -705,12 +705,12 @@ l_ldap_sasl_interactive_bind_s( LDAPObject* self, PyObject* args ) static unsigned sasl_flags = LDAP_SASL_QUIET; - /* + /* * In Python 2.3+, a "I" format argument indicates that we're either converting * the Python object into a long or an unsigned int. In versions prior to that, * it will always convert to a long. Since the sasl_flags variable is an * unsigned int, we need to use the "I" flag if we're running Python 2.3+ and a - * "i" otherwise. + * "i" otherwise. */ #if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION < 3) if (!PyArg_ParseTuple(args, "sOOOi", &who, &SASLObject, &serverctrls, &clientctrls, &sasl_flags )) @@ -745,13 +745,13 @@ l_ldap_sasl_interactive_bind_s( LDAPObject* self, PyObject* args ) Python object SASLObject, but passing it through some static variable would destroy thread safety, IMHO. */ - msgid = ldap_sasl_interactive_bind_s(self->ldap, - who, - c_mechanism, - (LDAPControl**) server_ldcs, + msgid = ldap_sasl_interactive_bind_s(self->ldap, + who, + c_mechanism, + (LDAPControl**) server_ldcs, (LDAPControl**) client_ldcs, - sasl_flags, - py_ldap_sasl_interaction, + sasl_flags, + py_ldap_sasl_interaction, SASLObject); LDAPControl_List_DEL( server_ldcs ); @@ -1025,7 +1025,7 @@ l_ldap_result4( LDAPObject* self, PyObject *args ) if (!PyArg_ParseTuple( args, "|iidiii", &msgid, &all, &timeout, &add_ctrls, &add_intermediates, &add_extop )) return NULL; if (not_valid(self)) return NULL; - + if (timeout >= 0) { tvp = &tv; set_timeval_from_double( tvp, timeout ); @@ -1075,7 +1075,7 @@ l_ldap_result4( LDAPObject* self, PyObject *args ) } ber_bvfree( retdata ); } - + LDAP_BEGIN_ALLOW_THREADS( self ); rc = ldap_parse_result( self->ldap, msg, &result, NULL, NULL, &refs, &serverctrls, 0 ); @@ -1205,7 +1205,7 @@ l_ldap_search_ext( LDAPObject* self, PyObject* args ) return LDAPerror( self->ldap, "ldap_search_ext" ); return PyInt_FromLong( msgid ); -} +} /* ldap_whoami_s (available since OpenLDAP 2.1.13) */ @@ -1337,7 +1337,7 @@ l_ldap_passwd( LDAPObject* self, PyObject *args ) user.bv_len = (ber_len_t) user_len; oldpw.bv_len = (ber_len_t) oldpw_len; newpw.bv_len = (ber_len_t) newpw_len; - + if (not_valid(self)) return NULL; if (!PyNone_Check(serverctrls)) { @@ -1361,7 +1361,7 @@ l_ldap_passwd( LDAPObject* self, PyObject *args ) client_ldcs, &msgid ); LDAP_END_ALLOW_THREADS( self ); - + LDAPControl_List_DEL( server_ldcs ); LDAPControl_List_DEL( client_ldcs ); @@ -1411,7 +1411,7 @@ l_ldap_extended_operation( LDAPObject* self, PyObject *args ) client_ldcs, &msgid ); LDAP_END_ALLOW_THREADS( self ); - + LDAPControl_List_DEL( server_ldcs ); LDAPControl_List_DEL( client_ldcs ); diff --git a/Modules/LDAPObject.h b/Modules/LDAPObject.h index 8cd6fc3e..ade61232 100644 --- a/Modules/LDAPObject.h +++ b/Modules/LDAPObject.h @@ -1,7 +1,7 @@ /* See https://www.python-ldap.org/ for details. */ -#ifndef __h_LDAPObject -#define __h_LDAPObject +#ifndef __h_LDAPObject +#define __h_LDAPObject #include "common.h" @@ -48,4 +48,3 @@ extern LDAPObject *newLDAPObject( LDAP* ); } #endif /* __h_LDAPObject */ - diff --git a/Modules/berval.h b/Modules/berval.h index 9702b8ce..2aa9c977 100644 --- a/Modules/berval.h +++ b/Modules/berval.h @@ -1,7 +1,7 @@ /* See https://www.python-ldap.org/ for details. */ -#ifndef __h_berval -#define __h_berval +#ifndef __h_berval +#define __h_berval #include "common.h" #include "lber.h" diff --git a/Modules/common.c b/Modules/common.c index 0f0cd36a..58ecbd84 100644 --- a/Modules/common.c +++ b/Modules/common.c @@ -6,7 +6,7 @@ /* dynamically add the methods into the module dictionary d */ void -LDAPadd_methods( PyObject* d, PyMethodDef* methods ) +LDAPadd_methods( PyObject* d, PyMethodDef* methods ) { PyMethodDef *meth; diff --git a/Modules/common.h b/Modules/common.h index 029f234f..c5c5401d 100644 --- a/Modules/common.h +++ b/Modules/common.h @@ -1,8 +1,8 @@ /* common utility macros * See https://www.python-ldap.org/ for details. */ -#ifndef __h_common -#define __h_common +#ifndef __h_common +#define __h_common #define PY_SSIZE_T_CLEAN @@ -36,4 +36,3 @@ void LDAPadd_methods( PyObject*d, PyMethodDef*methods ); #endif #endif /* __h_common_ */ - diff --git a/Modules/functions.c b/Modules/functions.c index a31be05e..d1f22752 100644 --- a/Modules/functions.c +++ b/Modules/functions.c @@ -46,8 +46,8 @@ l_ldap_str2dn( PyObject* unused, PyObject *args ) * ((('a','b',1),('c','d',1)),(('e','f',1),)) * The integers are a bit combination of the AVA_* flags */ - if (!PyArg_ParseTuple( args, "z#|i:str2dn", - &str.bv_val, &str_len, &flags )) + if (!PyArg_ParseTuple( args, "z#|i:str2dn", + &str.bv_val, &str_len, &flags )) return NULL; str.bv_len = (ber_len_t) str_len; diff --git a/Modules/ldapcontrol.c b/Modules/ldapcontrol.c index 9522d572..e6d2fd8e 100644 --- a/Modules/ldapcontrol.c +++ b/Modules/ldapcontrol.c @@ -27,13 +27,13 @@ LDAPControl_DumpList( LDAPControl** lcs ) { } */ /* Free a single LDAPControl object created by Tuple_to_LDAPControl */ - + static void LDAPControl_DEL( LDAPControl* lc ) { if (lc == NULL) return; - + if (lc->ldctl_oid) PyMem_DEL(lc->ldctl_oid); PyMem_DEL(lc); @@ -78,7 +78,7 @@ Tuple_to_LDAPControl( PyObject* tup ) if (!PyArg_ParseTuple( tup, "sbO", &oid, &iscritical, &bytes )) return NULL; - + lc = PyMem_NEW(LDAPControl, 1); if (lc == NULL) { PyErr_NoMemory(); @@ -110,7 +110,7 @@ Tuple_to_LDAPControl( PyObject* tup ) LDAPControl_DEL(lc); return NULL; } - + lc->ldctl_value = berbytes; return lc; @@ -126,7 +126,7 @@ LDAPControls_from_object(PyObject* list, LDAPControl ***controls_ret) LDAPControl** ldcs; LDAPControl* ldc; PyObject* item; - + if (!PySequence_Check(list)) { LDAPerror_TypeError("expected a list", list); return 0; diff --git a/Modules/message.c b/Modules/message.c index b7f3ae79..25d28b71 100644 --- a/Modules/message.c +++ b/Modules/message.c @@ -46,8 +46,8 @@ LDAPmessage_to_python(LDAP *ld, LDAPMessage *m, int add_ctrls, int add_intermedi char *dn; char *attr; BerElement *ber = NULL; - PyObject* entrytuple; - PyObject* attrdict; + PyObject* entrytuple; + PyObject* attrdict; PyObject* pydn; dn = ldap_get_dn( ld, entry ); diff --git a/Modules/message.h b/Modules/message.h index c3522ac3..00af517f 100644 --- a/Modules/message.h +++ b/Modules/message.h @@ -1,7 +1,7 @@ /* See https://www.python-ldap.org/ for details. */ -#ifndef __h_message -#define __h_message +#ifndef __h_message +#define __h_message #include "common.h" #include "lber.h" diff --git a/Modules/options.c b/Modules/options.c index ee606d46..3ccb9ffa 100644 --- a/Modules/options.c +++ b/Modules/options.c @@ -23,7 +23,7 @@ option_error(int res, const char *fn) PyErr_SetString(PyExc_ValueError, "option error"); else if (res == LDAP_PARAM_ERROR) PyErr_SetString(PyExc_ValueError, "parameter error"); - else if (res == LDAP_NO_MEMORY) + else if (res == LDAP_NO_MEMORY) PyErr_NoMemory(); else PyErr_Format(PyExc_SystemError, "error %d from %s", res, fn); @@ -184,14 +184,14 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value) PyErr_Format(PyExc_ValueError, "unknown option %d", option); return 0; } - + if (self) LDAP_BEGIN_ALLOW_THREADS(self); res = ldap_set_option(ld, option, ptr); if (self) LDAP_END_ALLOW_THREADS(self); if ((option == LDAP_OPT_SERVER_CONTROLS) || (option == LDAP_OPT_CLIENT_CONTROLS)) LDAPControl_List_DEL(controls); - + if (res != LDAP_OPT_SUCCESS) { option_error(res, "ldap_set_option"); return 0; @@ -223,7 +223,7 @@ LDAP_get_option(LDAPObject *self, int option) if (self) LDAP_END_ALLOW_THREADS(self); if (res != LDAP_OPT_SUCCESS) return option_error(res, "ldap_get_option"); - + /* put the extensions into tuple form */ num_extensions = 0; while (apiinfo.ldapai_extensions[num_extensions]) @@ -382,7 +382,7 @@ LDAP_get_option(LDAPObject *self, int option) v = LDAPControls_to_List(lcs); ldap_controls_free(lcs); return v; - + default: PyErr_Format(PyExc_ValueError, "unknown option %d", option); return NULL; diff --git a/Tests/t_ldap_asyncsearch.py b/Tests/t_ldap_asyncsearch.py index 8b469669..1b89050d 100644 --- a/Tests/t_ldap_asyncsearch.py +++ b/Tests/t_ldap_asyncsearch.py @@ -22,4 +22,3 @@ def test_deprecated(self): if __name__ == '__main__': unittest.main() - diff --git a/Tests/t_ldap_sasl.py b/Tests/t_ldap_sasl.py index 7f472cc6..16e67123 100644 --- a/Tests/t_ldap_sasl.py +++ b/Tests/t_ldap_sasl.py @@ -95,4 +95,3 @@ def test_external_tlscert(self): if __name__ == '__main__': unittest.main() - diff --git a/Tests/t_ldif.py b/Tests/t_ldif.py index adf0d262..125a0789 100644 --- a/Tests/t_ldif.py +++ b/Tests/t_ldif.py @@ -465,7 +465,7 @@ def test_weird_empty_lines(self): """ # comment before version - + version: 1 @@ -584,7 +584,7 @@ def test_weird_empty_lines(self): """ # comment before version - + version: 1 diff --git a/setup.cfg b/setup.cfg index 374dd42e..7742ace6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,8 +14,8 @@ # ./configure --with-cyrus-sasl --with-tls defines = HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R -extra_compile_args = -extra_objects = +extra_compile_args = +extra_objects = # Example for full-featured build: # Support for StartTLS/LDAPS, SASL bind and reentrant libldap_r. diff --git a/setup.py b/setup.py index 3d7d338b..37602bd6 100644 --- a/setup.py +++ b/setup.py @@ -95,7 +95,7 @@ class OpenLDAP2: from Python programs. Mainly it wraps the OpenLDAP 2.x libs for that purpose. Additionally the package contains modules for other LDAP-related stuff (e.g. processing LDIF, LDAPURLs, LDAPv3 schema, LDAPv3 extended operations - and controls, etc.). + and controls, etc.). """, author = 'python-ldap project', author_email = 'python-ldap@python.org', diff --git a/tox.ini b/tox.ini index 6d984c0f..a9e032d0 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ minver = 1.8 [testenv] deps = coverage passenv = WITH_GCOV -# - Enable BytesWarning +# - Enable BytesWarning # - Turn all warnings into exceptions. # - 'ignore:the imp module is deprecated' is required to ignore import of # 'imp' in distutils. Python 3.3 and 3.4 use PendingDeprecationWarning.