diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-28 14:55:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:52 -0500 |
commit | 8b15ef881d21b713817bb3aa3599288ecdde0d28 (patch) | |
tree | 275dff742dddefa7040b273de34fd53195c18ee5 /source4/lib/samba3/samba3dump.c | |
parent | 707a237e76cfb6e32b5b930327f209aff2c60b64 (diff) | |
download | samba-8b15ef881d21b713817bb3aa3599288ecdde0d28.tar.gz samba-8b15ef881d21b713817bb3aa3599288ecdde0d28.tar.bz2 samba-8b15ef881d21b713817bb3aa3599288ecdde0d28.zip |
r9712: Bunch of small fixes
Write out basic sam.ldif
(This used to be commit 67593bef7f0f8dc2258b2fe9c06779f0025d240e)
Diffstat (limited to 'source4/lib/samba3/samba3dump.c')
-rw-r--r-- | source4/lib/samba3/samba3dump.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source4/lib/samba3/samba3dump.c b/source4/lib/samba3/samba3dump.c index a6166a1c6b..b95fc0d4b2 100644 --- a/source4/lib/samba3/samba3dump.c +++ b/source4/lib/samba3/samba3dump.c @@ -244,25 +244,35 @@ int main(int argc, char **argv) { int opt; const char *format = "summary"; - const char *libdir = "/var/lib/samba"; + char *libdir = NULL; + char *smbconf = NULL; struct samba3 *samba3; poptContext pc; + TALLOC_CTX *mem_ctx; struct poptOption long_options[] = { POPT_AUTOHELP { "format", 0, POPT_ARG_STRING, &format, 'f', "Format to use (one of: summary, text, ldif)" }, - { "libdir", 0, POPT_ARG_STRING, &libdir, 'l', "Set libdir [/var/lib/samba]", "LIBDIR" }, POPT_COMMON_SAMBA POPT_TABLEEND }; pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0); - poptSetOtherOptionHelp(pc, "<smb.conf>"); + poptSetOtherOptionHelp(pc, "<libdir> <smb.conf>"); while((opt = poptGetNextOpt(pc)) != -1) { } - samba3_read(poptGetArg(pc), libdir, NULL, &samba3); + samba3dump_init_subsystems; + + mem_ctx = talloc_init("samba3dump_context"); + + libdir = talloc_strdup(mem_ctx, poptGetArg(pc)); + smbconf = talloc_strdup(mem_ctx, poptGetArg(pc)); + + printf("Reading from libdir '%s', smb.conf file '%s'\n", libdir, smbconf); + + samba3_read(smbconf, libdir, mem_ctx, &samba3); if (!strcmp(format, "summary")) { printf("WINS db entries: %d\n", samba3->winsdb_count); @@ -276,7 +286,7 @@ int main(int argc, char **argv) print_samba3(samba3); } else if (!strcmp(format, "ldif")) { struct ldb_message **msgs; - struct ldb_context *ldb = ldb_init(NULL); + struct ldb_context *ldb = ldb_init(mem_ctx); int i, ret; const char *hives[] = { "hklm", "hkcr", "hku", "hkpd", "hkpt", NULL }; |