how to get list of user groups from NT?

Ben Johnson ben at
Wed Mar 28 02:16:21 GMT 2001


short version:  what is/are the api number(s) of the getgroups and
getgroupnames remote api call in smb?  I want to fetch a list of groups
associated with a logged in user and don't know where to look for info
like this.

long version:
Please accept my apologize in advance if this is a FAQ or is documented
somewhere.  I would love to rtfm if I knew where to look.  I couldn't
find any message in the mail archive about this.  Someone told me
winbind might be what I need but I haven't been able to find that
either.  please send me a link.

What I want to do is get a list of user groups (global and/or local)
associated with a particular user on an NT machine or in a NT domain.
I am using the Samba 2.0.7 to do this and am following an example of
code that does the same thing but with Samba 1.9.  The code between
version is just different enough that I'm a little stuck.

so far:
  I login as any user and get a tree connect using PROTOCOL_LANMAN2.
  I connect to share "IPC$" with a service type "?????".

from what I can tell the next step is to call a remote api on a named
pipe to get a list of group ids.  then I use that in another api call to
get a list of group names.  I believe cli_api() would be the easiest
function to use.

My major stumbling block is the api code number.  I can't tell what it
is from the old source.  How exactly parameters are passed and received
is not all the clear either. Any other tips you care to share about this
task will be greatly appreciated.

Thanks very much,

- Ben

More information about the samba-technical mailing list