s3-auth: Make server_info const in create_local_token()
[kai/samba.git] / source3 / auth / proto.h
1
2 /* The following definitions come from auth/auth.c  */
3
4 NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init);
5 bool load_auth_module(struct auth_context *auth_context,
6                       const char *module, auth_methods **ret) ;
7 NTSTATUS make_auth_context_subsystem(TALLOC_CTX *mem_ctx,
8                                      struct auth_context **auth_context);
9 NTSTATUS make_auth_context_fixed(TALLOC_CTX *mem_ctx,
10                                  struct auth_context **auth_context,
11                                  uchar chal[8]) ;
12
13 /* The following definitions come from auth/auth_builtin.c  */
14
15 NTSTATUS auth_builtin_init(void);
16
17 /* The following definitions come from auth/auth_compat.c  */
18
19 NTSTATUS check_plaintext_password(const char *smb_name,
20                                   DATA_BLOB plaintext_password,
21                                   struct auth_serversupplied_info **server_info);
22 bool password_ok(struct auth_context *actx, bool global_encrypted,
23                  const char *session_workgroup,
24                  const char *smb_name, DATA_BLOB password_blob);
25
26 /* The following definitions come from auth/auth_domain.c  */
27
28 void attempt_machine_password_change(void);
29 NTSTATUS auth_domain_init(void);
30
31 NTSTATUS auth_netlogond_init(void);
32
33 /* The following definitions come from auth/auth_ntlmssp.c  */
34
35 NTSTATUS auth_ntlmssp_steal_session_info(TALLOC_CTX *mem_ctx,
36                                 struct auth_ntlmssp_state *auth_ntlmssp_state,
37                                 struct auth_serversupplied_info **session_info);
38 NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state);
39
40
41 /* The following definitions come from auth/auth_sam.c  */
42
43 NTSTATUS check_sam_security(const DATA_BLOB *challenge,
44                             TALLOC_CTX *mem_ctx,
45                             const struct auth_usersupplied_info *user_info,
46                             struct auth_serversupplied_info **server_info);
47 NTSTATUS check_sam_security_info3(const DATA_BLOB *challenge,
48                                   TALLOC_CTX *mem_ctx,
49                                   const struct auth_usersupplied_info *user_info,
50                                   struct netr_SamInfo3 **pinfo3);
51 NTSTATUS auth_sam_init(void);
52
53 /* The following definitions come from auth/auth_server.c  */
54
55 NTSTATUS auth_server_init(void);
56
57 /* The following definitions come from auth/auth_unix.c  */
58
59 NTSTATUS auth_unix_init(void);
60
61 /* The following definitions come from auth/auth_util.c  */
62
63 NTSTATUS make_user_info_map(struct auth_usersupplied_info **user_info,
64                             const char *smb_name,
65                             const char *client_domain,
66                             const char *workstation_name,
67                             DATA_BLOB *lm_pwd,
68                             DATA_BLOB *nt_pwd,
69                             const struct samr_Password *lm_interactive_pwd,
70                             const struct samr_Password *nt_interactive_pwd,
71                             const char *plaintext,
72                             enum auth_password_state password_state);
73 bool make_user_info_netlogon_network(struct auth_usersupplied_info **user_info,
74                                      const char *smb_name,
75                                      const char *client_domain,
76                                      const char *workstation_name,
77                                      uint32 logon_parameters,
78                                      const uchar *lm_network_pwd,
79                                      int lm_pwd_len,
80                                      const uchar *nt_network_pwd,
81                                      int nt_pwd_len);
82 bool make_user_info_netlogon_interactive(struct auth_usersupplied_info **user_info,
83                                          const char *smb_name,
84                                          const char *client_domain,
85                                          const char *workstation_name,
86                                          uint32 logon_parameters,
87                                          const uchar chal[8],
88                                          const uchar lm_interactive_pwd[16],
89                                          const uchar nt_interactive_pwd[16],
90                                          const uchar *dc_sess_key);
91 bool make_user_info_for_reply(struct auth_usersupplied_info **user_info,
92                               const char *smb_name,
93                               const char *client_domain,
94                               const uint8 chal[8],
95                               DATA_BLOB plaintext_password);
96 NTSTATUS make_user_info_for_reply_enc(struct auth_usersupplied_info **user_info,
97                                       const char *smb_name,
98                                       const char *client_domain,
99                                       DATA_BLOB lm_resp, DATA_BLOB nt_resp);
100 bool make_user_info_guest(struct auth_usersupplied_info **user_info) ;
101 struct samu;
102 NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
103                               struct samu *sampass);
104 NTSTATUS create_local_token(TALLOC_CTX *mem_ctx,
105                             const struct auth_serversupplied_info *server_info,
106                             DATA_BLOB *session_key,
107                             struct auth_serversupplied_info **session_info_out);
108 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
109                                     bool is_guest,
110                                     uid_t *uid, gid_t *gid,
111                                     char **found_username,
112                                     struct security_token **token);
113 bool user_in_group_sid(const char *username, const struct dom_sid *group_sid);
114 bool user_in_group(const char *username, const char *groupname);
115 struct passwd;
116 NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
117                              char *unix_username,
118                              struct passwd *pwd);
119 NTSTATUS make_session_info_from_username(TALLOC_CTX *mem_ctx,
120                                          const char *username,
121                                          bool is_guest,
122                                          struct auth_serversupplied_info **session_info);
123 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
124                                                  const struct auth_serversupplied_info *src);
125 bool init_guest_info(void);
126 NTSTATUS init_system_info(void);
127 bool session_info_set_session_key(struct auth_serversupplied_info *info,
128                                  DATA_BLOB session_key);
129 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
130                                 struct auth_serversupplied_info **server_info);
131 NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx,
132                                  struct auth_serversupplied_info **session_info);
133 const struct auth_serversupplied_info *get_session_info_system(void);
134 bool copy_current_user(struct current_user *dst, struct current_user *src);
135 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser,
136                              char **p_save_username, bool create );
137 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
138                                 const char *sent_nt_username,
139                                 const char *domain,
140                                 struct auth_serversupplied_info **server_info,
141                                 struct netr_SamInfo3 *info3);
142 struct wbcAuthUserInfo;
143 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
144                                           const char *sent_nt_username,
145                                           const char *domain,
146                                           const struct wbcAuthUserInfo *info,
147                                           struct auth_serversupplied_info **server_info);
148 void free_user_info(struct auth_usersupplied_info **user_info);
149 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
150 bool is_trusted_domain(const char* dom_name);
151
152 /* The following definitions come from auth/user_info.c  */
153
154 NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
155                         const char *smb_name,
156                         const char *internal_username,
157                         const char *client_domain,
158                         const char *domain,
159                         const char *workstation_name,
160                         const DATA_BLOB *lm_pwd,
161                         const DATA_BLOB *nt_pwd,
162                         const struct samr_Password *lm_interactive_pwd,
163                         const struct samr_Password *nt_interactive_pwd,
164                         const char *plaintext_password,
165                         enum auth_password_state password_state);
166 void free_user_info(struct auth_usersupplied_info **user_info);
167
168 /* The following definitions come from auth/auth_winbind.c  */
169
170 NTSTATUS auth_winbind_init(void);
171
172 /* The following definitions come from auth/server_info.c  */
173
174 struct netr_SamInfo2;
175 struct netr_SamInfo3;
176 struct netr_SamInfo6;
177
178 struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx);
179 NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
180                                 uint8_t *pipe_session_key,
181                                 size_t pipe_session_key_len,
182                                 struct netr_SamInfo2 *sam2);
183 NTSTATUS serverinfo_to_SamInfo3(const struct auth_serversupplied_info *server_info,
184                                 uint8_t *pipe_session_key,
185                                 size_t pipe_session_key_len,
186                                 struct netr_SamInfo3 *sam3);
187 NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
188                                 uint8_t *pipe_session_key,
189                                 size_t pipe_session_key_len,
190                                 struct netr_SamInfo6 *sam6);
191 NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx,
192                           struct samu *samu,
193                           const char *login_server,
194                           struct netr_SamInfo3 **_info3,
195                           struct extra_auth_info *extra);
196 struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
197                                          struct netr_SamInfo3 *orig);
198 struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx,
199                                         const struct wbcAuthUserInfo *info);
200
201 /* The following definitions come from auth/auth_wbc.c  */
202
203 NTSTATUS auth_wbc_init(void);
204
205 /* The following definitions come from auth/pampass.c  */
206
207 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
208 bool smb_pam_close_session(char *user, char *tty, char *rhost);
209 NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost);
210 NTSTATUS smb_pam_passcheck(const char * user, const char * rhost,
211                            const char * password);
212 bool smb_pam_passchange(const char *user, const char *rhost,
213                         const char *oldpassword, const char *newpassword);
214 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
215 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
216
217 /* The following definitions come from auth/pass_check.c  */
218
219 void dfs_unlogin(void);
220 NTSTATUS pass_check(const struct passwd *pass,
221                     const char *user,
222                     const char *rhost,
223                     const char *password,
224                     bool run_cracker);
225
226 /* The following definitions come from auth/token_util.c  */
227
228 bool nt_token_check_sid ( const struct dom_sid *sid, const struct security_token *token );
229 bool nt_token_check_domain_rid( struct security_token *token, uint32 rid );
230 struct security_token *get_root_nt_token( void );
231 NTSTATUS add_aliases(const struct dom_sid *domain_sid,
232                      struct security_token *token);
233 struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
234                                             const struct dom_sid *user_sid,
235                                             bool is_guest,
236                                             int num_groupsids,
237                                             const struct dom_sid *groupsids);
238 NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
239                                           bool is_guest,
240                                           struct netr_SamInfo3 *info3,
241                                           struct extra_auth_info *extra,
242                                           struct security_token **ntok);
243 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
244                            int n_groups, gid_t *groups);
245
246 /* The following definitions come from auth/user_util.c  */
247
248 bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out);
249 bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname);
250 bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list);
251
252 /* The following definitions come from auth/user_krb5.c  */
253 struct PAC_LOGON_INFO;
254 NTSTATUS get_user_from_kerberos_info(TALLOC_CTX *mem_ctx,
255                                      const char *cli_name,
256                                      const char *princ_name,
257                                      struct PAC_LOGON_INFO *logon_info,
258                                      bool *is_mapped,
259                                      bool *mapped_to_guest,
260                                      char **ntuser,
261                                      char **ntdomain,
262                                      char **username,
263                                      struct passwd **_pw);
264 NTSTATUS make_session_info_krb5(TALLOC_CTX *mem_ctx,
265                                 char *ntuser,
266                                 char *ntdomain,
267                                 char *username,
268                                 struct passwd *pw,
269                                 struct PAC_LOGON_INFO *logon_info,
270                                 bool mapped_to_guest, bool username_was_mapped,
271                                 DATA_BLOB *session_key,
272                                 struct auth_serversupplied_info **session_info);