root/examples/nss/nss_winbind.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* 
   2    nss sample code for extended winbindd functionality
   3 
   4    Copyright (C) Andrew Tridgell (tridge@samba.org)   
   5    Copyright (C) Volker Lendecke (vl@samba.org)
   6 
   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.
  10 */
  11 
  12 #define _GNU_SOURCE
  13 
  14 #include <pwd.h>
  15 #include <grp.h>
  16 
  17 struct nss_state {
  18         void *dl_handle;
  19         char *nss_name;
  20         char pwnam_buf[512];
  21 };
  22 
  23 /*
  24   establish a link to the nss library
  25   Return 0 on success and -1 on error
  26 */
  27 int nss_open(struct nss_state *nss, const char *nss_path);
  28 
  29 /*
  30   close and cleanup a nss state
  31 */
  32 void nss_close(struct nss_state *nss);
  33 
  34 /*
  35   make a getpwnam call. 
  36   Return 0 on success and -1 on error
  37 */
  38 int nss_getpwent(struct nss_state *nss, struct passwd *pwd);
  39 
  40 /*
  41   make a setpwent call. 
  42   Return 0 on success and -1 on error
  43 */
  44 int nss_setpwent(struct nss_state *nss);
  45 
  46 /*
  47   make a endpwent call. 
  48   Return 0 on success and -1 on error
  49 */
  50 int nss_endpwent(struct nss_state *nss);
  51 
  52 /*
  53   convert a name to a SID
  54   caller frees
  55   Return 0 on success and -1 on error
  56 */
  57 int nss_nametosid(struct nss_state *nss, const char *name, char **sid);
  58 
  59 /*
  60   convert a SID to a name
  61   caller frees
  62   Return 0 on success and -1 on error
  63 */
  64 int nss_sidtoname(struct nss_state *nss, const char *sid, char **name);
  65 
  66 /*
  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
  70 */
  71 int nss_getusersids(struct nss_state *nss, const char *user_sid, char ***sids);
  72 
  73 /*
  74   convert a sid to a uid
  75   Return 0 on success and -1 on error
  76 */
  77 int nss_sidtouid(struct nss_state *nss, const char *sid, uid_t *uid);
  78 
  79 /*
  80   convert a sid to a gid
  81   Return 0 on success and -1 on error
  82 */
  83 int nss_sidtogid(struct nss_state *nss, const char *sid, gid_t *gid);
  84 
  85 /*
  86   convert a uid to a sid
  87   caller frees
  88   Return 0 on success and -1 on error
  89 */
  90 int nss_uidtosid(struct nss_state *nss, uid_t uid, char **sid);
  91 
  92 /*
  93   convert a gid to a sid
  94   caller frees
  95   Return 0 on success and -1 on error
  96 */
  97 int nss_gidtosid(struct nss_state *nss, gid_t gid, char **sid);

/* [<][>][^][v][top][bottom][index][help] */