Fix: only use and write auth file if user is set

- Apply to custom openvpn configuration without username
This commit is contained in:
Quentin McGaw (desktop)
2021-06-14 14:25:37 +00:00
parent c63ae3f3af
commit 582c6d1c43
2 changed files with 9 additions and 5 deletions

View File

@@ -143,10 +143,12 @@ func (l *looper) Run(ctx context.Context, done chan<- struct{}) { //nolint:gocog
continue
}
if err := l.conf.WriteAuthFile(settings.User, settings.Password, l.puid, l.pgid); err != nil {
l.signalCrashedStatus()
l.logAndWait(ctx, err)
continue
if settings.User != "" {
if err := l.conf.WriteAuthFile(settings.User, settings.Password, l.puid, l.pgid); err != nil {
l.signalCrashedStatus()
l.logAndWait(ctx, err)
continue
}
}
if err := l.fw.SetVPNConnection(ctx, connection); err != nil {