fix (samba): prevent panic in nil pointer dereference

the samba lib was crashing with nil pointer dereference when username
is an empty string ?!? Too lazy to provide a better fix so this will
do for now
This commit is contained in:
Mickael Kerjean 2022-02-22 23:45:56 +11:00
parent 04154556f3
commit 6028a4363b

View file

@ -44,6 +44,9 @@ func (smb Samba) Init(params map[string]string, app *App) (IBackend, error) {
if params["port"] == "" { if params["port"] == "" {
params["port"] = "445" params["port"] = "445"
} }
if params["username"] == "" {
params["username"] = "Guest"
}
conn, err := net.DialTimeout( conn, err := net.DialTimeout(
"tcp", "tcp",
fmt.Sprintf("%s:%s", params["host"], params["port"]), fmt.Sprintf("%s:%s", params["host"], params["port"]),