You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package sambaManager;
import(
"fmt""github.com/mvo5/libsmbclient-go"
)
funcgetClient(user, passwordstring) *libsmbclient.Client{
client:=libsmbclient.New();
client.SetDebug(99);
client.SetAuthCallback(func(_,_string)(string,string,string){return"", user, password});
returnclient;
}
//Try to authenticate a user against the SMB serverfuncTryAuthenticate(host, user, passwordstring)(okbool, errerror){
client:=getClient(user, password);
deferclient.Close();
userDir:=fmt.Sprintf("smb://%s/%s/", host, user); //Test for user home dir (should have the homes section enabled)_, err=client.Opendir(userDir);
ok=err==nil;
return;
}
The text was updated successfully, but these errors were encountered:
Hey, thanks for your bugreport. I have an example smb explorer app in the tree, I moved it into 'cmd/smb/main.go` now. Could you please check if that also crashes in the same way? Please check https://github.com/mvo5/libsmbclient-go/blob/master/cmd/smb/main.go#L54 for an example usage. maybe the issue is that you use an anonymous func(). But it's ~5y since I wrote this code so I'm a bit rusty :) I kind of abandoned it after I found that libsmbclient is not thread safe at all.
Fwiw - with the example in main.go I don't get crashes.
Seems like anon functions aren't working (not related to GC nor goroutine thread locking as far as I tested).
The real issue seems anon functions definitively, I'm updating the title
Thanks for your fast reply.
mrvik
changed the title
cgo argument has Go Pointer to Go Pointer
Anon functions aren't accepted as AuthCallback
Jan 7, 2020
Hey, after writing some code, seems like there is a problem on the SetAuthCallback function.
Stack trace:
Go code:
The text was updated successfully, but these errors were encountered: