More checks in SGFW prompt GUI to prevent accidental startup race/panic condition.

Increased default max concurrent prompts in standalone prompter to 5 connections.
Fixed NULL dereference crash condition from recvfrom() error in go-nfnetlink vendor dependency.
shw-merge
Stephen Watt 7 years ago
parent e3ab56486b
commit 8054062418

@ -13,6 +13,7 @@ import (
"strconv"
"strings"
"sync"
"time"
"github.com/subgraph/fw-daemon/sgfw"
)
@ -318,6 +319,27 @@ func createListStore(general bool) *gtk.ListStore {
func addRequest(listStore *gtk.ListStore, path, proto string, pid int, ipaddr, hostname string, port, uid, gid int, origin string, is_socks bool, optstring string, sandbox string) *decisionWaiter {
if listStore == nil {
listStore = globalLS
waitTimes := []int{ 1, 2, 5, 10 }
if listStore == nil {
log.Print("SGFW prompter was not ready to receive firewall request... waiting")
}
for _, wtime := range waitTimes {
time.Sleep(time.Duration(wtime) * time.Second)
listStore = globalLS
if listStore != nil {
break
}
log.Print("SGFW prompter is still waiting...")
}
}
if listStore == nil {
log.Fatal("SGFW prompter GUI failed to load for unknown reasons")
}
iter := listStore.Append()

@ -15,7 +15,7 @@ import (
var DoMultiPrompt = true
const MAX_PROMPTS = 3
const MAX_PROMPTS = 5
var outstandingPrompts = 0
var promptLock = &sync.Mutex{}

@ -347,10 +347,10 @@ func readErrno(data []byte) uint32 {
// is returned as an error.
func (s *NetlinkSocket) fillRecvBuffer() (int, error) {
n, from, err := syscall.Recvfrom(s.fd, s.recvBuffer, 0)
sa := from.(*syscall.SockaddrNetlink)
if err != nil {
return 0, err
}
sa := from.(*syscall.SockaddrNetlink)
if s.flags.isSet(FlagDebug) {
fmt.Printf("from: %d\n", sa.Groups)
}

Loading…
Cancel
Save