Python winbind/libwbclient module
I’ve created a python ctypes-based module for interfacing with samba libwbclient, using ctypes means that it doesn’t require compilation, but this does rely on the ABI be compatible between versions of libwbclient, if you notice strange behavior or random segfaults, contact me.
Its tested on Linux but should in theory work on solaris, or any OS with python ctypes and samba 3.2.
Overview of the class:
class WBClient(__builtin__.object)
Class that interfaces with libwbclient via ctypes.
Optionally pass in a domain name, if no domain name is supplied the
default domain is used(from libwbclient).
Methods defined here:
__init__(self, default_domain=None)
authenticate_user(self, username, password, domain=None)
Authenticates a user
If the winbind seperator is in the username False is returned
This means username\password doesnt work, one must explicitly give
the domain as the 3rd argument if not authenticating off the default domain
Returns the full username in the form of Domain\Username (or a different winbind separator) if successful, None if not.
change_user_password(self, username, oldpw, newpw)
Change user password, (Working with samba 3.4)
get_display_name(self, username, domain=None)
Gets the display name of a user/group
get_group_membership(self, username, domain=None)
This function looks up the group membership of a user,
Returns a list if successful, None if not
get_sid(self, name, domain=None)
Get the SID string of a user/group/machine
list_groups(self, domain=None)
Lists the groups in a domain
list_users(self, domain=None)
Lists the users in a domain
lookup_domain_controller(self, domain=None)
Lookup domain controller for a domain(Could not get to work)
reload_interface(self)
(re)loads Interface details, winbind separator etc
resolve_wins_by_ip(self, ip)
Resolve an IP to a Netbios name
resolve_wins_by_name(self, name)
Resolve a Netbios name to an IP.
Get your copy from http://dmarkey.com/svn/winbind