Isis Lovecruft
45cb40c8b1
Only process safe_args in gnupg.GPG.__init__() as a dict if it is one.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
c0265943e2
Create stricter checks on which gpg binary to call.
...
* Update documentation for gnupg.GPG.__init__().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
3784f0469b
Remove trailing whitespace in function _sanitise().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
c477033506
Change function _is_allowed() to check one option at a time.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
72b74d1960
Fix the _allowed frozenset to work with _hyphenate option string formatting.
...
* Change assertion checks to reflect the changes to _allowed.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
ffe82751b1
Remove vars frozenset from _is_allowed() because it is unnecessary.
...
* Using _allowed and _possible frozensets to store gpg options and flags instead.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
260814f939
Add class UsageError for future devs who incorrectly add feature sets.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
0af1c84fa6
Switch back to setting gnupg.GPG class as self.gpg.
...
* The doctests in test_gnupg.py require this, and it would be more work to change,
so just leave it as it was for now.
* Update documentation for the _which() function.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
745a581fea
Fix problem of attempting to sanitise non-existent options.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
01861c03da
Change variable names in GPG.__init__().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
f2fd09490c
Sanitise input parameters in function GPG.make_args().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
a58f4b0492
Add function _hyphenate().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
845ac96de8
Sanitise input 'options' to GPG.__init__().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
a228c91fa7
Fix variable names in assertions in GPG.__init__().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
e3dcbd9aa1
Change function _sanitise() to handle args being a string of multiple arguments.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
0312e32231
Change internal function variable 'vars' in _is_allowed() to use
...
_underscore(remove_prefix=True) option.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
1144d79a25
Update docsting for function _underscore().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
7008b10f69
Change function _underscore to handle stripping hyphen prefixes.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
8159d1c80f
Fix problem in function _is_file() to except TypeError if given None as input.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
eed5b7a8ac
Add note to remove the locale module later.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
8419542494
Create the gpghome directory if specified and if it doesn't exist.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
1f51375676
Fix unsanitised input for GPG() parameter 'keyring'.
...
* Add assertions for checking that parameters 'verbose' and 'use_agent' are
boolean values.
2013-03-18 19:36:29 +00:00
Isis Lovecruft
c6f8a0bb55
Update docstring and assertion statements for GPG.__init__().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
5dba39e0a3
Fix non-PEP-8 docstring in _underscore().
2013-03-18 19:36:29 +00:00
Isis Lovecruft
049b2ef91c
Catch TypeError in _fix_unsafe(), for cases where the input is None.
2013-03-18 19:36:28 +00:00
Isis Lovecruft
ea3e8aa86d
Fix unsanitised inputs for GPG() parameters 'gpgbinary' and 'gpghome'.
...
* Update all docstrings and functions to use 'gpghome' instead of
'gnupghome'.
2013-03-18 19:36:28 +00:00
Isis Lovecruft
427b72b5c1
Fixed misnamed parameters in functions _which() and _fix_unsafe().
2013-03-18 19:36:28 +00:00
Isis Lovecruft
dc52ab08a0
Change default key length in GPG.gen_key_input() to 2048 bits.
2013-03-18 19:36:28 +00:00
Isis Lovecruft
c483a509f3
Fix unsanitised user input vulnerability in GPG.recv_keys().
...
* Add wrapping of user inputs `keyids` and `keyserver` in calls to
_fix_unsafe().
* Apologies for the hairy ''.join([(lambda: x)() for x in keyids]), sort
of. Common Lisp was my first language and this is totally readable and
natural to me, and all the rest of you haters just need to get better at
functional programming.
2013-03-18 19:36:28 +00:00
Isis Lovecruft
f1a3ce9813
Remove extra whitespace.
2013-03-18 19:36:28 +00:00
Isis Lovecruft
8133abd851
Add function which implements the bash 'which' feature.
...
* Add function _which(), which is shamelessly stolen from Twisted's
twisted.python.procutils module.
2013-03-18 19:36:28 +00:00
Isis Lovecruft
7eff7b4a03
Cleanup a bit of non-PEP-8 conformant code.
2013-03-18 19:36:28 +00:00
Isis Lovecruft
2c6d06a4bc
Add function for checking that the read uid/gid has correct permissions.
...
* Add function _has_readwrite().
2013-03-18 19:36:28 +00:00
Isis Lovecruft
7598c53a84
Add note about parsing GPG keys in binary format.
2013-03-18 19:36:28 +00:00
Isis Lovecruft
80cf654a7f
Update docstring in GPG.import_keys().
2013-03-18 19:36:28 +00:00
Isis Lovecruft
e3d22f69e5
Fix unsanitized inputs in GPG.verify_file().
...
* Update docstring for GPG.verify_file().
2013-03-18 19:36:28 +00:00
Isis Lovecruft
f06fe7845a
Fix error introduced in 3c925e997e
...
* Fix error in _copy_data() due to wrong parameters in call to
logger.exception. *facepalm*
2013-03-18 19:36:28 +00:00
Isis Lovecruft
bffd7f59c7
Fix logic in GPG.sign_file().
...
* Fixes #1928 .
* If a user specified both clearsign=True and detach_sign=True, then the
original logic would go through the `if detach:` portion of the code,
appending to the argument string `"--detach-sign"` and then skip the `elif
clearsign:` block, which would mean that the default behaviour would be to
use --detach-sign, when the standard default behaviour for GnuPG, if it
receives both --detach-sign and --clearsign, is to only do --clearsign.
2013-03-06 18:00:46 +00:00
Isis Lovecruft
3c925e997e
Check that _copy_data() parameters are actually file descriptors.
...
* Closes #1920 .
2013-03-06 17:49:44 +00:00
Isis Lovecruft
8d6e12c0be
Fix possible IOError due to second write() call in _copy_data().
...
* Fixes #1931 .
2013-03-06 17:39:21 +00:00
Isis Lovecruft
6bd4eebc23
Fix documentation in GPG._handle_io().
2013-03-06 17:16:26 +00:00
Isis Lovecruft
253b8f557e
Fix blanket case except statement in _copy_data().
...
* Fixes #1922 .
2013-03-06 17:15:31 +00:00
Isis Lovecruft
6074a24c0b
Fix documentation in function _copy_data(). WONTFIX hanging FD problem #1921
...
* Won't fix hanging file descriptor problem due to this problem requiring a
complete rewrite of nearly every function in the module.
* Closes #1921 , #1927 , #1929 .
* Fix whitespace styling.
2013-03-06 17:11:57 +00:00
Isis Lovecruft
6f4c7f757d
Update documentation for function _sanitise().
2013-03-06 15:37:27 +00:00
Isis Lovecruft
abab2c53f2
Rewrite function _sanitise() with calls to other new check functions().
...
* Remove function _type_check_and_remove_escapes().
2013-03-06 15:35:52 +00:00
Isis Lovecruft
5f28127b6f
Add calls to _underscore() in _is_allowed() to avoid repeating the call in
...
other functions.
2013-03-06 15:35:11 +00:00
Isis Lovecruft
d4f3210011
Update documentation for function _is_allowed().
2013-03-06 15:34:11 +00:00
Isis Lovecruft
8aebd7dd8b
Update documentation for function _sanitise().
2013-03-06 15:13:40 +00:00
Isis Lovecruft
57a03cf71c
Separate out logic for determining if a GPG option is allowed.
...
* Add function _is_allowed().
* Update documentation for _is_allowed() and _sanitise().
2013-03-06 15:11:39 +00:00
Isis Lovecruft
d3c04e9a43
Whitespace fix.
2013-03-06 15:10:46 +00:00
Isis Lovecruft
9d2203508a
Separate function for switching option hyphenation to underscores for
...
assignment to object attributes.
2013-03-05 16:29:36 +00:00
Isis Lovecruft
58048935e9
Separate the regex shell escape find and replace, and quote wrapping logic,
...
into a separate function.
2013-03-05 16:25:20 +00:00
Isis Lovecruft
ccb90c564d
Separate lstat filesize checking assertion into a seperate function.
2013-03-05 16:12:07 +00:00
Isis Lovecruft
10309a61c3
Add gnupg options sanitising function.
2013-03-05 00:26:59 +00:00
Isis Lovecruft
25e3949633
Cleanup coding style and docstrings in old module code.
2013-03-05 00:07:50 +00:00
Isis Lovecruft
9e851f796d
Make GnuPG process attribute private in parser classes.
2013-03-05 00:06:32 +00:00
Isis Lovecruft
f85b723155
Remove call to write the GPG secret key passphrase into the logger.
2013-02-21 22:39:44 +00:00
Isis Lovecruft
4d31850c64
Add changes to module docstring and packaging attributes.
2013-02-21 22:36:47 +00:00
Isis Lovecruft
69b7f86529
Original source from code.google.com, version 0.3.2.
2013-02-13 21:19:18 +00:00