From 3e11421e7476d968a3d550491279d0ad6b6c398f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 15 Aug 2013 12:32:06 +0930 Subject: Man pages for ntdb tools missing Copied and modified from tdb man pages. Avoided reproducing API documentation which is extensively documented in the ntdb.h header already. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10000 Signed-off-by: Rusty Russell Reviewed-by: Jeremy Allison --- lib/ntdb/man/ntdb.3.xml | 132 ++++++++++++++++++++++ lib/ntdb/man/ntdbbackup.8.xml | 150 ++++++++++++++++++++++++ lib/ntdb/man/ntdbdump.8.xml | 93 +++++++++++++++ lib/ntdb/man/ntdbrestore.8.xml | 74 ++++++++++++ lib/ntdb/man/ntdbtool.8.xml | 251 +++++++++++++++++++++++++++++++++++++++++ lib/ntdb/wscript | 13 ++- 6 files changed, 708 insertions(+), 5 deletions(-) create mode 100644 lib/ntdb/man/ntdb.3.xml create mode 100644 lib/ntdb/man/ntdbbackup.8.xml create mode 100644 lib/ntdb/man/ntdbdump.8.xml create mode 100644 lib/ntdb/man/ntdbrestore.8.xml create mode 100644 lib/ntdb/man/ntdbtool.8.xml (limited to 'lib') diff --git a/lib/ntdb/man/ntdb.3.xml b/lib/ntdb/man/ntdb.3.xml new file mode 100644 index 0000000000..79f8937994 --- /dev/null +++ b/lib/ntdb/man/ntdb.3.xml @@ -0,0 +1,132 @@ + + + + + ntdb + 3 + Samba + System Administration tools + 4.0 + + + ntdb +A not-so trivial keyword/data database system + + +#include <ntdb.h> + + DESCRIPTION + + If you have previously used the tdb library from Samba, much of + this will seem familiar, but there are some API changes which a + compiler will warn you about if you simply replace 'tdb' with + 'ntdb' in your code! The on-disk format for ntdb is + incompatible with tdb. + + + tdb's API was based on gdbm, and ntdb continues this tradition, + with enhancements. A differences guide is available in the text + file lib/ntdb/doc/TDB_porting.txt in the + SAMBA source tree. + + + NTDB API OVERVIEW + + The complete API is documented in the ntdb.h header, which is + kept up-to-date and recommended reading. + + + Normal usage is to call ntdb_open() to create or open an ntdb + file. ntdb_store() is used to add records, ntdb_fetch() is used + to fetch them. Traversals are supported via callback + (ntdb_traverse()) or iteration (ntdb_firstkey() and + ntdb_nextkey()). Transactions are supported for batching + updates or reads atomically, using ntdb_transaction_start() and + ntdb_transaction_commit(). + + Use With Talloc + + ntdb_open() takes an optional linked list of attributes: + in particular you can specify an alternate allocator (such as + talloc): + + +#include <talloc.h> +#include <ntdb.h> + +static void *my_alloc(const void *owner, size_t len, void *priv) +{ + return talloc_size(owner, len); +} + +static void *my_expand(void *old, size_t newlen, void *priv) +{ + return talloc_realloc_size(NULL, old, newlen); +} + +static void my_free(void *old, void *priv) +{ + talloc_free(old); +} + +/* This opens an ntdb file as a talloc object with given parent. */ +struct ntdb_context *ntdb_open_talloc(const void *parent, + const char *filename) +{ + struct ntdb_context *ntdb; + union ntdb_attribute alloc; + + alloc.base.attr = NTDB_ATTRIBUTE_ALLOCATOR; + alloc.base.next = NULL; + alloc.alloc.alloc = my_alloc; + alloc.alloc.expand = my_expand; + alloc.alloc.free = my_free; + + ntdb = ntdb_open(filename, NTDB_DEFAULT, O_RDWR|O_CREAT, 0600, + &alloc); + if (ntdb) { + talloc_steal(parent, ntdb); + talloc_set_name(ntdb, "%s", filename); + } + return ntdb; +} + + + + SEE ALSO + + + + + + AUTHOR + The original tdb software was created by Andrew Tridgell, and + is now developed by the + Samba Team as an Open Source project similar to the way the + Linux kernel is developed. ntdb was derived from tdb, but mostly + rewritten by Rusty Russell. + + + + COPYRIGHT/LICENSE + + Copyright (C) Rusty Russell 2013, IBM Corporation + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + + You should have received a copy of the GNU General Public License + along with this program; if not, see http://www.gnu.org/licenses/. + + + diff --git a/lib/ntdb/man/ntdbbackup.8.xml b/lib/ntdb/man/ntdbbackup.8.xml new file mode 100644 index 0000000000..977c0f7a27 --- /dev/null +++ b/lib/ntdb/man/ntdbbackup.8.xml @@ -0,0 +1,150 @@ + + + + + + ntdbbackup + 8 + Samba + System Administration tools + 4.0 + + + + + ntdbbackup + tool for backing up and for validating the integrity of samba .ntdb files + + + + + ntdbbackup + -s suffix + -v + -h + + + + + DESCRIPTION + + This tool is part of the samba + 1 suite. + + ntdbbackup is a tool that may be used to backup samba .ntdb + files. This tool may also be used to verify the integrity of the .ntdb files prior + to samba startup or during normal operation. If it finds file damage and it finds + a prior backup the backup file will be restored. + + + + + + OPTIONS + + + + + -h + + Get help information. + + + + + -s suffix + + The -s option allows the administrator to specify a file + backup extension. This way it is possible to keep a history of ntdb backup + files by using a new suffix for each backup. + + + + + -v + + The -v will check the database for damages (corrupt data) + which if detected causes the backup to be restored. + + + + + + + + + COMMANDS + + GENERAL INFORMATION + + + The ntdbbackup utility can safely be run at any time. It was designed so + that it can be used at any time to validate the integrity of ntdb files, even during Samba + operation. Typical usage for the command will be: + + + ntdbbackup [-s suffix] *.ntdb + + + Before restarting samba the following command may be run to validate .ntdb files: + + + ntdbbackup -v [-s suffix] *.ntdb + + + Note that Samba 4 can use .tdb files instead, so you should + use tdbbackup on those files. + + + + Samba .tdb and .ntdb files are stored in various locations, be sure to run backup all + .(n)tdb files on the system. Important files includes: + + + + + secrets.(n)tdb - usual location is in the /usr/local/samba/private + directory, or on some systems in /etc/samba. + + + + passdb.(n)tdb - usual location is in the /usr/local/samba/private + directory, or on some systems in /etc/samba. + + + + *.tdb and *.ntdb located in the /usr/local/samba/var directory or on some + systems in the /var/cache or /var/lib/samba directories. + + + + + + + VERSION + + This man page is correct for version 4 of the Samba suite. + + + + SEE ALSO + + + tdbbackup(8), ntdbrestore(8) + + + + + AUTHOR + + + The original Samba software and related utilities were created by Andrew Tridgell. + Samba is now developed by the Samba Team as an Open Source project similar to the way + the Linux kernel is developed. + + + The ntdbbackup man page was written by Rusty Russell, + based on the tdbbackup man page by John H Terpstra. + + + diff --git a/lib/ntdb/man/ntdbdump.8.xml b/lib/ntdb/man/ntdbdump.8.xml new file mode 100644 index 0000000000..ee1711a62f --- /dev/null +++ b/lib/ntdb/man/ntdbdump.8.xml @@ -0,0 +1,93 @@ + + + + + + ntdbdump + 8 + Samba + System Administration tools + 4.0 + + + + + ntdbdump + tool for printing the contents of an NTDB file + + + + + ntdbdump + -k keyname + -e + -h + filename + + + + + DESCRIPTION + + This tool is part of the samba + 1 suite. + + ntdbdump is a very simple utility that 'dumps' the + contents of a NTDB (New Trivial DataBase) file to standard output in a + human-readable format. + + + This tool can be used when debugging problems with NTDB files. It is + intended for those who are somewhat familiar with Samba internals. + + + + + OPTIONS + + + + + -h + + Get help information. + + + + + -k keyname + + The -k option restricts dumping to a single key, if found. + + + + + + + + SEE ALSO + + + tdbdump(8), ntdbtool(8) + + + + + VERSION + + This man page is correct for version 4 of the Samba suite. + + + + AUTHOR + + + The original Samba software and related utilities were created by Andrew Tridgell. + Samba is now developed by the Samba Team as an Open Source project similar to the way + the Linux kernel is developed. + + + The ntdbdump man page was written by Rusty Russell, base on the tdbdump man page by Jelmer Vernooij. + + + diff --git a/lib/ntdb/man/ntdbrestore.8.xml b/lib/ntdb/man/ntdbrestore.8.xml new file mode 100644 index 0000000000..a1f0421352 --- /dev/null +++ b/lib/ntdb/man/ntdbrestore.8.xml @@ -0,0 +1,74 @@ + + + + + + ntdbrestore + 8 + Samba + System Administration tools + 4.0 + + + + + ntdbrestore + tool for creating a NTDB file out of a ntdbdump output + + + + + ntdbrestore + ntdbfilename + + + + + DESCRIPTION + + This tool is part of the samba + 1 suite. + + ntdbrestore is a very simple utility that 'restores' the + contents of dump file into NTDB (New Trivial DataBase) file. The dump file is obtained from the ntdbdump or tdbdump + commands. + + + This tool wait on the standard input for the content of the dump and will write the ntdb in the ntdbfilename + parameter. + + This tool can be used to translate between ntdb and tdb files by dumping and restoring. + + + + + + VERSION + + This man page is correct for version 4 of the Samba suite. + + + + SEE ALSO + + + ntdbdump(8), tdbrestore(8) + + + + + AUTHOR + + + The original Samba software and related utilities were created by Andrew Tridgell. + Samba is now developed by the Samba Team as an Open Source project similar to the way + the Linux kernel is developed. + + ntdbrestore was written by Rusty Russell based on tdbrestore, which was initially written by Volker Lendecke based on an + idea by Simon McVittie. + + + The ntdbrestore man page was written by Rusty Russell, based on the tdbrestore man page by Matthieu Patou. + + + diff --git a/lib/ntdb/man/ntdbtool.8.xml b/lib/ntdb/man/ntdbtool.8.xml new file mode 100644 index 0000000000..6a69a0585d --- /dev/null +++ b/lib/ntdb/man/ntdbtool.8.xml @@ -0,0 +1,251 @@ + + + + + + ntdbtool + 8 + Samba + System Administration tools + 4.0 + + + + + ntdbtool + manipulate the contents NTDB files + + + + + + ntdbtool + + + + ntdbtool + + NTDBFILE + + + COMMANDS + + + + + + + DESCRIPTION + + This tool is part of the + samba + 1 suite. + + ntdbtool a tool for displaying and + altering the contents of Samba NTDB (New Trivial DataBase) files. Each + of the commands listed below can be entered interactively or + provided on the command line. + + + + + + COMMANDS + + + + + + NTDBFILE + Create a new database named + NTDBFILE. + + + + + + NTDBFILE + Open an existing database named + NTDBFILE. + + + + + + Erase the current database. + + + + + + Dump the current database as strings. + + + + + + Dump the current database as connection records. + + + + + + Dump the current database keys as strings. + + + + + + Dump the current database keys as hex values. + + + + + + Print summary information about the + current database. + + + + + + KEY + DATA + + Insert a record into the + current database. + + + + + + KEY + NTDBFILE + + Move a record from the + current database into NTDBFILE. + + + + + + KEY + DATA + + Store (replace) a record in the + current database. + + + + + + KEY + + Show a record by key. + + + + + + KEY + + Delete a record by key. + + + + + + + Print the current database hash table and free list. + + + + + + + Print the current database and free list. + + + + + + COMMAND + + Execute the given system command. + + + + + + + + Print the first record in the current database. + + + + + + + + Print the next record in the current database. + + + + + + + + Check the integrity of the current database. + + + + + + + + Repack a database using a temporary file to remove fragmentation. + + + + + + + + Exit ntdbtool. + + + + + + + + SEE ALSO + + + tdbtool(8) + + + + + CAVEATS + The contents of the Samba NTDB files are private + to the implementation and should not be altered with + ntdbtool. + + + + + VERSION + This man page is correct for version 4.0 of the Samba suite. + + + + AUTHOR + + The original Samba software and related utilities were + created by Andrew Tridgell. Samba is now developed by the + Samba Team as an Open Source project similar to the way the + Linux kernel is developed. + + + diff --git a/lib/ntdb/wscript b/lib/ntdb/wscript index 63c8402d66..ce66c92fda 100644 --- a/lib/ntdb/wscript +++ b/lib/ntdb/wscript @@ -121,6 +121,8 @@ def configure(conf): Logs.warn('Disabling pyntdb as python devel libs not found') conf.env.disable_python = True + conf.CHECK_XSLTPROC_MANPAGES() + # This make #include work. conf.ADD_EXTRA_INCLUDES('''#lib''') @@ -152,7 +154,8 @@ def build(bld): public_headers='ntdb.h', public_headers_install=not private_library, pc_files='ntdb.pc', - private_library=private_library) + private_library=private_library, + manpages='man/ntdb.3') bld.SAMBA_BINARY('ntdbtorture', 'tools/ntdbtorture.c', @@ -161,19 +164,19 @@ def build(bld): bld.SAMBA_BINARY('ntdbtool', 'tools/ntdbtool.c', - deps='ntdb') + deps='ntdb', manpages='man/ntdbtool.8') bld.SAMBA_BINARY('ntdbdump', 'tools/ntdbdump.c', - deps='ntdb') + deps='ntdb', manpages='man/ntdbdump.8') bld.SAMBA_BINARY('ntdbrestore', 'tools/ntdbrestore.c', - deps='ntdb') + deps='ntdb', manpages='man/ntdbrestore.8') bld.SAMBA_BINARY('ntdbbackup', 'tools/ntdbbackup.c', - deps='ntdb') + deps='ntdb', manpages='man/ntdbbackup.8') if bld.env.DEVELOPER_MODE: # FIXME: We need CCAN for some API tests, but waf thinks it's -- cgit