|
|
|
@ -44,7 +44,7 @@
|
|
|
|
|
#include "../../kmfwidgets/kmfportwidget.h"
|
|
|
|
|
#include "../../kmfwidgets/kmfmultiportwidget.h"
|
|
|
|
|
namespace KMF {
|
|
|
|
|
KMFRuleEditorProtocol::KMFRuleEditorProtocol( TQWidget *tqparent, const char *name, WFlags fl ) : KMyFirewallRuleEditorProtocol( tqparent, name, fl ) {
|
|
|
|
|
KMFRuleEditorProtocol::KMFRuleEditorProtocol( TQWidget *parent, const char *name, WFlags fl ) : KMyFirewallRuleEditorProtocol( parent, name, fl ) {
|
|
|
|
|
use_multiport = false;
|
|
|
|
|
cb_icmp_type->insertItem( "echo-request" );
|
|
|
|
|
cb_icmp_type->insertItem( "echo-reply" );
|
|
|
|
@ -53,8 +53,8 @@ KMFRuleEditorProtocol::KMFRuleEditorProtocol( TQWidget *tqparent, const char *na
|
|
|
|
|
cb_icmp_type->insertItem( "router-solicitation" );
|
|
|
|
|
cb_icmp_type->insertItem( "timestamp-request" );
|
|
|
|
|
cb_icmp_type->insertItem( "timestamp-reply" );
|
|
|
|
|
cb_icmp_type->insertItem( "address-tqmask-request" );
|
|
|
|
|
cb_icmp_type->insertItem( "address-tqmask-reply" );
|
|
|
|
|
cb_icmp_type->insertItem( "address-mask-request" );
|
|
|
|
|
cb_icmp_type->insertItem( "address-mask-reply" );
|
|
|
|
|
cb_icmp_type->insertItem( "destination-unreachable" );
|
|
|
|
|
cb_icmp_type->insertItem( "network-unreachable" );
|
|
|
|
|
cb_icmp_type->insertItem( "host-unreachable" );
|
|
|
|
@ -207,14 +207,14 @@ void KMFRuleEditorProtocol::loadRule( IPTRule* rule ) {
|
|
|
|
|
c_tcp_option->setChecked( false );
|
|
|
|
|
c_inv_tcp_option->setChecked( false );
|
|
|
|
|
sb_tcp_option_num->setValue( 0 );
|
|
|
|
|
c_all_tqmask->setChecked( false );
|
|
|
|
|
c_none_tqmask->setChecked( false );
|
|
|
|
|
c_syn_tqmask->setChecked( false );
|
|
|
|
|
c_ack_tqmask->setChecked( false );
|
|
|
|
|
c_fin_tqmask->setChecked( false );
|
|
|
|
|
c_urg_tqmask->setChecked( false );
|
|
|
|
|
c_rst_tqmask->setChecked( false );
|
|
|
|
|
c_psh_tqmask->setChecked( false );
|
|
|
|
|
c_all_mask->setChecked( false );
|
|
|
|
|
c_none_mask->setChecked( false );
|
|
|
|
|
c_syn_mask->setChecked( false );
|
|
|
|
|
c_ack_mask->setChecked( false );
|
|
|
|
|
c_fin_mask->setChecked( false );
|
|
|
|
|
c_urg_mask->setChecked( false );
|
|
|
|
|
c_rst_mask->setChecked( false );
|
|
|
|
|
c_psh_mask->setChecked( false );
|
|
|
|
|
c_all_comp->setChecked( false );
|
|
|
|
|
c_none_comp->setChecked( false );
|
|
|
|
|
c_syn_comp->setChecked( false );
|
|
|
|
@ -320,7 +320,7 @@ void KMFRuleEditorProtocol::loadRule( IPTRule* rule ) {
|
|
|
|
|
}
|
|
|
|
|
if ( !flags.isEmpty() && flags != XML::Undefined_Value && flags != XML::BoolOff_Value ) {
|
|
|
|
|
kdDebug() << "Option Value --tcp-flags: " << flags << endl;
|
|
|
|
|
gb_tqmask->setEnabled( true );
|
|
|
|
|
gb_mask->setEnabled( true );
|
|
|
|
|
gb_comp->setEnabled( true );
|
|
|
|
|
c_tcp_flags->setChecked( true );
|
|
|
|
|
int delim = flags.find( " " );
|
|
|
|
@ -336,21 +336,21 @@ void KMFRuleEditorProtocol::loadRule( IPTRule* rule ) {
|
|
|
|
|
kdDebug() << "Flags for Comp: " << comp_lst << endl;
|
|
|
|
|
|
|
|
|
|
if ( mask_lst.contains( "SYN" ) > 0 )
|
|
|
|
|
c_syn_tqmask->setChecked( true );
|
|
|
|
|
c_syn_mask->setChecked( true );
|
|
|
|
|
if ( mask_lst.contains( "ACK" ) > 0 )
|
|
|
|
|
c_ack_tqmask->setChecked( true );
|
|
|
|
|
c_ack_mask->setChecked( true );
|
|
|
|
|
if ( mask_lst.contains( "FIN" ) > 0 )
|
|
|
|
|
c_fin_tqmask->setChecked( true );
|
|
|
|
|
c_fin_mask->setChecked( true );
|
|
|
|
|
if ( mask_lst.contains( "RST" ) > 0 )
|
|
|
|
|
c_rst_tqmask->setChecked( true );
|
|
|
|
|
c_rst_mask->setChecked( true );
|
|
|
|
|
if ( mask_lst.contains( "URG" ) > 0 )
|
|
|
|
|
c_urg_tqmask->setChecked( true );
|
|
|
|
|
c_urg_mask->setChecked( true );
|
|
|
|
|
if ( mask_lst.contains( "PSH" ) > 0 )
|
|
|
|
|
c_psh_tqmask->setChecked( true );
|
|
|
|
|
c_psh_mask->setChecked( true );
|
|
|
|
|
if ( mask_lst.contains( "NONE" ) > 0 )
|
|
|
|
|
c_none_tqmask->setChecked( true );
|
|
|
|
|
c_none_mask->setChecked( true );
|
|
|
|
|
if ( mask_lst.contains( "ALL" ) > 0 )
|
|
|
|
|
c_all_tqmask->setChecked( true );
|
|
|
|
|
c_all_mask->setChecked( true );
|
|
|
|
|
|
|
|
|
|
if ( comp_lst.contains( "SYN" ) > 0 )
|
|
|
|
|
c_syn_comp->setChecked( true );
|
|
|
|
@ -561,28 +561,28 @@ void KMFRuleEditorProtocol::accept() {
|
|
|
|
|
if ( c_inv_flags->isChecked() ) {
|
|
|
|
|
flags.prepend( "! " );
|
|
|
|
|
}
|
|
|
|
|
TQString tqmask = "";
|
|
|
|
|
TQString mask = "";
|
|
|
|
|
if ( ( c_all_comp->isChecked() || c_none_comp->isChecked() || c_syn_comp->isChecked() || c_fin_comp->isChecked() || c_ack_comp->isChecked() || c_rst_comp->isChecked() || c_urg_comp->isChecked() || c_psh_comp->isChecked() ) &&
|
|
|
|
|
( c_all_tqmask->isChecked() || c_none_tqmask->isChecked() || c_syn_tqmask->isChecked() || c_fin_tqmask->isChecked() || c_ack_tqmask->isChecked() || c_rst_tqmask->isChecked() || c_urg_tqmask->isChecked() || c_psh_tqmask->isChecked() ) ) {
|
|
|
|
|
if ( c_all_tqmask->isChecked() )
|
|
|
|
|
tqmask.append( "ALL" );
|
|
|
|
|
if ( c_none_tqmask->isChecked() )
|
|
|
|
|
tqmask.append( "NONE" );
|
|
|
|
|
if ( !c_all_tqmask->isChecked() && !c_none_tqmask->isChecked() ) {
|
|
|
|
|
if ( c_syn_tqmask->isChecked() )
|
|
|
|
|
tqmask.append( ",SYN" );
|
|
|
|
|
if ( c_fin_tqmask->isChecked() )
|
|
|
|
|
tqmask.append( ",FIN" );
|
|
|
|
|
if ( c_ack_tqmask->isChecked() )
|
|
|
|
|
tqmask.append( ",ACK" );
|
|
|
|
|
if ( c_rst_tqmask->isChecked() )
|
|
|
|
|
tqmask.append( ",RST" );
|
|
|
|
|
if ( c_psh_tqmask->isChecked() )
|
|
|
|
|
tqmask.append( ",PSH" );
|
|
|
|
|
if ( c_urg_tqmask->isChecked() )
|
|
|
|
|
tqmask.append( ",URG" );
|
|
|
|
|
if ( tqmask.startsWith( "," ) )
|
|
|
|
|
tqmask = tqmask.right( tqmask.length() - 1 );
|
|
|
|
|
( c_all_mask->isChecked() || c_none_mask->isChecked() || c_syn_mask->isChecked() || c_fin_mask->isChecked() || c_ack_mask->isChecked() || c_rst_mask->isChecked() || c_urg_mask->isChecked() || c_psh_mask->isChecked() ) ) {
|
|
|
|
|
if ( c_all_mask->isChecked() )
|
|
|
|
|
mask.append( "ALL" );
|
|
|
|
|
if ( c_none_mask->isChecked() )
|
|
|
|
|
mask.append( "NONE" );
|
|
|
|
|
if ( !c_all_mask->isChecked() && !c_none_mask->isChecked() ) {
|
|
|
|
|
if ( c_syn_mask->isChecked() )
|
|
|
|
|
mask.append( ",SYN" );
|
|
|
|
|
if ( c_fin_mask->isChecked() )
|
|
|
|
|
mask.append( ",FIN" );
|
|
|
|
|
if ( c_ack_mask->isChecked() )
|
|
|
|
|
mask.append( ",ACK" );
|
|
|
|
|
if ( c_rst_mask->isChecked() )
|
|
|
|
|
mask.append( ",RST" );
|
|
|
|
|
if ( c_psh_mask->isChecked() )
|
|
|
|
|
mask.append( ",PSH" );
|
|
|
|
|
if ( c_urg_mask->isChecked() )
|
|
|
|
|
mask.append( ",URG" );
|
|
|
|
|
if ( mask.startsWith( "," ) )
|
|
|
|
|
mask = mask.right( mask.length() - 1 );
|
|
|
|
|
}
|
|
|
|
|
TQString comp = "";
|
|
|
|
|
if ( c_all_comp->isChecked() )
|
|
|
|
@ -606,7 +606,7 @@ void KMFRuleEditorProtocol::accept() {
|
|
|
|
|
|
|
|
|
|
if ( comp.startsWith( "," ) )
|
|
|
|
|
comp = comp.right( comp.length() - 1 );
|
|
|
|
|
flags.append( tqmask );
|
|
|
|
|
flags.append( mask );
|
|
|
|
|
flags.append( " " );
|
|
|
|
|
flags.append( comp );
|
|
|
|
|
} else {
|
|
|
|
|