Trying to write a test program using libsmbclient.

Ray Van Dolson rayvd at bludgeon.org
Tue May 1 18:46:13 GMT 2001


Thanks for the response.  I'm having some troubles with segfaults using
the sources in the testsuite directory.

I created the .smb directory and the smb.conf as specified and compiled
for example telldir_4.c and called it as follows:

./a.out WORKGROUP username password smb://COMPUTER/Directory

I get a segmentation fault.  Simply using a URI in the form of //COMPUTER
returns a -1 for the directory handle and an error of "9".  I ran gdb over
the executable and it appears that it is segfaulting when smbc_opendir()
is called.  I'm assuming the smb:// form of the URI is the proper one, yet
it seems to barf out on me when this is called.

smbclient on the other hand works fine, so it seems my Samba compile is
working fine.  Any ideas?

Ray Van Dolson

On Tue, 1 May 2001, Stephen Boyer wrote:

> Roy,
> Yes, you have to call smbc_init() first in order to initialize the library
> and indicate the call back function.  You also need a .smb/smb.conf
> file in your HOME directory with nothing more than the following:
>
> [global]
> 	workgroup = WORKGROUP
>
> In the HEAD /samba/testsuite/libsmbclient/src are examples/testprograms
> that exercise all of the available libsmbclient APIs.
>
>
>
> >Date: Tue, 1 May 2001 08:03:59 -0700 (PDT)
> >From: Ray Van Dolson <rayvd at bludgeon.org>
> >To: <samba-technical at samba.org>
> >Subject: Trying to write a test program using libsmbclient.
>
> >I'm trying to write a test program using libsmbclient and the simplest
> >things aren't working quite the way it seems they should.
>
> >#include <libsmbclient.h>
> >#include <stdio.h>
>
> >int main() {
> >         printf("%d\n",smbc_open("smb://TULCATE/Mp3"));
> >}
>
> >% gcc -o bob test.c -lsmbclient
> >% ./bob
> >-1
> >%
>
> >It returns -1 for any URI I throw in there.  These URI's work fine when
> >used with smbclient directly, so I think I may be doing something wrong.
> >Do I need to call smbc_init() first?
>
> >Ray Van Dolson
>





More information about the samba-technical mailing list