On Wed, Nov 4, 2015 at 4:44 PM, Rowland Penny <rowlandpenny241155 at gmail.com> wrote:> Ah, you want to search AD with python, as in 'ldbsearch -H > /usr/local/samba/private/sam.ldb' (this will dump the AD database) > You will find lots of 'examples' in the python 'samba' directory that an > install of a samba DC creates, these are used by samba-tool, well actually, > they are samba-tool :-)No, I don't want to dump the LDB, I want to query an actual Windows DC (same as 'net ads search' command).> Also have a look here: > https://www.samba.org/~jelmer/samba4-python/moduleIndex.htmlThat module listing is not very helpful in itself, but I'll take a look at the samba test examples to try to get a feel for it. -aps
Rowland Penny
2015-Nov-05 15:06 UTC
[Samba] Using samba-python to query AD? Status of API?
On 05/11/15 14:59, pisymbol . wrote:> On Wed, Nov 4, 2015 at 4:44 PM, Rowland Penny > <rowlandpenny241155 at gmail.com> wrote: >> Ah, you want to search AD with python, as in 'ldbsearch -H >> /usr/local/samba/private/sam.ldb' (this will dump the AD database) >> You will find lots of 'examples' in the python 'samba' directory that an >> install of a samba DC creates, these are used by samba-tool, well actually, >> they are samba-tool :-) > No, I don't want to dump the LDB, I want to query an actual Windows DC > (same as 'net ads search' command).That was just an example, but why are you asking on a Samba mailing list for information on howto query a windows DC?? You can use ldbsearch or ldapsearch for this, or use windows tools from a windows machine. Rowland> >> Also have a look here: >> https://www.samba.org/~jelmer/samba4-python/moduleIndex.html > That module listing is not very helpful in itself, but I'll take a > look at the samba test examples to try to get a feel for it. > > -aps
mathias dufresne
2015-Nov-05 15:21 UTC
[Samba] Using samba-python to query AD? Status of API?
"samba-tool ldapcmp ..." uses ldap:// to compare, or at least it can use ldap://. As it is samba-tool command, it is a Python script. Perhaps you'll find what you want in that... 2015-11-05 15:59 GMT+01:00 pisymbol . <pisymbol at gmail.com>:> On Wed, Nov 4, 2015 at 4:44 PM, Rowland Penny > <rowlandpenny241155 at gmail.com> wrote: > > Ah, you want to search AD with python, as in 'ldbsearch -H > > /usr/local/samba/private/sam.ldb' (this will dump the AD database) > > You will find lots of 'examples' in the python 'samba' directory that an > > install of a samba DC creates, these are used by samba-tool, well > actually, > > they are samba-tool :-) > > No, I don't want to dump the LDB, I want to query an actual Windows DC > (same as 'net ads search' command). > > > Also have a look here: > > https://www.samba.org/~jelmer/samba4-python/moduleIndex.html > > That module listing is not very helpful in itself, but I'll take a > look at the samba test examples to try to get a feel for it. > > -aps > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba >
On Thu, Nov 5, 2015 at 10:06 AM, Rowland Penny <rowlandpenny241155 at gmail.com> wrote:> On 05/11/15 14:59, pisymbol . wrote: >> >> On Wed, Nov 4, 2015 at 4:44 PM, Rowland Penny >> <rowlandpenny241155 at gmail.com> wrote: >>> >>> Ah, you want to search AD with python, as in 'ldbsearch -H >>> /usr/local/samba/private/sam.ldb' (this will dump the AD database) >>> You will find lots of 'examples' in the python 'samba' directory that an >>> install of a samba DC creates, these are used by samba-tool, well >>> actually, >>> they are samba-tool :-) >> >> No, I don't want to dump the LDB, I want to query an actual Windows DC >> (same as 'net ads search' command). > > That was just an example, but why are you asking on a Samba mailing list for > information on howto query a windows DC?? > > You can use ldbsearch or ldapsearch for this, or use windows tools from a > windows machine.Yes, I understand all that. But the 'net ads search' wrapper is a lot nicer than the openldap clients. But perhaps you're right, maybe OpenLDAP is indeed what I really want and are a bit misguided by leveraging 'net ads search' stuff out of the samba tools so heavily. -aps