Skip to content

Commit

Permalink
Switching to Config::Simple because comments
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed Jan 20, 2017
1 parent 54df0cb commit 82acd49
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion config
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
jailkit_config_dir=/etc/jailkit
jk_init_ini=/etc/jailkit/jk_init.ini
jk_init_ini=jk_init.ini
13 changes: 8 additions & 5 deletions index.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ui_print_header(undef, $text{'index_title'}, "", "index", 1, 1, 0,
undef, undef, undef, undef);

my @table;
foreach my $jail (keys %$jk_init_ini) {
foreach my $jail (keys %{$jk_init_ini}) {
push(@table, [
{ 'type' => 'checkbox', 'name' => 'd',
'value' => $jail,
Expand All @@ -24,16 +24,19 @@ foreach my $jail (keys %$jk_init_ini) {

my @buttons;
push(@buttons, [
[ "delete", $text{'jk_delete'} ]
[ "delete", $text{'index_delete_jail'} ]
]);

my @actions;
push(@actions, [
[ "create", $text{'jk_create'} ]
[ "create", $text{'index_create_jail'} ]
]);

ui_form_columns_table('delete_jk_init.cgi', @buttons, 1, @actions, \@table);
use Data::Dumper;
print "<!-- " . Dumper($jk_init_ini) . " -->\n";

print "<!-- " . Dumper(get_jk_init_ini()) . " -->\n";

print ui_form_end([ [ "save", $text{'form_save'} ] ]); # save_config
ui_form_columns_table('delete_jk_init.cgi', @buttons, 1, @actions, \@table);

ui_print_footer("/", $text{'index'});
13 changes: 7 additions & 6 deletions jailkit-lib.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl

use strict;
use warnings;
Expand All @@ -13,7 +13,7 @@ =head1 jailkit-lib.pl
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
$jk_init_ini will contain a list of hashrefs of configuration
directives from jk_init.ini.
=cut
Expand All @@ -29,13 +29,14 @@ =head2 get_jk_init_ini()
=cut

sub get_jk_init_ini {
use Config::INI::Reader;
use Config::Simple;

my $config = Config::INI::Reader->read_file($config{'jk_init_ini'});
return $config;
my $jk_init_ini = new Config::Simple('/etc/jailkit/jk_init.ini');
#"$config{'jailkit_config_dir'}/$config{'jk_init_ini'}");
return \%$jk_init_ini;
}

=head2 write_jk_init_config(\%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.
Expand Down

0 comments on commit 82acd49

Please sign in to comment.