-
Notifications
You must be signed in to change notification settings - Fork 2
/
jailkit-lib.pl
54 lines (36 loc) · 1.03 KB
/
jailkit-lib.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/perl
use strict;
use warnings;
our (%config, %text);
=head1 jailkit-lib.pl
Functions for the Jailkit Webmin module
foreign_require("jailkit", "jailkit-lib.pl");
$jk_init_ini = jailkit::get_jk_init_ini();
$jk_init_ini will contain a list of hashrefs of configuration
directives from jk_init.ini.
=cut
BEGIN { push(@INC, ".."); }
eval "use WebminCore;";
init_config();
=head2 get_jk_init_ini()
Returns the jailkit configuration as a list of hash references with name and key value keys.
=cut
sub get_jk_init_ini {
use Config::IniFiles;
my $jk_init_ini = new Config::IniFiles(
-file => "$config{'jailkit_config_dir'}/jk_init.ini");
return $jk_init_ini;
}
=head2 write_jk_init_ini(\%jk_init_ini)
Write configuration file array to config file. May return an error object, if write fails.
=cut
sub write_jk_init_ini {
use Config::IniFiles;
my ($jk_init_ini) = @_;
my $result = $jk_init_ini->RewriteConfig($config{'jk_init_ini'});
unless ($result) {
error($text{'error_save_failed'});
}
return;
}
1;