Created
November 24, 2011 16:36
-
-
Save ahall/1391751 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the p/invoke | |
public static void CallBackAuth(IntPtr server, | |
IntPtr share, | |
IntPtr workgroup, | |
int wgmaxlen, | |
IntPtr username, | |
int unmaxlen, | |
IntPtr password, | |
int pwmaxlen) | |
{ | |
Console.WriteLine("MeeMa"); | |
} | |
public delegate void SmbCGetAuthDataFn(IntPtr server, | |
IntPtr share, | |
IntPtr workgroup, | |
int wgmaxlen, | |
IntPtr username, | |
int unmaxlen, | |
IntPtr password, | |
int pwmaxlen); | |
[DllImport("libsmbclient", CharSet = CharSet.Auto)] extern internal static int smbc_init(SmbCGetAuthDataFn callBackAuth, int debug); | |
[DllImport("libsmbclient", CharSet = CharSet.Auto)] extern internal static int smbc_opendir([In, MarshalAs(UnmanagedType.LPStr)]string durl); | |
Then simple calling into: | |
SambaWrapper.SmbInit(); | |
SambaWrapper.smbc_opendir(@"smb://username:password@somehostname/someshare"); | |
This is the Native code: | |
typedef void (*smbc_get_auth_data_fn)(const char *srv, | |
const char *shr, | |
char *wg, int wglen, | |
char *un, int unlen, | |
char *pw, int pwlen); | |
int smbc_init(smbc_get_auth_data_fn fn, int debug); | |
int smbc_opendir(const char *durl); | |
This works fine on linux (64 bit) but on OSX it fails with: | |
at (wrapper managed-to-native) testnsch.SambaWrapper.smbc_opendir (string) <0xffffffff> | |
at testnsch.MainClass.Main (string[]) <0x0002b> | |
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff> | |
Native stacktrace: | |
0 mono 0x000b90c6 mono_handle_native_sigsegv + 422 | |
1 mono 0x00003f3e mono_sigsegv_signal_handler + 334 | |
2 libSystem.B.dylib 0x9399005b _sigtramp + 43 | |
3 ??? 0xffffffff 0x0 + 4294967295 | |
4 libsmbclient.dylib 0x0204ae4a hmac_md5_final + 61 | |
5 libsmbclient.dylib 0x021104e9 ntv2_owf_gen + 1123 | |
6 libsmbclient.dylib 0x02110f92 SMBNTLMv2encrypt_hash + 128 | |
7 libsmbclient.dylib 0x020fd2cc ntlmssp_client_challenge + 2366 | |
8 libsmbclient.dylib 0x020fc4ec ntlmssp_update + 764 | |
9 libsmbclient.dylib 0x020bba6d cli_session_setup_ntlmssp_done + 1145 | |
10 libsmbclient.dylib 0x0208a4d8 _tevent_req_notify_callback + 37 | |
11 libsmbclient.dylib 0x0208a4fb tevent_req_finish + 33 | |
12 libsmbclient.dylib 0x0208a51d _tevent_req_done + 32 | |
13 libsmbclient.dylib 0x020bab34 cli_sesssetup_blob_done + 1010 | |
14 libsmbclient.dylib 0x0208a4d8 _tevent_req_notify_callback + 37 | |
15 libsmbclient.dylib 0x0208a4fb tevent_req_finish + 33 | |
16 libsmbclient.dylib 0x0208a51d _tevent_req_done + 32 | |
17 libsmbclient.dylib 0x020f4d59 cli_smb_received + 1598 | |
18 libsmbclient.dylib 0x0208a4d8 _tevent_req_notify_callback + 37 | |
19 libsmbclient.dylib 0x0208a4fb tevent_req_finish + 33 | |
20 libsmbclient.dylib 0x0208a51d _tevent_req_done + 32 | |
21 libsmbclient.dylib 0x020f3505 read_smb_done + 372 | |
22 libsmbclient.dylib 0x0208a4d8 _tevent_req_notify_callback + 37 | |
23 libsmbclient.dylib 0x0208a4fb tevent_req_finish + 33 | |
24 libsmbclient.dylib 0x0208a51d _tevent_req_done + 32 | |
25 libsmbclient.dylib 0x02056cb7 read_packet_handler + 476 | |
26 libsmbclient.dylib 0x02086cc6 run_events_poll + 1597 | |
27 libsmbclient.dylib 0x02086f35 s3_event_loop_once + 337 | |
28 libsmbclient.dylib 0x02087e81 _tevent_loop_once + 211 | |
29 libsmbclient.dylib 0x0208a725 tevent_req_poll + 36 | |
30 libsmbclient.dylib 0x02075b50 tevent_req_poll_ntstatus + 24 | |
31 libsmbclient.dylib 0x020bbcdf cli_session_setup_ntlmssp + 161 | |
32 libsmbclient.dylib 0x020bc6ee cli_session_setup_spnego + 2478 | |
33 libsmbclient.dylib 0x020bcab3 cli_session_setup + 927 | |
34 libsmbclient.dylib 0x0200eae4 SMBC_server_internal + 3004 | |
35 libsmbclient.dylib 0x0200f42a SMBC_server + 98 | |
36 libsmbclient.dylib 0x02006d18 SMBC_opendir_ctx + 5564 | |
37 libsmbclient.dylib 0x020022d3 smbc_opendir + 51 | |
38 ??? 0x004c5c34 0x0 + 5004340 | |
39 ??? 0x004bddb4 0x0 + 4971956 | |
40 ??? 0x004bde67 0x0 + 4972135 | |
41 mono 0x0000fa34 mono_jit_runtime_invoke + 164 | |
42 mono 0x001be768 mono_runtime_invoke + 137 | |
43 mono 0x001c0f6a mono_runtime_exec_main + 669 | |
44 mono 0x001c02a4 mono_runtime_run_main + 843 | |
45 mono 0x000888cb mono_main + 7755 | |
46 mono 0x00001ed6 start + 54 | |
Debug info from gdb: | |
/tmp/mono-gdb-commands.gBadlW:1: Error in sourced command file: | |
unable to debug self | |
================================================================= | |
Got a SIGSEGV while executing native code. This usually indicates | |
a fatal error in the mono runtime or one of the native libraries | |
used by your application. | |
================================================================= | |
Abort trap | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment