/[smecontribs]/rpms/smeserver-denyhosts/contribs7/smeserver-denyhosts-2.6-patch2.patch
ViewVC logotype

Annotation of /rpms/smeserver-denyhosts/contribs7/smeserver-denyhosts-2.6-patch2.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Apr 22 05:19:37 2008 UTC (16 years, 6 months ago) by unnilennium
Branch: MAIN
CVS Tags: smeserver-denyhosts-2_6-0_6_el4_sme
panel correction expand template

1 unnilennium 1.1 --- smeserver-denyhosts-2.6/root/etc/e-smith/web/functions/denyhosts.patch2 2008-03-31 20:10:12.000000000 +0200
2     +++ smeserver-denyhosts-2.6/root/etc/e-smith/web/functions/denyhosts 2008-04-22 07:16:09.000000000 +0200
3     @@ -20,12 +20,6 @@
4     our $fm = esmith::FormMagick->new();
5     $fm->parse_xml();
6    
7     -#use Sys::Filesystem ();
8     -#use FileHandle;
9     -# use Shell qw (ls cat);
10     -#use File::Temp 0.12 qw(tempdir);
11     -#use File::Basename;
12     -
13     use esmith::cgi;
14     use esmith::config;
15     use esmith::util;
16     @@ -104,14 +98,10 @@
17    
18     print $q->hr;
19    
20     -
21     - #my @allowedhosts = `cat /var/lib/denyhosts/allowed-hosts`;
22     -
23    
24     print $q->h1 ($q->pre ($fm->localise('FM_ALLOWED_HOSTS')));
25    
26     print $q->hr;
27     - #print $q->p ($q->pre ("@allowedhosts"));
28    
29     print "<form name='modif'method='POST' action='denyhosts?state=modify' >";
30    
31     @@ -129,7 +119,7 @@
32     print "
33     <SELECT id =\"status\" name=\"status\"><option value =\"$cur_status\">
34     *$cur_status*</option><option value =\"disabled\">disabled</option>
35     -<option value =\"enabled\">enabled</option</SELECT>" ;
36     +<option value =\"enabled\">enabled</option></SELECT>" ;
37     print " ( ". `service denyhosts status`. " )";
38     print "<br><br>";
39     print_button($fm, 'SAVE');
40     @@ -148,26 +138,25 @@
41     my ($q) = @_;
42     my $ipvalide = ip_number_or_blank($q);
43     my $ip = $q->param ('ip');
44     - ##esmith::cgi::genHeaderNonCacheable ($q, \%conf, 'Hosts evils');
45     - #ajout de l'ip si demandé
46     + #add IP if asked
47     if ( $ipvalide eq 'OK' && defined($ip) && $ip ne "" )
48     {
49     add_new_valid_from($q);
50     - # faire un truc en cas de succes
51     + # add a message if success
52     }
53     - # suppression des entrées
54     + # remove entries
55     remove_valid_from($q);
56     - # mise a jour des templates
57     + # expand templates
58     # hosts.allow
59     # allowed hosts
60     updatetemplates();
61     - # modif status + restart service eventuel
62     + # modify status + restart service
63     updatestatus($q);
64    
65     # restart ou stop
66     reloadorstopservice();
67    
68     - #affichage
69     + #show panel
70     showInitial($q);
71     }
72    
73     @@ -191,7 +180,7 @@
74     {
75     `/sbin/e-smith/expand-template /etc/hosts.allow`;
76    
77     - `/sbin/e-smith/expand-template /var/lib/denyhosts/allowed-hosts `;
78     + `/sbin/e-smith/expand-template /usr/share/denyhosts/data/allowed-hosts `;
79     }
80    
81     sub reloadorstopservice
82     @@ -212,10 +201,6 @@
83     sub show_valid_from_list($)
84     {
85     my $self = shift;
86     - # my $q = new CGI;
87     - #$self->{cgi};
88     -
89     -
90     my @vals = _get_valid_from();
91     if (@vals)
92     {
93     @@ -246,19 +231,14 @@
94    
95     sub _get_valid_from
96     {
97     - #my $self = shift;
98     -
99     my $rec = $db->get('denyhosts');
100     - #my $rec = db_get_prop(\%conf,'denyhosts','ValidFrom');
101     return undef unless($rec);
102     my @vals = (split ',', ($rec->prop('ValidFrom') || ''));
103     - #my @vals = (split ',', ($rec || ''));
104     return @vals;
105     }
106    
107     sub ip_number_or_blank
108     {
109     - #my $self = $fm;
110     my $ip = $q->param ('ip');
111    
112     if (!defined($ip) || $ip eq "")
113     @@ -273,9 +253,7 @@
114    
115     sub add_new_valid_from
116     {
117     - #my $self = shift;
118     - #my $q = $_;
119     -
120     +
121     my $ip = $q->param ('ip');
122    
123     # do nothing if no network was added
124     @@ -285,7 +263,6 @@
125     unless ($rec)
126     {
127     return $q->error('ERR_NO_RECORD');
128     - #$self->error('ERR_NO_RECORD');
129     }
130    
131     my $prop = $rec->prop('ValidFrom') || '';
132     @@ -310,9 +287,7 @@
133    
134     sub remove_valid_from($)
135     {
136     - #my $self = shift;
137     - #my $q = $_;
138     -
139     +
140     my @remove = $q->param('validFromRemove');
141     my @vals = _get_valid_from();
142    
143     @@ -320,7 +295,6 @@
144     {
145     return undef unless $entry;
146    
147     - # my ($net) = plit (/\//, $entry);
148    
149     unless (@vals)
150     {

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed