Re: [Samba] python: listing samba shares

2009-08-16 Thread Ricardo Jorge
> When just launching your code (with provided credentials), I have a segfault. > With the credentials code snippet removed, everything > works fine, and I can > see the shares listing! But when changing "localhost" to another ip address > (a windows machine), it fails: About the segfault, I do

Re: [Samba] python: listing samba shares

2009-08-16 Thread Igor Katson
Ricardo Jorge wrote: Just try using the regular python os.listdir() Use this code: . ctr = srvsvc.NetShareInfoCtr() shares = conn.NetShareEnumAll(u'localhost', ctr, 0, 0) print "\n\n" print "There are " + str(shares[0].ctr.count) + " shares"

Re: [Samba] python: listing samba shares

2009-08-16 Thread Igor Katson
When just launching your code (with provided credentials), I have a segfault. With the credentials code snippet removed, everything works fine, and I can see the shares listing! But when changing "localhost" to another ip address (a windows machine), it fails: desc...@descent:/usr/local/samba/

Re: [Samba] python: listing samba shares

2009-08-16 Thread Igor Katson
Ricardo Jorge wrote: Just try using the regular python os.listdir() Use this code: Thanks for quick and detailed help, Ricardo. I'll try that. -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba

Re: [Samba] python: listing samba shares

2009-08-16 Thread Ricardo Jorge
Just try using the regular python os.listdir() Use this code: . ctr = srvsvc.NetShareInfoCtr() shares = conn.NetShareEnumAll(u'localhost', ctr, 0, 0) print "\n\n" print "There are " + str(shares[0].ctr.count) + " shares" print "===

Re: [Samba] python: listing samba shares

2009-08-16 Thread Igor Katson
Thanks a lot! And what about listing the share's contents with python? Ricardo Jorge wrote: Hi, There was a line missing from source4/librpc/config.mk and it wasn't building the Python module. Here is a patch if you can apply it: I don't know how it will work for you because of your server c

Re: [Samba] python: listing samba shares

2009-08-16 Thread Ricardo Jorge
Hi, There was a line missing from source4/librpc/config.mk and it wasn't building the Python module. Here is a patch if you can apply it: diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 2aeea6d..5305b34 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @

Re: [Samba] python: listing samba shares

2009-08-16 Thread Ricardo Jorge
Hi, I was investigating this and I believe there is actually a way with Python but the problem is that the Python module with the binding is not being compiled (sorry but I have no idea why). There should be a module called samba.dcerpc.srvsvc. If you look at librpc/gen_ndr/py_srvsvc.c you will

Re: [Samba] python: listing samba shares

2009-08-16 Thread Igor Katson
Helmut Hullen wrote: Hallo, Igor, Du meintest am 16.08.09: Is it possible to list samba shares and their contents of a particular host? -- Shell: smbclient -N -L $particular_host shows first all shares of that particular host and then some other stuff. Perhaps you filter

Re: [Samba] python: listing samba shares

2009-08-16 Thread Helmut Hullen
Hallo, Igor, Du meintest am 16.08.09: > Is it possible to list samba shares and their contents of a > particular host? -- Shell: smbclient -N -L $particular_host shows first all shares of that particular host and then some other stuff. Perhaps you filter some output depending on the

Re: [Samba] python: listing samba shares

2009-08-16 Thread Igor Katson
Ricardo Jorge wrote: Hi, Here is some code to get you going. Try it out. Thanks for the quick answer. As far as I understand, this snippet of code parses smb.conf and prints your shares (i don't have an smb.conf for samba4 yet, and btw, found a segfault while trying to do samba_lp). But

Re: [Samba] python: listing samba shares

2009-08-16 Thread Ricardo Jorge
Hi, Here is some code to get you going. Try it out. #!/usr/bin/env python import sys sys.path.append('/usr/local/samba/lib/python2.6/site-packages') sys.path.append('/usr/local/samba/lib/python2.6/site-packages/samba') sys.path.append('/usr/local/samba/lib/python2.6/site-packages/samba/dcerpc')

[Samba] python: listing samba shares

2009-08-16 Thread Igor Katson
I've been googling that for a long time, but couldn't find an answer. I also checked the python-samba Debian (ubuntu) package contents and even compiled samba 4.0.0 alpha8, and checked its python libraries, but couldn't find anything regarding viewing the shares contents there. Is it possible