|
|
@ -21,6 +21,8 @@ type ruleEdit struct {
|
|
|
|
row *ruleRow
|
|
|
|
row *ruleRow
|
|
|
|
dialog *gtk.Dialog
|
|
|
|
dialog *gtk.Dialog
|
|
|
|
pathLabel *gtk.Label
|
|
|
|
pathLabel *gtk.Label
|
|
|
|
|
|
|
|
sandboxLabel *gtk.Label
|
|
|
|
|
|
|
|
sandboxTitle *gtk.Label
|
|
|
|
verbCombo *gtk.ComboBoxText
|
|
|
|
verbCombo *gtk.ComboBoxText
|
|
|
|
hostEntry *gtk.Entry
|
|
|
|
hostEntry *gtk.Entry
|
|
|
|
portEntry *gtk.Entry
|
|
|
|
portEntry *gtk.Entry
|
|
|
@ -33,6 +35,8 @@ func newRuleEdit(rr *ruleRow, saveasnew bool) *ruleEdit {
|
|
|
|
b.getItems(
|
|
|
|
b.getItems(
|
|
|
|
"dialog", &redit.dialog,
|
|
|
|
"dialog", &redit.dialog,
|
|
|
|
"path_label", &redit.pathLabel,
|
|
|
|
"path_label", &redit.pathLabel,
|
|
|
|
|
|
|
|
"sandbox_label", &redit.sandboxLabel,
|
|
|
|
|
|
|
|
"sandbox_title", &redit.sandboxTitle,
|
|
|
|
"verb_combo", &redit.verbCombo,
|
|
|
|
"verb_combo", &redit.verbCombo,
|
|
|
|
"host_entry", &redit.hostEntry,
|
|
|
|
"host_entry", &redit.hostEntry,
|
|
|
|
"port_entry", &redit.portEntry,
|
|
|
|
"port_entry", &redit.portEntry,
|
|
|
@ -54,9 +58,17 @@ func (re *ruleEdit) updateDialogFields() {
|
|
|
|
re.pathLabel.SetText(r.Path)
|
|
|
|
re.pathLabel.SetText(r.Path)
|
|
|
|
if sgfw.RuleAction(r.Verb) == sgfw.RULE_ACTION_ALLOW {
|
|
|
|
if sgfw.RuleAction(r.Verb) == sgfw.RULE_ACTION_ALLOW {
|
|
|
|
re.verbCombo.SetActiveID("allow")
|
|
|
|
re.verbCombo.SetActiveID("allow")
|
|
|
|
|
|
|
|
} else if sgfw.RuleAction(r.Verb) == sgfw.RULE_ACTION_ALLOW_TLSONLY {
|
|
|
|
|
|
|
|
re.verbCombo.SetActiveID("allow_tls")
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
re.verbCombo.SetActiveID("deny")
|
|
|
|
re.verbCombo.SetActiveID("deny")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if r.Sandbox != "" {
|
|
|
|
|
|
|
|
re.sandboxLabel.SetText(r.Sandbox)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
re.sandboxLabel.SetVisible(false)
|
|
|
|
|
|
|
|
re.sandboxTitle.SetVisible(false)
|
|
|
|
|
|
|
|
}
|
|
|
|
target := strings.Split(r.Target, ":")
|
|
|
|
target := strings.Split(r.Target, ":")
|
|
|
|
if len(target) != 2 {
|
|
|
|
if len(target) != 2 {
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -67,7 +79,7 @@ func (re *ruleEdit) updateDialogFields() {
|
|
|
|
|
|
|
|
|
|
|
|
func (re *ruleEdit) validateFields() bool {
|
|
|
|
func (re *ruleEdit) validateFields() bool {
|
|
|
|
id := re.verbCombo.GetActiveID()
|
|
|
|
id := re.verbCombo.GetActiveID()
|
|
|
|
if id != "allow" && id != "deny" {
|
|
|
|
if id != "allow" && id != "allow_tls" && id != "deny" {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
host, _ := re.hostEntry.GetText()
|
|
|
|
host, _ := re.hostEntry.GetText()
|
|
|
@ -121,6 +133,8 @@ func (re *ruleEdit) updateRow() {
|
|
|
|
switch re.verbCombo.GetActiveID() {
|
|
|
|
switch re.verbCombo.GetActiveID() {
|
|
|
|
case "allow":
|
|
|
|
case "allow":
|
|
|
|
r.Verb = uint16(sgfw.RULE_ACTION_ALLOW)
|
|
|
|
r.Verb = uint16(sgfw.RULE_ACTION_ALLOW)
|
|
|
|
|
|
|
|
case "allow_tls":
|
|
|
|
|
|
|
|
r.Verb = uint16(sgfw.RULE_ACTION_ALLOW_TLSONLY)
|
|
|
|
case "deny":
|
|
|
|
case "deny":
|
|
|
|
r.Verb = uint16(sgfw.RULE_ACTION_DENY)
|
|
|
|
r.Verb = uint16(sgfw.RULE_ACTION_DENY)
|
|
|
|
}
|
|
|
|
}
|
|
|
|