diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-21 20:01:10 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:17 -0500 |
commit | 6e388c27d86d77f2c7f9414fbb152c246ca53022 (patch) | |
tree | c5fa354a5b797f7a90655140572df4b617469839 /source4/lib/samba3/samba3dump.c | |
parent | 7fca0f1b986d5f1786c0c43bec6b10174e137939 (diff) | |
download | samba-6e388c27d86d77f2c7f9414fbb152c246ca53022.tar.gz samba-6e388c27d86d77f2c7f9414fbb152c246ca53022.tar.bz2 samba-6e388c27d86d77f2c7f9414fbb152c246ca53022.zip |
r9455: Support for reading the policy database
(This used to be commit 7548a5012aad41bde0652d4532d184545997be86)
Diffstat (limited to 'source4/lib/samba3/samba3dump.c')
-rw-r--r-- | source4/lib/samba3/samba3dump.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/lib/samba3/samba3dump.c b/source4/lib/samba3/samba3dump.c index 4071ba1bf9..72052092ff 100644 --- a/source4/lib/samba3/samba3dump.c +++ b/source4/lib/samba3/samba3dump.c @@ -20,11 +20,34 @@ */ #include "includes.h" +#include "lib/samba3/policy.h" #include "lib/samba3/sam.h" #include "lib/cmdline/popt_common.h" static const char *libdir = "/var/lib/samba"; +static NTSTATUS print_policy(void) +{ + struct samba3_policy *ret; + char *policy_file; + TALLOC_CTX *mem_ctx = talloc_init(NULL); + + policy_file = talloc_asprintf(mem_ctx, "%s/account_policy.tdb", libdir); + + printf("Opening policy file %s\n", policy_file); + + ret = samba3_read_account_policy(mem_ctx, policy_file); + + if (ret == NULL) + return NT_STATUS_UNSUCCESSFUL; + + printf("Min password length: %d\n", ret->min_password_length); + + talloc_free(mem_ctx); + + return NT_STATUS_OK; +} + static NTSTATUS print_sam(void) { struct samba3_samaccount *accounts; @@ -39,8 +62,10 @@ static NTSTATUS print_sam(void) status = samba3_read_tdbsam(NULL, tdbsam_file, &accounts, &count); if (NT_STATUS_IS_ERR(status)) { fprintf(stderr, "Error reading tdbsam database %s\n", tdbsam_file); + SAFE_FREE(tdbsam_file); return status; } + SAFE_FREE(tdbsam_file); for (i = 0; i < count; i++) { printf("%d: %s\n", accounts[i].user_rid, accounts[i].username); @@ -68,6 +93,7 @@ int main(int argc, char **argv) } print_sam(); + print_policy(); poptFreeContext(pc); |