--- smeserver-denyhosts-2.6/root/etc/e-smith/web/functions/denyhosts.patch2 2008-03-31 20:10:12.000000000 +0200 +++ smeserver-denyhosts-2.6/root/etc/e-smith/web/functions/denyhosts 2008-04-22 07:16:09.000000000 +0200 @@ -20,12 +20,6 @@ our $fm = esmith::FormMagick->new(); $fm->parse_xml(); -#use Sys::Filesystem (); -#use FileHandle; -# use Shell qw (ls cat); -#use File::Temp 0.12 qw(tempdir); -#use File::Basename; - use esmith::cgi; use esmith::config; use esmith::util; @@ -104,14 +98,10 @@ print $q->hr; - - #my @allowedhosts = `cat /var/lib/denyhosts/allowed-hosts`; - print $q->h1 ($q->pre ($fm->localise('FM_ALLOWED_HOSTS'))); print $q->hr; - #print $q->p ($q->pre ("@allowedhosts")); print "
"; @@ -129,7 +119,7 @@ print " " ; print " ( ". `service denyhosts status`. " )"; print "

"; print_button($fm, 'SAVE'); @@ -148,26 +138,25 @@ my ($q) = @_; my $ipvalide = ip_number_or_blank($q); my $ip = $q->param ('ip'); - ##esmith::cgi::genHeaderNonCacheable ($q, \%conf, 'Hosts evils'); - #ajout de l'ip si demandé + #add IP if asked if ( $ipvalide eq 'OK' && defined($ip) && $ip ne "" ) { add_new_valid_from($q); - # faire un truc en cas de succes + # add a message if success } - # suppression des entrées + # remove entries remove_valid_from($q); - # mise a jour des templates + # expand templates # hosts.allow # allowed hosts updatetemplates(); - # modif status + restart service eventuel + # modify status + restart service updatestatus($q); # restart ou stop reloadorstopservice(); - #affichage + #show panel showInitial($q); } @@ -191,7 +180,7 @@ { `/sbin/e-smith/expand-template /etc/hosts.allow`; - `/sbin/e-smith/expand-template /var/lib/denyhosts/allowed-hosts `; + `/sbin/e-smith/expand-template /usr/share/denyhosts/data/allowed-hosts `; } sub reloadorstopservice @@ -212,10 +201,6 @@ sub show_valid_from_list($) { my $self = shift; - # my $q = new CGI; - #$self->{cgi}; - - my @vals = _get_valid_from(); if (@vals) { @@ -246,19 +231,14 @@ sub _get_valid_from { - #my $self = shift; - my $rec = $db->get('denyhosts'); - #my $rec = db_get_prop(\%conf,'denyhosts','ValidFrom'); return undef unless($rec); my @vals = (split ',', ($rec->prop('ValidFrom') || '')); - #my @vals = (split ',', ($rec || '')); return @vals; } sub ip_number_or_blank { - #my $self = $fm; my $ip = $q->param ('ip'); if (!defined($ip) || $ip eq "") @@ -273,9 +253,7 @@ sub add_new_valid_from { - #my $self = shift; - #my $q = $_; - + my $ip = $q->param ('ip'); # do nothing if no network was added @@ -285,7 +263,6 @@ unless ($rec) { return $q->error('ERR_NO_RECORD'); - #$self->error('ERR_NO_RECORD'); } my $prop = $rec->prop('ValidFrom') || ''; @@ -310,9 +287,7 @@ sub remove_valid_from($) { - #my $self = shift; - #my $q = $_; - + my @remove = $q->param('validFromRemove'); my @vals = _get_valid_from(); @@ -320,7 +295,6 @@ { return undef unless $entry; - # my ($net) = plit (/\//, $entry); unless (@vals) {