Hidden Z
d50bb7a66f
web: avoid importing or accessing modules using "web.*"
14 years ago
Hidden Z
ad386eea71
Add __init__.py where needed
14 years ago
Hidden Z
489f1c9f15
web/lib/utils.py: add workaround for django
...
It helps to avoid multiple root loggers.
14 years ago
Hidden Z
4fa014add4
web/lib/utils.py: remove unneeded check_logger_options()
14 years ago
Hidden Z
c9c4e189e4
web/lib/utils.py: add validate_config()
...
New function for handle config validation.
http://www.voidspace.org.uk/python/articles/configobj.shtml#validation
14 years ago
Hidden Z
891472cfac
web/lib/utils.py: add check_logger_options()
...
We need to check config options for logger in various scripts, and this
check is almost same, so move it to separate function.
14 years ago
Hidden Z
1cff3cedcb
web/lib/utils.py: bugfix: take WatchedFileHandler properly
14 years ago
Hidden Z
d9eb21932e
web/lib/validation.py: add validate_i2purl()
...
We need it for URL validation when adding external hosts sources.
14 years ago
Hidden Z
9f3773cebf
web/lib/validation.py: use plain ValidationError
14 years ago
Hidden Z
e1be09b22f
web/lib/utils.py: use WatchedFileHandler
...
Let admins safely rotate the logfiles with logrotate(8).
14 years ago
Hidden Z
85263b65cc
web/lib/utils.py: a set of various utils for project
...
And firstly write get_logger() function. It provides common mechanism
for creating logger instances inside scripts.
14 years ago
Hidden Z
893d84c08f
web/lib/validation.py: disallow localhost.*
14 years ago
Hidden Z
f34a78c9ab
web/lib/validation.py: disallow *b32.i2p and *b64.i2p
14 years ago
Hidden Z
700391d6e8
validation.py: check for pasting i2p router hash
14 years ago
Hidden Z
a287860619
validation.py: fail if hash contains .i2p= (full foo.i2p=key)
14 years ago
Hidden Z
ac349547f5
validation.py: check for passing b32 address instead of base64 hash
14 years ago
Hidden Z
0cd7556774
validation.py: strip leading and trailing whitespaces from hash before processing
14 years ago
Hidden Z
5803016ec3
validation.py: update docstring for validate_hostname()
14 years ago
Hidden Z
b5c5a4051c
validation.py: check for http:/ in hostname
...
This is a common error.
14 years ago
Hidden Z
5da0cc4b59
validation.py: check if only ".i2p" supplied as hostname
...
This is a common error.
14 years ago
Hidden Z
9ea9db109a
validation.py: fix typo in message
14 years ago
Hidden Z
2ab7b2de5f
validation.py: Allow only 4ld domains and below
14 years ago
Hidden Z
0c45032178
validation.py: enhance IDN-check
...
Previously olny IDN hostnames which starts with xn-- was allowed, now
subdomains like subdomains.xn--foobar.i2p are also allowed.
14 years ago
Hidden Z
ac3df58a3f
validation.py: hostname must not start with '.' or '-'
...
I just forgot to add this rule earlier.
14 years ago
Hidden Z
76e4ee94ce
validation.py: add hostname lenght check
...
That's not really needed, just added for avoiding
django.db.utils.DatabaseError exceptions when trying to add too long
hostname with py-i2phosts-injector
14 years ago
Hidden Z
01e01b98fa
validation.py: bugfix: look for '..' in a whole hostname, not in namepart only
14 years ago
Hidden Z
573efddf8b
validation.py: strip leading and trailing whitespaces from hostname
14 years ago
Hidden Z
6a50774e5f
web/lib/validation.py: add comment
14 years ago
Hidden Z
bb2582c62c
web/lib/validation.py: add base64-validity check
...
Base 64 hash shouldn't require more than 2 pad chars to be divided to 4
without leftover.
14 years ago
Hidden Z
2b535dbf2b
web/lib/validation.py: new b64 length check
...
b64 hash shouldn't be longer than 616 bytes. We already have length
limit in database model, but this way we can provide our custom error
message.
14 years ago
Hidden Z
bc3118ab44
web/lib/validation.py: call len() for "data" only once
...
Sort of optimisation.
14 years ago
Hidden Z
f3a79838e6
web/lib/validation.py: fix base64 validations according to zzz's explanation
14 years ago
Hidden Z
2769f0d4bc
Move validation functions to separate module
14 years ago