-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mostly functional, delete bug in Authentic
- Loading branch information
Showing
7 changed files
with
241 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
|
||
our (%text, %in); | ||
require './jailkit-lib.pl'; | ||
ReadParse(); | ||
|
||
my $jk_init_ini = get_jk_init_ini(); | ||
my @sections = $jk_init_ini->Sections(); | ||
my %jail_params; | ||
|
||
my @d = split(/\0/, $in{'d'}); | ||
|
||
# If we've already confirmed go ahead an delete it | ||
if (defined $in{'confirmed'}) { | ||
foreach my $jail (@d) { | ||
if ($jk_init_ini->SectionExists($jail)) { | ||
$jk_init_ini->DeleteSection($jail); | ||
} | ||
else { | ||
# Does this jail exist? | ||
error( text('error_jail_not_found', "$jail", "<br>\n")); | ||
} | ||
} | ||
write_jk_init_ini($jk_init_ini); | ||
redirect(''); | ||
} | ||
else { | ||
ui_print_header(undef, $text{'index_delete_jail'}, ""); | ||
print "<center>\n"; | ||
|
||
# Check to be sure we really want these jails gone | ||
print ui_form_start("delete_jail.cgi", "post"); | ||
foreach my $jail (@d) { | ||
# Re-send all of the d_* items with a confirmed field | ||
print ui_hidden("d", $jail); | ||
} | ||
|
||
print $text{'delete_are_you_sure'}; | ||
print "<p>\n"; | ||
foreach my $del_jail (@d) { | ||
print "<i>$del_jail</i><br>\n"; | ||
} | ||
print "</p>\n"; | ||
|
||
print ui_hidden("confirmed", "1"); | ||
#print ui_submit($text{delete_confirm}, "confirm"); | ||
print ui_form_end([ [ "confirm", $text{'delete_confirm'} ] ]); | ||
print "</center>\n"; | ||
print "</div>\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
|
||
our (%text, %in); | ||
require './jailkit-lib.pl'; | ||
ReadParse(); | ||
|
||
my $jk_init_ini = get_jk_init_ini(); | ||
my @sections = $jk_init_ini->Sections(); | ||
my %jail_params; | ||
|
||
# Make a new section? | ||
if($in{'new'}) { | ||
ui_print_header(undef, $text{'index_create_jail'}, ""); | ||
# Keep new defined so we add a new section on save | ||
print ui_hidden("new", $in{'new'}); | ||
} | ||
else { | ||
ui_print_header(undef, $text{'index_edit_jail'}, ""); | ||
unless ( $jk_init_ini->SectionExists( $in{'jail'} )) { | ||
error( $text{'edit_jail_not_found'} ); | ||
}; | ||
# Populate the jail hash | ||
my @params = $jk_init_ini->Parameters( $in{'jail'} ); | ||
foreach my $param (@params){ | ||
$jail_params{$param} = $jk_init_ini->val( $in{'jail'}, $param ); | ||
} | ||
} | ||
|
||
print ui_form_start("save_jail.cgi"); | ||
print ui_hidden("orig_jail", $in{'jail'}); | ||
|
||
print ui_table_start( $text{'jail_detail'}, undef, 2); | ||
|
||
# name | ||
print ui_table_row( $text{'edit_jail_name'}, | ||
ui_textbox('jail', $in{'jail'})); | ||
# comment/description | ||
print ui_table_row( $text{'edit_jail_comment'}, | ||
ui_textbox('comment', $jail_params{'comment'})); | ||
# paths | ||
print ui_table_row( $text{'edit_jail_paths'}, | ||
ui_textarea('paths', $jail_params{'paths'})); | ||
print ui_table_row( $text{'edit_jail_paths_w_owner'}, | ||
ui_textarea('paths_w_owner', $jail_params{'paths_w_owner'})); | ||
print ui_table_row( $text{'edit_jail_users'}, | ||
ui_textarea('users', $jail_params{'users'})); | ||
print ui_table_row( $text{'edit_jail_groups'}, | ||
ui_textarea('groups', $jail_params{'groups'})); | ||
print ui_table_row( $text{'edit_jail_includesections'}, | ||
ui_textarea('includesections'), $jail_params{'includesections'}); | ||
print ui_table_row( $text{'edit_jail_emptydirs'}, | ||
ui_textbox('emptydirs', $jail_params{'emptydirs'})); | ||
print ui_table_row( $text{'edit_jail_devices'}, | ||
ui_textbox('devices', $jail_params{'devices'})); | ||
print ui_table_row( $text{'edit_jail_need_logsocket'}, | ||
ui_checkbox('need_logsocket', 1, | ||
undef, $jail_params{'need_logsocket'} ? 1 : 0)); | ||
|
||
print ui_table_end(); | ||
|
||
print ui_form_end([ [undef, $text{'save_jail'}] ]); | ||
|
||
&ui_print_footer("index.cgi", $text{'edit_jail_return'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,33 @@ | ||
index_title=Jailkit | ||
|
||
index_delete=Delete | ||
index_jail_id=Jail ID | ||
index_commment=Comment | ||
index_jails=Available Jails | ||
index_create_jail=Create a new Jail configuration | ||
index_create_jail=Create a new jail | ||
index_delete_jail=Delete selected | ||
index_initialize=Initialize Jail for user | ||
index_initialize=Initialize jail for user | ||
index_edit_jail=Edit Jail | ||
index_comment=Comment | ||
|
||
edit_jail_return=Return to jail list | ||
edit_jail_not_found=That jail doesn't exist! | ||
edit_jail_name=Jail ID | ||
edit_jail_comment=Comment | ||
edit_jail_paths=Paths to include in Jail | ||
edit_jail_paths_w_owner=Paths to include (keep ownership) | ||
edit_jail_users=Users to include in passwd | ||
edit_jail_groups=Groups to include in passwd | ||
edit_jail_need_logsocket=Log socket required? | ||
edit_jail_includesections=Other jails to inherit from | ||
edit_jail_emptydirs=Empty directories to create in jail | ||
edit_jail_devices=Devices to create in jail | ||
|
||
save_jail=Save Jail | ||
|
||
error_save_failed=Saving jail failed | ||
error_jail_exists=Jail already exists! | ||
error_jail_not_found=Jail named $1 doesn't exist! | ||
|
||
delete_are_you_sure=Are you sure you want to delete the following jail(s)? This action cannot be undone. | ||
delete_confirm=Delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/perl | ||
# save_config.cgi | ||
# Write updated settings.ini for bloctweet | ||
use warnings; | ||
use strict; | ||
|
||
our %in; | ||
our %text; | ||
|
||
require './jailkit-lib.pl'; | ||
|
||
my $jk_init_ini = get_jk_init_ini(); | ||
my @sections = $jk_init_ini->Sections(); | ||
my %jail_params; | ||
|
||
ReadParse(); | ||
|
||
# If new, create a new section | ||
if (defined $in{'new'}) { | ||
if ( $jk_init_ini->SectionExists( $in{'jail'} )) { | ||
error( $text{'error_jail_exists'} ); | ||
} | ||
$jk_init_ini->AddSection( $in{'jail'} ); | ||
} | ||
else { | ||
# Not new, make sure we update the name of the jail, if | ||
# changed | ||
if ( defined($in{'orig_jail'}) && defined($in{'jail'}) && | ||
$in{'orig_jail'} ne $in{'jail'} ) { | ||
$jk_init_ini->DeleteSection($in{'orig_jail'}); | ||
$jk_init_ini->AddSection( $in{'jail'}); | ||
} | ||
} | ||
|
||
if (length $in{'comment'}) { $jk_init_ini->newval($in{'jail'}, | ||
'comment', $in{'comment'}); } | ||
if (length $in{'paths'}) { $jk_init_ini->newval($in{'jail'}, | ||
'paths', $in{'paths'}); } | ||
if (length $in{'paths_w_owner'}) { $jk_init_ini->newval($in{'jail'}, | ||
'paths_w_owner', $in{'paths_w_owner'}); } | ||
if (length $in{'users'}) { $jk_init_ini->newval($in{'jail'}, | ||
'users', $in{'users'}); } | ||
if (length $in{'groups'}) { $jk_init_ini->newval($in{'jail'}, | ||
'groups', $in{'groups'}); } | ||
if (length $in{'need_logsocket'}) { $jk_init_ini->newval($in{'jail'}, | ||
'need_logsocket', $in{'need_logsocket'}); } | ||
if (length $in{'devices'}) { $jk_init_ini->newval($in{'jail'}, | ||
'devices', $in{'devices'}); } | ||
if (length $in{'includesections'}) { $jk_init_ini->newval($in{'jail'}, | ||
'includesections', $in{'includesections'}); } | ||
if (length $in{'emptydirs'}) { $jk_init_ini->newval($in{'jail'}, | ||
'emptydirs', $in{'emptydirs'}); } | ||
|
||
# Contributors | ||
#if (defined $in{'contributors'}) { | ||
# my @contributors = split(' ', $in{'contributors'}); | ||
# foreach my $contributor (@contributors) { | ||
# $bloctweet_config->{'contributors'}{$contributor} = '0'; | ||
# } | ||
#} | ||
|
||
write_jk_init_ini($jk_init_ini); | ||
|
||
redirect(''); |
This file was deleted.
Oops, something went wrong.