0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-12 09:41:18 +02:00

feat: add config path to PAM module

This commit is contained in:
Sayafdine Said 2023-06-25 17:13:12 +02:00
parent d0ca17b1ec
commit a92a3aade2
No known key found for this signature in database
GPG key ID: 7567D43648C6E2F4
4 changed files with 10 additions and 7 deletions

View file

@ -9,6 +9,8 @@ usermodelsdir = get_option('user_models_dir') != '' ? get_option('user_models_di
datadir = get_option('data_dir') != '' ? get_option('data_dir') : join_paths(get_option('prefix'), get_option('datadir'), 'howdy')
logpath = get_option('log_path')
config_path = join_paths(confdir, 'config.ini')
py_conf = configuration_data({
'config_dir': confdir,
'dlib_data_dir': dlibdatadir,
@ -57,7 +59,10 @@ else
pysourcesinstalldir = get_option('py_sources_dir') != '' ? get_option('py_sources_dir') : join_paths(get_option('prefix'), get_option('libdir'), 'howdy')
endif
compare_script_path = join_paths(pysourcesinstalldir, 'compare.py')
pam_module_conf_data = configuration_data({
'compare_script_path': join_paths(pysourcesinstalldir, 'compare.py') ,
'config_file_path': config_path,
})
subdir('pam')
if get_option('install_in_site_packages')
@ -81,7 +86,6 @@ endif
install_data('logo.png', install_tag: 'meta')
fs = import('fs')
config_path = join_paths(confdir, 'config.ini')
if not fs.exists(config_path)
install_data('config.ini', install_dir: confdir, install_mode: 'rwxr--r--', install_tag: 'config')
endif

View file

@ -197,7 +197,7 @@ auto check_enabled(const INIReader &config) -> int {
*/
auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
bool auth_tok) -> int {
INIReader config("/etc/howdy/config.ini");
INIReader config(CONFIG_FILE_PATH);
openlog("pam_howdy", 0, LOG_AUTHPRIV);
// Error out if we could not read the config file

View file

@ -7,12 +7,10 @@ threads = dependency('threads')
subdir('po')
# Paths
paths = { 'compare_script_path': compare_script_path }
paths_h = configure_file(
input: 'paths.hh.in',
output: 'paths.hh',
configuration: paths,
configuration: pam_module_conf_data,
install_dir: get_option('pam_dir')
)

View file

@ -1 +1,2 @@
const auto COMPARE_PROCESS_PATH = "@compare_script_path@";
const auto COMPARE_PROCESS_PATH = "@compare_script_path@";
const auto CONFIG_FILE_PATH = "@config_file_path@";