mit_samba: Add functions to generate random password and salt.
[vlendec/samba-autobuild/.git] / source4 / kdc / mit_samba.h
1 /*
2    MIT-Samba4 library
3
4    Copyright (c) 2010, Simo Sorce <idra@samba.org>
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef _MIT_SAMBA_H
21 #define _MIT_SAMBA_H
22
23 struct mit_samba_context {
24         struct auth_session_info *session_info;
25
26         /* for compat with hdb plugin common code */
27         krb5_context context;
28         struct samba_kdc_db_context *db_ctx;
29 };
30
31 int mit_samba_context_init(struct mit_samba_context **_ctx);
32
33 void mit_samba_context_free(struct mit_samba_context *ctx);
34
35 int mit_samba_generate_salt(krb5_data *salt);
36
37 int mit_samba_generate_random_password(krb5_data *pwd);
38
39 int mit_samba_get_principal(struct mit_samba_context *ctx,
40                                    krb5_const_principal principal,
41                                    unsigned int kflags,
42                                    krb5_db_entry **_kentry);
43
44 int mit_samba_get_firstkey(struct mit_samba_context *ctx,
45                            krb5_db_entry **_kentry);
46
47 int mit_samba_get_nextkey(struct mit_samba_context *ctx,
48                           krb5_db_entry **_kentry);
49
50 int mit_samba_get_pac_data(struct mit_samba_context *ctx,
51                            krb5_db_entry *client,
52                            DATA_BLOB *data);
53
54 int mit_samba_update_pac_data(struct mit_samba_context *ctx,
55                               krb5_db_entry *client,
56                               DATA_BLOB *pac_data,
57                               DATA_BLOB *logon_data);
58
59 int mit_samba_update_pac_data(struct mit_samba_context *ctx,
60                               krb5_db_entry *client,
61                               DATA_BLOB *pac_data,
62                               DATA_BLOB *logon_data);
63
64 int mit_samba_check_client_access(struct mit_samba_context *ctx,
65                                   krb5_db_entry *client,
66                                   const char *client_name,
67                                   krb5_db_entry *server,
68                                   const char *server_name,
69                                   const char *netbios_name,
70                                   bool password_change,
71                                   DATA_BLOB *e_data);
72
73 int mit_samba_check_s4u2proxy(struct mit_samba_context *ctx,
74                               krb5_db_entry *kentry,
75                               const char *target_name,
76                               bool is_nt_enterprise_name);
77
78 int mit_samba_kpasswd_change_password(struct mit_samba_context *ctx,
79                                       char *pwd,
80                                       krb5_db_entry *db_entry);
81
82 #endif /* _MIT_SAMBA_H */