ndr: Add ndr_ntprinting_string_flags() function.
[Samba.git] / examples / nss / nss_winbind.h
blob5a124a5a8ecc4358dff55d7710243db8c10a92df
1 /*
2 nss sample code for extended winbindd functionality
4 Copyright (C) Andrew Tridgell (tridge@samba.org)
5 Copyright (C) Volker Lendecke (vl@samba.org)
7 you are free to use this code in any way you see fit, including
8 without restriction, using this code in your own products. You do
9 not need to give any attribution.
12 #define _GNU_SOURCE
14 #include <pwd.h>
15 #include <grp.h>
17 struct nss_state {
18 void *dl_handle;
19 char *nss_name;
20 char pwnam_buf[512];
24 establish a link to the nss library
25 Return 0 on success and -1 on error
27 int nss_open(struct nss_state *nss, const char *nss_path);
30 close and cleanup a nss state
32 void nss_close(struct nss_state *nss);
35 make a getpwnam call.
36 Return 0 on success and -1 on error
38 int nss_getpwent(struct nss_state *nss, struct passwd *pwd);
41 make a setpwent call.
42 Return 0 on success and -1 on error
44 int nss_setpwent(struct nss_state *nss);
47 make a endpwent call.
48 Return 0 on success and -1 on error
50 int nss_endpwent(struct nss_state *nss);
53 convert a name to a SID
54 caller frees
55 Return 0 on success and -1 on error
57 int nss_nametosid(struct nss_state *nss, const char *name, char **sid);
60 convert a SID to a name
61 caller frees
62 Return 0 on success and -1 on error
64 int nss_sidtoname(struct nss_state *nss, const char *sid, char **name);
67 return a list of group SIDs for a user SID
68 the returned list is NULL terminated
69 Return 0 on success and -1 on error
71 int nss_getusersids(struct nss_state *nss, const char *user_sid, char ***sids);
74 convert a sid to a uid
75 Return 0 on success and -1 on error
77 int nss_sidtouid(struct nss_state *nss, const char *sid, uid_t *uid);
80 convert a sid to a gid
81 Return 0 on success and -1 on error
83 int nss_sidtogid(struct nss_state *nss, const char *sid, gid_t *gid);
86 convert a uid to a sid
87 caller frees
88 Return 0 on success and -1 on error
90 int nss_uidtosid(struct nss_state *nss, uid_t uid, char **sid);
93 convert a gid to a sid
94 caller frees
95 Return 0 on success and -1 on error
97 int nss_gidtosid(struct nss_state *nss, gid_t gid, char **sid);