Commit Graph

272 Commits (master)

Author SHA1 Message Date
Sébastien Helleu 9fa3609c85 relay: add command "handshake" in weechat relay protocol and nonce to prevent replay attacks (closes #1474)
This introduces a new command called "handshake" in the weechat relay protocol.
It should be sent by the client before the "init" command, to negotiate the way
to authenticate with a password.

3 new options are added:

* relay.network.auth_password
* relay.network.hash_iterations
* relay.network.nonce_size
2020-04-14 21:38:12 +02:00
Sébastien Helleu 7fbd4c1079 tests: add missing include of locale.h
This fixes build of tests on FreeBSD.
2020-04-11 00:01:31 +02:00
Sébastien Helleu 9afe63b77a tests: fix name of tests 2020-04-10 23:43:27 +02:00
Sébastien Helleu 007fd03bc8 tests: add tests on calc functions
Functions tested:

- calc_operator_precedence
- calc_pop_value
- calc_list_free_cb
- calc_operation
- calc_operation_stacks
2020-04-08 21:38:51 +02:00
Sébastien Helleu a693125c81 tests: add missing include of stdio.h (issue #1469) 2020-04-07 22:20:11 +02:00
Sébastien Helleu d78ac827e9 core: fix memory leak in calculation of expression on FreeBSD (closes #1469)
The memory leak was caused by a bug in function setlocale on FreeBSD:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243195

The fix is the following:

* Remove the calls to setlocale when formatting the result.
* The function snprintf is still called, and then is now locale dependent,
  for example in French the decimal separator is a comma instead of a dot.
* A new function calc_sanitize_decimal_number is introduced to "sanitize" a
  decimal number: keep only the decimal separator (replace it by a dot) and
  remove any other separator found.

Unit tests are added on these functions:

* calc_sanitize_decimal_number
* calc_format_result
2020-04-07 21:37:48 +02:00
Sébastien Helleu c59f812c74 tests: add tests on function irc_protocol_cb_353 with option irc.look.color_nicks_in_names set to on 2020-03-31 21:16:09 +02:00
Sébastien Helleu eb7b12f0da tests: add tests on IRC color functions
Functions tested:

- irc_color_convert_rgb2irc
- irc_color_convert_term2irc
- irc_color_for_tags
- irc_color_modifier_cb
- irc_color_weechat_add_to_infolist
2020-03-30 20:58:16 +02:00
Sébastien Helleu 052d4d1fc0 tests: add test with remapped color in function irc_color_decode 2020-03-30 20:55:43 +02:00
Sébastien Helleu 8738196b68 tests: add tests on remaining IRC protocol functions and callbacks 2020-03-28 16:06:45 +01:00
Sébastien Helleu f072eb8d78 tests: add tests on function irc_protocol_get_message_tags 2020-03-28 13:40:39 +01:00
Sébastien Helleu 4245641767 tests: add tests on function irc_protocol_cb_ping 2020-03-26 23:05:34 +01:00
Sébastien Helleu b82a887f2a tests: add tests on function irc_protocol_cb_part 2020-03-25 20:48:54 +01:00
Sébastien Helleu cecbad1803 tests: add test with no arguments for AWAY command 2020-03-24 16:58:11 +01:00
Sébastien Helleu 9fac350b3f tests: add tests on IRC protocol functions with not enough arguments 2020-03-24 16:56:57 +01:00
Sébastien Helleu 4480c7b7cc irc: split AUTHENTICATE message in 400-byte chunks (closes #1459) 2020-03-21 14:28:53 +01:00
Sébastien Helleu 5c1dfcbe5b tests: add tests on functions irc_protocol_cb_mode and irc_protocol_cb_nick 2020-03-19 23:01:59 +01:00
Sébastien Helleu b45d461c3a tests: add tests on functions irc_protocol_cb_kick and irc_protocol_cb_kill 2020-03-18 22:27:15 +01:00
Sébastien Helleu a709dd05a6 tests: add tests on function irc_protocol_cb_join 2020-03-17 20:54:07 +01:00
Sébastien Helleu 332a4adc26 tests: add tests on function irc_protocol_cb_chghost 2020-03-16 20:49:50 +01:00
Sébastien Helleu 851d1fb00a tests: rename function run_cmd_server to server_recv 2020-03-15 07:19:16 +01:00
Sébastien Helleu aa3941fee2 tests: always run callback in calls to function config_file_option_set 2020-03-13 23:12:22 +01:00
Sébastien Helleu 9545d37ab0 tests: add tests on IRC protocol functions and some callbacks
Functions tested:

* irc_protocol_is_numeric_command
* irc_protocol_log_level_for_command
* irc_protocol_tags
* irc_protocol_nick_address
* irc_protocol_cb_account
* irc_protocol_cb_away
* irc_protocol_cb_001
* irc_protocol_cb_005
2020-03-11 20:53:49 +01:00
Sébastien Helleu dcd10657b1 tests: add tests on functions weecrypto_totp_generate and weecrypto_totp_validate 2020-03-05 22:21:48 +01:00
Sébastien Helleu dabf32f213 tests: add tests on functions weecrypto_hash and weecrypto_hash_pbkdf2 with NULL hash 2020-03-04 08:24:46 +01:00
Sébastien Helleu 4afaacd34e tests: add tests on function weecrypto_get_hash_algo 2020-03-03 21:29:44 +01:00
Sébastien Helleu 2d7829b2d5 core: require libgcrypt >= 1.7.0 for SHA3 algorithms 2020-03-02 21:49:30 +01:00
Sébastien Helleu c6757f642f tests: fix generation of test scripts with Python 3.8 2020-03-02 21:39:27 +01:00
Sébastien Helleu 2d2b49bfaa relay: accept hash of password in init command with option "password_hash"
Allowed algorithms are:

* PBKDF2 (SHA256 or SHA512, salt, iterations)
* SHA256
* SHA512
2020-03-02 00:46:10 +01:00
Sébastien Helleu 3157d1f06e api: add function crypto_hash_pbkdf2 2020-03-01 23:14:55 +01:00
Sébastien Helleu 9a6a27ef58 core: move crypto functions to wee-crypto.c, rename API function string_hash to crypto_hash 2020-03-01 21:24:27 +01:00
Sébastien Helleu c4ef3d6c2e core: merge functions string_hash_binary and string_hash into a single function string_hash 2020-03-01 16:41:28 +01:00
Sébastien Helleu 1ae2591458 core: add function secure_hash_pbkdf2 2020-03-01 14:26:24 +01:00
Sébastien Helleu 7449bc8827 core: add support of CRC32 algorithm in hash functions 2020-02-29 21:12:13 +01:00
Sébastien Helleu 410a5b341f api: add functions string_hash_binary and string_hash 2020-02-29 21:02:42 +01:00
Sébastien Helleu 600c43dcf5 tests: add tests on function secure_derive_key 2020-02-29 15:46:25 +01:00
Sébastien Helleu e2135fc3eb core: add functions to compute binary/hex hash of data 2020-02-29 15:46:25 +01:00
Sébastien Helleu 39f2591cf5 tests: add tests on ANSI default text/background colors 2020-02-08 10:29:07 +01:00
Sébastien Helleu 84648a5cd8 tests: add eval tests with debug enabled 2020-02-04 20:56:59 +01:00
Sébastien Helleu f76a5a8b57 tests: add unit tests on function util_file_get_content 2020-02-03 21:39:06 +01:00
Sébastien Helleu 3edae5af86 tests: add unit tests on function util_get_time_diff 2020-02-02 13:58:35 +01:00
Sébastien Helleu d2dda92daf tests: add eval tests with hdata variables of different types 2020-01-27 23:04:24 +01:00
Sébastien Helleu b7c09ed084 tests: add eval tests on conditions with text after closing parenthesis 2020-01-27 23:04:24 +01:00
Sébastien Helleu a6a6fb74c2 tests: add eval tests on conditions with leading and trailing spaces (ignored) 2020-01-27 23:04:24 +01:00
Sébastien Helleu 2839dc7ddf tests: add eval tests on "regex not matching" comparison 2020-01-27 23:04:24 +01:00
Sébastien Helleu 0975c407e0 tests: add eval tests with hdata list name and pointer 2020-01-27 23:04:24 +01:00
Sébastien Helleu 201b4da169 tests: add eval tests with buffer local variables 2020-01-27 23:04:24 +01:00
Sébastien Helleu 8107b5d162 tests: add eval tests on options with different types 2020-01-27 23:04:24 +01:00
Sébastien Helleu dd13393896 tests: add eval test with empty value for "date:" 2020-01-27 23:04:24 +01:00
Sébastien Helleu 70f0c81a2c tests: add eval tests with invalid values for "modifier:" 2020-01-27 23:04:24 +01:00