Merge commit 'release-4-0-0alpha1' into v4-0-test
[kai/samba.git] / source4 / param / secrets.h
1 /*
2  * Unix SMB/CIFS implementation. 
3  * secrets.tdb file format info
4  * Copyright (C) Andrew Tridgell              2000
5  * 
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation; either version 3 of the License, or (at your
9  * option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with
17  * this program; if not, see <http://www.gnu.org/licenses/>.  
18  */
19
20 #ifndef _SECRETS_H
21 #define _SECRETS_H
22
23 /* structure for storing machine account password
24    (ie. when samba server is member of a domain */
25 struct machine_acct_pass {
26         uint8_t hash[16];
27         time_t mod_time;
28 };
29
30 #define SECRETS_PRIMARY_DOMAIN_DN "cn=Primary Domains"
31 #define SECRETS_PRINCIPALS_DN "cn=Principals"
32 #define SECRETS_PRIMARY_DOMAIN_FILTER "(&(flatname=%s)(objectclass=primaryDomain))"
33 #define SECRETS_PRIMARY_REALM_FILTER "(&(realm=%s)(objectclass=primaryDomain))"
34 #define SECRETS_KRBTGT_SEARCH "(&((|(realm=%s)(flatname=%s))(samAccountName=krbtgt)))"
35 #define SECRETS_PRINCIPAL_SEARCH "(&(|(realm=%s)(flatname=%s))(servicePrincipalName=%s))"
36
37 /**
38  * Use a TDB to store an incrementing random seed.
39  *
40  * Initialised to the current pid, the very first time Samba starts,
41  * and incremented by one each time it is needed.  
42  * 
43  * @note Not called by systems with a working /dev/urandom.
44  */
45 void secrets_shutdown(void);
46 bool secrets_init(void);
47 struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx);
48 struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
49                                        const char *domain);
50
51
52 #endif /* _SECRETS_H */