2 * Unix SMB/CIFS implementation.
3 * account policy storage
4 * Copyright (C) Jelmer Vernooij 2005
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 2 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "lib/tdb/include/tdb.h"
23 #include "lib/util/util_tdb.h"
24 #include "lib/samba3/samba3.h"
25 #include "system/filesys.h"
27 NTSTATUS samba3_read_account_policy(const char *fn, TALLOC_CTX *ctx, struct samba3_policy *ret)
29 TDB_CONTEXT *tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0600);
31 DEBUG(0,("Failed to open account policy database\n"));
32 return NT_STATUS_UNSUCCESSFUL;
35 tdb_fetch_uint32(tdb, "min password length", &ret->min_password_length);
36 tdb_fetch_uint32(tdb, "password history", &ret->password_history);
37 tdb_fetch_uint32(tdb, "user must logon to change pasword", &ret->user_must_logon_to_change_password);
38 tdb_fetch_uint32(tdb, "maximum password age", &ret->maximum_password_age);
39 tdb_fetch_uint32(tdb, "minimum password age", &ret->minimum_password_age);
40 tdb_fetch_uint32(tdb, "lockout duration", &ret->lockout_duration);
41 tdb_fetch_uint32(tdb, "reset count minutes", &ret->reset_count_minutes);
42 tdb_fetch_uint32(tdb, "bad lockout minutes", &ret->bad_lockout_minutes);
43 tdb_fetch_uint32(tdb, "disconnect time", &ret->disconnect_time);
44 tdb_fetch_uint32(tdb, "refuse machine password change", &ret->refuse_machine_password_change);
46 /* FIXME: Read privileges as well */