1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-06-06 19:17:48 +02:00
Commit Graph

663 Commits

Author SHA1 Message Date
kakwa
02357d886a remove debug print 2019-02-09 18:18:58 +01:00
kakwa
263e6be547 fix html validator test for python 3 2019-02-09 17:40:43 +01:00
kakwa
05aace0e9d force the groups in flatten roles to be sorted
* sorting the groups helps debuggability and also permits testing
that doesn't rely on python ordering (which is different between 2 and
3).
2019-02-09 17:36:01 +01:00
kakwa
baa3430e63 fix test and exception handling in code
With python 2 it was possible to do exception[0][...] to recover
details about an exception.
It's no longer authorized with python 3.
Now, we must do something like exception.args or exception.urls.
fortunately this syntax also works with python 2.
So we use it for both.
2019-02-09 17:12:39 +01:00
kakwa
90ff69586b remove deprecation warning for html escape
in python 2, (html) escape is part of the cgi module
in python 3, it's part of the html module

we now do a conditional import depending on the version, and name the
function html_escape.
2019-02-09 16:29:16 +01:00
kakwa
79983c078f fix behavior of get_attributes()
* make sure it returns an ordered list in both python 2 and python 3
2019-02-09 16:22:42 +01:00
kakwa
10747cff93 add some python 3 support in the LDAP and AD backends
python-ldap talks in bytes,
as the rest of ldapcherry talks in unicode utf-8:
* everything passed to python-ldap must be converted to bytes
* everything coming from python-ldap must be converted to unicode

The previous statement was true for python-ldap < version 3.X.
With versions > 3.0.0 and python 3, it gets tricky,
some parts of python-ldap takes string, specially the filters/escaper.

so we have now:
*_byte_p2 (unicode -> bytes conversion for python 2)
*_byte_p3 (unicode -> bytes conversion for python 3)
*_byte_p23 (unicode -> bytes conversion for python AND 3)
2019-02-09 16:08:18 +01:00
kakwa
979d4eeda8 disable ppolicy in samba test deployment 2019-02-09 15:42:48 +01:00
kakwa
fb6b0a5d31 limit cherrypy to < 18.0.0 in setup.py
cherrypy dropped support for python2 with 18.0.0, 17.X is the last
version usable with python 2.
2019-02-09 12:12:24 +01:00
kakwa
bbfe96d4f7 pep8 2019-02-09 12:05:09 +01:00
kakwa
b9437abefb * support for python-ldap 2 and 3
* python-ldap 3 is slightly different than 2 on how it handles modify
the modified attributes used to be transmitted as a dict, now it should
be transmitted as a list of dict)
2019-02-09 11:58:09 +01:00
kakwa
60d57d8530 changelog 2019-02-08 20:47:15 +01:00
kakwa
8c0bf94904 better log+fix in conf checking + fix in ppolicy handler
* log where the backend is declared (role or attribute) when
inconsistency with main .ini file
* fix check of configuration, only role file was checked 2 times instead
on checking role one time and attribute one time
* <dict>.keys() seems to have a different behavior between 2 (return
"list") and 3 (return "dict_keys"), casting to "list" to avoid that.
2019-02-08 20:38:29 +01:00
kakwa
42759f1cc4 pep8 2019-02-08 20:38:03 +01:00
kakwa
18fdeb483e better handling of the str/byte mess for python3
* add dedicated methods for python 3 in handling of bytearrays/strings
* using them to compare attributes checks in AD backend
2019-02-08 20:33:58 +01:00
kakwa
12c511b537 switch to explicit bytearray for checking missing params 2019-02-08 00:11:01 +01:00
kakwa
d25ceef2d3 trying to fix samba/AD setup 2019-02-07 23:46:10 +01:00
kakwa
8b48a1f024 cleanup in travis file 2019-02-07 22:59:57 +01:00
kakwa
7430af5ffc adding another samba package in test env 2019-02-07 22:44:51 +01:00
kakwa
bc0f3aceb5 adding another dependency for the samba/ad test 2019-02-07 22:42:30 +01:00
kakwa
9989f97091 remove python3 test env for el7 and stretch (no python3-ldap lib anyway) 2019-02-07 22:38:30 +01:00
kakwa
fc98b1bd70 fixing the test env deploy script + small fix in unit tests 2019-02-07 22:34:47 +01:00
kakwa
ab9cd664ec fix pip install 2019-02-07 22:12:49 +01:00
kakwa
13bfbdcbbc add requirements files for simulating RHEL 7 and Debian 9 2019-02-07 22:07:28 +01:00
kakwa
70140f966a pep 8 2019-02-07 21:09:42 +01:00
kakwa
8bd4afb235 remove scripts from pycodestyle 2019-02-07 21:07:36 +01:00
kakwa
2a2864a306 porting the tests over to python3 2019-02-07 20:55:50 +01:00
kakwa
c3feafdb2c pep8 2019-02-07 20:48:06 +01:00
kakwa
86fb6c1dd2 adding an update as the first step of the deploy script 2019-02-07 20:44:19 +01:00
kakwa
9f6af580cd remove env that doesn't exist 2019-02-07 20:41:22 +01:00
kakwa
5bdcc5522a switch to xenial in travis configuration 2019-02-07 20:40:22 +01:00
kakwa
c81429a870 few tweaks for python3 support
* switch from script to entry_points in setup.py
* move the cli script in ldapcherry (to be used as a module)
* put the __main__ code in a dedicated function constituting the entry
point
* add a few python3 environments in travis file
2019-02-07 20:34:49 +01:00
kakwa
3d6e24eb73 pep8 2019-02-07 20:16:39 +01:00
kakwa
be598b0129 slightly cleaner testenv deploy script 2019-02-06 23:55:03 +01:00
kakwa
ccc252965d fix another __import__ 2019-02-06 23:04:23 +01:00
kakwa
3beedc8d4d add an ignore on the local dev conf file 2019-02-06 23:03:55 +01:00
kakwa
74dc6c5894 various changes to support python3
* changes in urllib imports since quote_plus in urllib with python 2 and
in urllib.parse in python 3
* changes in imports for Sets since set is a native type in python 3 and
doesn't requires an import
* fix in __import__, '-1' level for module path discovery is not supported
anymore, switching to 0 (absolute import only).
2019-02-06 22:32:40 +01:00
kakwa
69526610f3 add a small script to generate a local dev config 2019-02-06 22:30:59 +01:00
kakwa
921a0820f4 switch to using lists in templates
Sets are not available in mako templates when using python3.
Reverting to using lists with 'if not in' checks to avoid duplication.
2019-02-06 22:26:46 +01:00
kakwa
2df56d2de2 fix template over-escaping + python 3 support
The templates were html escaping the generated js code for the
autofill and the role management. This was breaking these features.
It's okay to not escape these as they are coming from a trusted source
(configuration file).

Also make the templates python3 compatible (not need to import Set in
python 3)
2019-02-06 21:38:11 +01:00
Carpentier Pierre-Francois
5b0c72a572
Merge pull request #17 from jthiltges/escfix
Escape form values with markupsafe
2019-01-03 23:39:53 +01:00
John Thiltges
c6cce54d5f Escape form values with markupsafe
- Use markupsafe to format escaped HTML fragments
- Correct the formatting problems introduced with the XSS fixes
2019-01-03 13:12:53 -06:00
Carpentier Pierre-Francois
1f79648d57
Update ChangeLog.rst 2019-01-02 23:59:03 +01:00
Carpentier Pierre-Francois
636400b75f
Merge pull request #16 from jthiltges/escape
Protect against XSS vulnerabilities in URL redirection
2019-01-02 23:54:42 +01:00
John Thiltges
6f98076281 Protect against XSS vulnerabilities in URL redirection
- Switch from base64 to URL encoding for the passing the URL, using the built-in Mako filtering
- Apply HTML filtering to Mako output by default
- Disable HTML filtering for nested templates in adduser, modify, and selfmodify
2019-01-02 14:31:10 -06:00
Carpentier Pierre-Francois
1ed654c91b
Update README.rst 2018-02-07 19:54:23 +01:00
Carpentier Pierre-Francois
c329e53811
Update README.rst 2018-02-07 19:52:29 +01:00
Carpentier Pierre-Francois
05e3a0d665 Update README.rst 2017-10-26 10:08:16 +02:00
kakwa
4bd6314b3b remove useless tests 2017-06-12 19:50:42 +02:00
kakwa
c5dae7039a remove duplicated import in docs conf.py 2017-06-12 19:47:43 +02:00