void plugin_config_init () { plugin_config_file = config_file_new (NULL, PLUGIN_CONFIG_NAME, &plugin_config_reload, NULL, NULL); if (plugin_config_file) { plugin_config_section_var = config_file_new_section ( plugin_config_file, "var", 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &plugin_config_create_option, NULL, NULL, NULL, NULL, NULL); plugin_config_section_desc = config_file_new_section ( plugin_config_file, "desc", 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &plugin_config_create_desc, NULL, NULL, &plugin_config_delete_desc, NULL, NULL); } else { plugin_config_section_var = NULL; plugin_config_section_desc = NULL; } }
int secure_init_options () { struct t_config_section *ptr_section; secure_config_file = config_file_new (NULL, SECURE_CONFIG_NAME, &secure_reload_cb, NULL); if (!secure_config_file) return 0; /* crypt */ ptr_section = config_file_new_section (secure_config_file, "crypt", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { config_file_free (secure_config_file); return 0; } secure_config_crypt_cipher = config_file_new_option ( secure_config_file, ptr_section, "cipher", "integer", N_("cipher used to crypt data (the number after algorithm is the size " "of the key in bits)"), "aes128|aes192|aes256", 0, 0, "aes256", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); secure_config_crypt_hash_algo = config_file_new_option ( secure_config_file, ptr_section, "hash_algo", "integer", N_("hash algorithm used to check the decrypted data"), "sha224|sha256|sha384|sha512", 0, 0, "sha256", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); secure_config_crypt_passphrase_file = config_file_new_option ( secure_config_file, ptr_section, "passphrase_file", "string", N_("path to a file containing the passphrase to encrypt/decrypt secured " "data; this option is used only when reading file sec.conf; only " "first line of file is used; this file is used only if the " "environment variable \"WEECHAT_PASSPHRASE\" is not set (the " "environment variable has higher priority); security note: it is " "recommended to keep this file readable only by you and store it " "outside WeeChat home (for example in your home); example: " "\"~/.weechat-passphrase\""), NULL, 0, 0, "", NULL, 0, &secure_check_crypt_passphrase_file, NULL, NULL, NULL, NULL, NULL); secure_config_crypt_salt = config_file_new_option ( secure_config_file, ptr_section, "salt", "boolean", N_("use salt when generating key used in encryption (recommended for " "maximum security); when enabled, the content of crypted data in " "file sec.conf will be different on each write of the file; if you " "put the file sec.conf in a version control system, then you " "can turn off this option to have always same content in file"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* data */ ptr_section = config_file_new_section (secure_config_file, "data", 0, 0, &secure_data_read_cb, NULL, &secure_data_write_cb, NULL, &secure_data_write_cb, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { config_file_free (secure_config_file); return 0; } return 1; }