/user/squid/include/samba/nsswitch/winbindd_nss.h

https://github.com/rhuitl/uClinux · C Header · 229 lines · 135 code · 50 blank · 44 comment · 2 complexity · 103d7a97e0b335eda27c6f976a3b1c23 MD5 · raw file

  1. /*
  2. Unix SMB/CIFS implementation.
  3. Winbind daemon for ntdom nss module
  4. Copyright (C) Tim Potter 2000
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Library General Public License for more details.
  13. You should have received a copy of the GNU Library General Public
  14. License along with this library; if not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  16. Boston, MA 02111-1307, USA.
  17. */
  18. #ifndef SAFE_FREE
  19. #define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
  20. #endif
  21. #ifndef _WINBINDD_NTDOM_H
  22. #define _WINBINDD_NTDOM_H
  23. #define WINBINDD_SOCKET_NAME "pipe" /* Name of PF_UNIX socket */
  24. #define WINBINDD_SOCKET_DIR "/tmp/.winbindd" /* Name of PF_UNIX dir */
  25. #define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
  26. #define WINBINDD_DONT_ENV "_NO_WINBINDD"
  27. /* Update this when you change the interface. */
  28. #define WINBIND_INTERFACE_VERSION 4
  29. /* Socket commands */
  30. enum winbindd_cmd {
  31. WINBINDD_INTERFACE_VERSION, /* Always a well known value */
  32. /* Get users and groups */
  33. WINBINDD_GETPWNAM,
  34. WINBINDD_GETPWUID,
  35. WINBINDD_GETGRNAM,
  36. WINBINDD_GETGRGID,
  37. WINBINDD_GETGROUPS,
  38. /* Enumerate users and groups */
  39. WINBINDD_SETPWENT,
  40. WINBINDD_ENDPWENT,
  41. WINBINDD_GETPWENT,
  42. WINBINDD_SETGRENT,
  43. WINBINDD_ENDGRENT,
  44. WINBINDD_GETGRENT,
  45. /* PAM authenticate and password change */
  46. WINBINDD_PAM_AUTH,
  47. WINBINDD_PAM_AUTH_CRAP,
  48. WINBINDD_PAM_CHAUTHTOK,
  49. /* List various things */
  50. WINBINDD_LIST_USERS, /* List w/o rid->id mapping */
  51. WINBINDD_LIST_GROUPS, /* Ditto */
  52. WINBINDD_LIST_TRUSTDOM,
  53. /* SID conversion */
  54. WINBINDD_LOOKUPSID,
  55. WINBINDD_LOOKUPNAME,
  56. /* Lookup functions */
  57. WINBINDD_SID_TO_UID,
  58. WINBINDD_SID_TO_GID,
  59. WINBINDD_UID_TO_SID,
  60. WINBINDD_GID_TO_SID,
  61. /* Miscellaneous other stuff */
  62. WINBINDD_CHECK_MACHACC, /* Check machine account pw works */
  63. WINBINDD_PING, /* Just tell me winbind is running */
  64. WINBINDD_INFO, /* Various bit of info. Currently just tidbits */
  65. WINBINDD_DOMAIN_NAME, /* The domain this winbind server is a member of (lp_workgroup()) */
  66. WINBINDD_SHOW_SEQUENCE, /* display sequence numbers of domains */
  67. /* WINS commands */
  68. WINBINDD_WINS_BYIP,
  69. WINBINDD_WINS_BYNAME,
  70. /* Placeholder for end of cmd list */
  71. WINBINDD_NUM_CMDS
  72. };
  73. /* Winbind request structure */
  74. struct winbindd_request {
  75. uint32 length;
  76. enum winbindd_cmd cmd; /* Winbindd command to execute */
  77. pid_t pid; /* pid of calling process */
  78. union {
  79. fstring winsreq; /* WINS request */
  80. fstring username; /* getpwnam */
  81. fstring groupname; /* getgrnam */
  82. uid_t uid; /* getpwuid, uid_to_sid */
  83. gid_t gid; /* getgrgid, gid_to_sid */
  84. struct {
  85. /* We deliberatedly don't split into domain/user to
  86. avoid having the client know what the separator
  87. character is. */
  88. fstring user;
  89. fstring pass;
  90. } auth; /* pam_winbind auth module */
  91. struct {
  92. unsigned char chal[8];
  93. fstring user;
  94. fstring domain;
  95. fstring lm_resp;
  96. uint16 lm_resp_len;
  97. fstring nt_resp;
  98. uint16 nt_resp_len;
  99. } auth_crap;
  100. struct {
  101. fstring user;
  102. fstring oldpass;
  103. fstring newpass;
  104. } chauthtok; /* pam_winbind passwd module */
  105. fstring sid; /* lookupsid, sid_to_[ug]id */
  106. struct {
  107. fstring dom_name; /* lookupname */
  108. fstring name;
  109. } name;
  110. uint32 num_entries; /* getpwent, getgrent */
  111. } data;
  112. fstring domain; /* {set,get,end}{pw,gr}ent() */
  113. };
  114. /* Response values */
  115. enum winbindd_result {
  116. WINBINDD_ERROR,
  117. WINBINDD_OK
  118. };
  119. /* Winbind response structure */
  120. struct winbindd_response {
  121. /* Header information */
  122. uint32 length; /* Length of response */
  123. enum winbindd_result result; /* Result code */
  124. /* Fixed length return data */
  125. union {
  126. int interface_version; /* Try to ensure this is always in the same spot... */
  127. fstring winsresp; /* WINS response */
  128. /* getpwnam, getpwuid */
  129. struct winbindd_pw {
  130. fstring pw_name;
  131. fstring pw_passwd;
  132. uid_t pw_uid;
  133. gid_t pw_gid;
  134. fstring pw_gecos;
  135. fstring pw_dir;
  136. fstring pw_shell;
  137. } pw;
  138. /* getgrnam, getgrgid */
  139. struct winbindd_gr {
  140. fstring gr_name;
  141. fstring gr_passwd;
  142. gid_t gr_gid;
  143. int num_gr_mem;
  144. int gr_mem_ofs; /* offset to group membership */
  145. } gr;
  146. uint32 num_entries; /* getpwent, getgrent */
  147. struct winbindd_sid {
  148. fstring sid; /* lookupname, [ug]id_to_sid */
  149. int type;
  150. } sid;
  151. struct winbindd_name {
  152. fstring dom_name; /* lookupsid */
  153. fstring name;
  154. int type;
  155. } name;
  156. uid_t uid; /* sid_to_uid */
  157. gid_t gid; /* sid_to_gid */
  158. struct winbindd_info {
  159. char winbind_separator;
  160. fstring samba_version;
  161. } info;
  162. fstring domain_name;
  163. struct auth_reply {
  164. uint32 nt_status;
  165. fstring nt_status_string;
  166. fstring error_string;
  167. int pam_error;
  168. } auth;
  169. } data;
  170. uint32 nt_status; /* Extended error information */
  171. /* Variable length return data */
  172. void *extra_data; /* getgrnam, getgrgid, getgrent */
  173. };
  174. #endif