diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-24 17:28:20 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-25 22:21:37 +0200 |
commit | 376a08840b970f6e6d36c56bfd85b97c29a044cf (patch) | |
tree | 109c062f4c064eb1c2855fbae11e2440efa2bf06 | |
parent | build: use newer wg(8) without elevation (diff) | |
download | wireguard-windows-376a08840b970f6e6d36c56bfd85b97c29a044cf.tar.xz wireguard-windows-376a08840b970f6e6d36c56bfd85b97c29a044cf.zip |
conf: list unencrypted conf files
By ignoring unencrypted ones, the tunnel tracker would miss running
configurations at startup.
Reported-by: Станислав Мацак <smatsak@mail.ru>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | conf/store.go | 8 | ||||
-rw-r--r-- | manager/ipc_server.go | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/conf/store.go b/conf/store.go index f6f450c6..def94836 100644 --- a/conf/store.go +++ b/conf/store.go @@ -29,8 +29,8 @@ func ListConfigNames() ([]string, error) { configs := make([]string, len(files)) i := 0 for _, file := range files { - name := filepath.Base(file.Name()) - if len(name) <= len(configFileSuffix) || !strings.HasSuffix(name, configFileSuffix) { + name, err := NameFromPath(file.Name()) + if err != nil { continue } if !file.Type().IsRegular() { @@ -43,10 +43,6 @@ func ListConfigNames() ([]string, error) { if info.Mode().Perm()&0444 == 0 { continue } - name = strings.TrimSuffix(name, configFileSuffix) - if !TunnelNameIsValid(name) { - continue - } configs[i] = name i++ } diff --git a/manager/ipc_server.go b/manager/ipc_server.go index 8ba050f9..9a36e60f 100644 --- a/manager/ipc_server.go +++ b/manager/ipc_server.go @@ -230,7 +230,7 @@ func (s *ManagerService) Tunnels() ([]Tunnel, error) { } tunnels := make([]Tunnel, len(names)) for i := 0; i < len(tunnels); i++ { - (tunnels)[i].Name = names[i] + tunnels[i].Name = names[i] } return tunnels, nil // TODO: account for running ones that aren't in the configuration store somehow |