/*
* Unix SMB/CIFS implementation.
* account policy storage
- * Copyright (C) Jean François Micouleau 1998-2001.
- * Copyright (C) Andrew Bartlett 2002
+ * Copyright (C) Jelmer Vernooij 2005
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "lib/samba3/samba3.h"
#include "system/filesys.h"
-#define DATABASE_VERSION 2
-
-/****************************************************************************
- Open the account policy tdb.
-****************************************************************************/
-
-struct samba3_policy *samba3_read_account_policy(TALLOC_CTX *ctx, const char *fn)
+NTSTATUS samba3_read_account_policy(const char *fn, TALLOC_CTX *ctx, struct samba3_policy *ret)
{
- struct samba3_policy *ret;
- const char *vstring = "INFO/version";
- uint32_t version;
-
TDB_CONTEXT *tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0600);
if (!tdb) {
DEBUG(0,("Failed to open account policy database\n"));
- return NULL;
- }
-
- /* handle a Samba upgrade */
- if (!tdb_fetch_uint32(tdb, vstring, &version) || version != DATABASE_VERSION) {
- tdb_store_uint32(tdb, vstring, DATABASE_VERSION);
+ return NT_STATUS_UNSUCCESSFUL;
}
- ret = talloc_zero(ctx, struct samba3_policy);
-
tdb_fetch_uint32(tdb, "min password length", &ret->min_password_length);
tdb_fetch_uint32(tdb, "password history", &ret->password_history);
tdb_fetch_uint32(tdb, "user must logon to change pasword", &ret->user_must_logon_to_change_password);
tdb_fetch_uint32(tdb, "disconnect time", &ret->disconnect_time);
tdb_fetch_uint32(tdb, "refuse machine password change", &ret->refuse_machine_password_change);
+ /* FIXME: Read privileges as well */
+
tdb_close(tdb);
- return ret;
+ return NT_STATUS_OK;
}
-
-
-/* FIXME: Read privileges as well */