]>
Commit | Line | Data |
---|---|---|
a29b9649 DM |
1 | package PMG::RuleDB::Virus; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
a29b9649 DM |
5 | use DBI; |
6 | use Digest::SHA; | |
7 | ||
758c7b6b | 8 | use PMG::Utils; |
a29b9649 DM |
9 | use PMG::RuleDB::Object; |
10 | ||
11 | use base qw(PMG::RuleDB::Object); | |
12 | ||
13 | sub otype { | |
14 | return 3001; | |
15 | } | |
16 | ||
17 | sub oclass { | |
18 | return 'what'; | |
19 | } | |
20 | ||
21 | sub otype_text { | |
22 | return 'Virus Filter'; | |
23 | } | |
24 | ||
a29b9649 DM |
25 | sub oisedit { |
26 | return 0; | |
27 | } | |
28 | ||
29 | sub new { | |
30 | my ($type, $ogroup) = @_; | |
31 | ||
32 | my $class = ref($type) || $type; | |
33 | ||
7a2cf7e6 | 34 | my $self = $class->SUPER::new($class->otype(), $ogroup); |
a29b9649 DM |
35 | |
36 | return $self; | |
37 | } | |
38 | ||
39 | sub load_attr { | |
40 | my ($type, $ruledb, $id, $ogroup, $value) = @_; | |
41 | ||
42 | my $class = ref($type) || $type; | |
43 | ||
44 | my $obj = $class->new ($ogroup); | |
45 | $obj->{id} = $id; | |
46 | ||
47 | $obj->{digest} = Digest::SHA::sha1_hex($id, $ogroup); | |
48 | ||
49 | return $obj; | |
50 | } | |
51 | ||
52 | sub save { | |
53 | my ($self, $ruledb) = @_; | |
54 | ||
55 | defined($self->{ogroup}) || return undef; | |
56 | ||
57 | if (defined ($self->{id})) { | |
58 | # update | |
59 | ||
60 | # nothing to update | |
61 | } else { | |
62 | # insert | |
63 | ||
64 | my $sth = $ruledb->{dbh}->prepare( | |
65 | "INSERT INTO Object (Objectgroup_ID, ObjectType) VALUES (?, ?);"); | |
66 | ||
67 | $sth->execute($self->ogroup, $self->otype); | |
68 | ||
758c7b6b | 69 | $self->{id} = PMG::Utils::lastid($ruledb->{dbh}, 'object_id_seq'); |
a29b9649 DM |
70 | } |
71 | ||
72 | return $self->{id}; | |
73 | } | |
74 | ||
75 | sub what_match { | |
76 | my ($self, $queue, $entity, $msginfo) = @_; | |
77 | ||
78 | if ($queue->{vinfo}) { | |
79 | return []; | |
80 | } | |
81 | ||
82 | return undef; | |
83 | } | |
84 | ||
85 | sub short_desc { | |
86 | my $self = shift; | |
87 | ||
88 | return "active"; | |
89 | } | |
90 | ||
d6efb336 DC |
91 | sub properties { |
92 | my ($class) = @_; | |
93 | ||
94 | return { }; | |
95 | } | |
96 | ||
97 | sub get { | |
98 | my ($self) = @_; | |
99 | ||
100 | return { }; | |
101 | } | |
102 | ||
103 | sub update { | |
104 | my ($self, $param) = @_; | |
105 | } | |
106 | ||
a29b9649 DM |
107 | 1; |
108 | ||
109 | __END__ | |
110 | ||
111 | =head1 PMG::RuleDB::Virus | |
112 | ||
113 | Virus filter |