summaryrefslogtreecommitdiff
path: root/examples/nss/nss_winbind.h
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-01-16 13:11:01 +0000
committerVolker Lendecke <vlendec@samba.org>2004-01-16 13:11:01 +0000
commitfadc0128032f14b4fbe1ac165de9e2a7d5339291 (patch)
treea57b99b0e1f1d710606cf0bc2f7b64156a47e8a9 /examples/nss/nss_winbind.h
parent418052559979d350f44f1dd792c720b12f7082ef (diff)
downloadsamba-fadc0128032f14b4fbe1ac165de9e2a7d5339291.tar.gz
samba-fadc0128032f14b4fbe1ac165de9e2a7d5339291.tar.bz2
samba-fadc0128032f14b4fbe1ac165de9e2a7d5339291.zip
Commit sid<->[ug]id extensions to libnss_winbind.so on Linux, as well as a
factored-out nss_winbind.[ch]. I took tridge's public domain license comment for the nss_winbind.[ch]. This is probably not the last word on that extension, but as it is quite non-intrusive to the main samba code, I would like to give it a start. Volker (This used to be commit da5944129fad39010544b82649dfe5531a504ecf)
Diffstat (limited to 'examples/nss/nss_winbind.h')
-rw-r--r--examples/nss/nss_winbind.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/examples/nss/nss_winbind.h b/examples/nss/nss_winbind.h
new file mode 100644
index 0000000000..5a124a5a8e
--- /dev/null
+++ b/examples/nss/nss_winbind.h
@@ -0,0 +1,97 @@
+/*
+ nss sample code for extended winbindd functionality
+
+ Copyright (C) Andrew Tridgell (tridge@samba.org)
+ Copyright (C) Volker Lendecke (vl@samba.org)
+
+ you are free to use this code in any way you see fit, including
+ without restriction, using this code in your own products. You do
+ not need to give any attribution.
+*/
+
+#define _GNU_SOURCE
+
+#include <pwd.h>
+#include <grp.h>
+
+struct nss_state {
+ void *dl_handle;
+ char *nss_name;
+ char pwnam_buf[512];
+};
+
+/*
+ establish a link to the nss library
+ Return 0 on success and -1 on error
+*/
+int nss_open(struct nss_state *nss, const char *nss_path);
+
+/*
+ close and cleanup a nss state
+*/
+void nss_close(struct nss_state *nss);
+
+/*
+ make a getpwnam call.
+ Return 0 on success and -1 on error
+*/
+int nss_getpwent(struct nss_state *nss, struct passwd *pwd);
+
+/*
+ make a setpwent call.
+ Return 0 on success and -1 on error
+*/
+int nss_setpwent(struct nss_state *nss);
+
+/*
+ make a endpwent call.
+ Return 0 on success and -1 on error
+*/
+int nss_endpwent(struct nss_state *nss);
+
+/*
+ convert a name to a SID
+ caller frees
+ Return 0 on success and -1 on error
+*/
+int nss_nametosid(struct nss_state *nss, const char *name, char **sid);
+
+/*
+ convert a SID to a name
+ caller frees
+ Return 0 on success and -1 on error
+*/
+int nss_sidtoname(struct nss_state *nss, const char *sid, char **name);
+
+/*
+ return a list of group SIDs for a user SID
+ the returned list is NULL terminated
+ Return 0 on success and -1 on error
+*/
+int nss_getusersids(struct nss_state *nss, const char *user_sid, char ***sids);
+
+/*
+ convert a sid to a uid
+ Return 0 on success and -1 on error
+*/
+int nss_sidtouid(struct nss_state *nss, const char *sid, uid_t *uid);
+
+/*
+ convert a sid to a gid
+ Return 0 on success and -1 on error
+*/
+int nss_sidtogid(struct nss_state *nss, const char *sid, gid_t *gid);
+
+/*
+ convert a uid to a sid
+ caller frees
+ Return 0 on success and -1 on error
+*/
+int nss_uidtosid(struct nss_state *nss, uid_t uid, char **sid);
+
+/*
+ convert a gid to a sid
+ caller frees
+ Return 0 on success and -1 on error
+*/
+int nss_gidtosid(struct nss_state *nss, gid_t gid, char **sid);