aboutsummaryrefslogtreecommitdiff
path: root/databases/ntdb
diff options
context:
space:
mode:
authorTimur I. Bakeyev <timur@FreeBSD.org>2014-03-12 21:25:03 +0000
committerTimur I. Bakeyev <timur@FreeBSD.org>2014-03-12 21:25:03 +0000
commitb36eb13e440ff802a6d7e37a20c4bd97dfbf0959 (patch)
treedaa12dcb876abff432e601371a10015b2fb2eaa4 /databases/ntdb
parent2101e651e92d29598bf480095a51f7d5bd006f5c (diff)
downloadports-b36eb13e440ff802a6d7e37a20c4bd97dfbf0959.tar.gz
ports-b36eb13e440ff802a6d7e37a20c4bd97dfbf0959.zip
Add new port databases/ntdb - it's revised version of databases/tdb, used by
net/samba41 port.
Notes
Notes: svn path=/head/; revision=348008
Diffstat (limited to 'databases/ntdb')
-rw-r--r--databases/ntdb/Makefile134
-rw-r--r--databases/ntdb/distinfo2
-rw-r--r--databases/ntdb/files/ntdb.3115
-rw-r--r--databases/ntdb/files/ntdbbackup.8133
-rw-r--r--databases/ntdb/files/ntdbdump.868
-rw-r--r--databases/ntdb/files/ntdbrestore.857
-rw-r--r--databases/ntdb/files/ntdbtool.8167
-rw-r--r--databases/ntdb/files/patch-buildtools__wafsamba__samba_install.py11
-rw-r--r--databases/ntdb/files/patch-wscript11
-rw-r--r--databases/ntdb/pkg-descr6
10 files changed, 704 insertions, 0 deletions
diff --git a/databases/ntdb/Makefile b/databases/ntdb/Makefile
new file mode 100644
index 000000000000..7bbc1c5ef7d8
--- /dev/null
+++ b/databases/ntdb/Makefile
@@ -0,0 +1,134 @@
+# $FreeBSD$
+
+PORTNAME= ntdb
+PORTVERSION= 1.0
+PORTREVISION= 0
+PORTEPOCH= 0
+CATEGORIES= databases
+MASTER_SITES= ${MASTER_SITE_SAMBA}
+MASTER_SITE_SUBDIR= tdb
+
+MAINTAINER= timur@FreeBSD.org
+COMMENT= Not so Trivial DataBase
+
+LICENSE= GPLv3
+
+USES= compiler pkgconfig
+USE_PYTHON_BUILD= 2
+USE_LDCONFIG= yes
+WAF_TOOL= buildtools/bin/waf
+CONFIGURE_LOG= bin/config.log
+
+PKGCONFIGDIR?= ${PREFIX}/libdata/pkgconfig
+PLIST_SUB+= PKGCONFIGDIR=${PKGCONFIGDIR:S;${PREFIX}/;;}
+
+CONFIGURE_ARGS+= --prefix=${PREFIX} \
+ --mandir=${MANPREFIX}/man \
+ --infodir=${PREFIX}/${INFO_PATH}/${INFO_SUBDIR}
+# Support staging
+DESTDIRNAME= --destdir
+
+.include <bsd.port.options.mk>
+
+.include <bsd.port.pre.mk>
+
+.if ! ${PORT_OPTIONS:MMANPAGES}
+CONFIGURE_ENV+= XSLTPROC="true"
+.else
+BUILD_DEPENDS+= ${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:${PORTSDIR}/textproc/docbook-xsl \
+ xsltproc:${PORTSDIR}/textproc/libxslt
+.endif
+
+PLIST_FILES= bin/ntdbbackup \
+ bin/ntdbdump \
+ bin/ntdbrestore \
+ bin/ntdbtool \
+ include/ntdb.h \
+ lib/libntdb.so \
+ lib/libntdb.so.1 \
+ %%PKGCONFIGDIR%%/ntdb.pc
+
+# No fancy color error messages
+.if ${COMPILER_TYPE} == "clang"
+CFLAGS+= -fno-color-diagnostics
+.endif
+CONFIGURE_ENV+= NOCOLOR=yes
+MAKE_ENV+= NOCOLOR=yes
+
+.if !defined(DISABLE_MAKE_JOBS) && !defined(MAKE_JOBS_UNSAFE)
+CONFIGURE_ARGS+= --jobs=${MAKE_JOBS_NUMBER}
+_MAKE_JOBS+= --jobs=${MAKE_JOBS_NUMBER}
+.endif
+
+USE_PYTHON_RUN= yes
+PLIST_FILES+= %%PYTHON_SITELIBDIR%%/ntdb.so
+PLIST_DIRSTRY+= %%PYTHON_SITELIBDIR%% \
+ %%PYTHON_LIBDIR%%
+
+TDB_MAN3= man/man3/ntdb.3.gz
+
+TDB_MAN8= man/man8/ntdbbackup.8.gz \
+ man/man8/ntdbdump.8.gz \
+ man/man8/ntdbrestore.8.gz \
+ man/man8/ntdbtool.8.gz
+
+PLIST_FILES+= ${TDB_MAN3} ${TDB_MAN8}
+
+CONFIGURE_TARGET= configure
+ALL_TARGET= build
+INSTALL_TARGET= install
+
+IGNORE_NONTHREAD_PYTHON=needs port lang/python${PYTHON_SUFFIX} to be build with THREADS support
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|%%PKGCONFIGDIR%%|${PKGCONFIGDIR}|g' \
+ ${BUILD_WRKSRC}/wscript
+
+# Use threading (or multiprocessing) but not thread (renamed in python 3+).
+pre-configure:
+ @if ! ${PYTHON_CMD} -c "import multiprocessing;" 2>/dev/null; then \
+ ${ECHO_CMD}; \
+ ${ECHO_MSG} "===> ${PKGNAME} "${IGNORE_NONTHREAD_PYTHON:Q}.; \
+ ${ECHO_CMD}; \
+ ${FALSE}; \
+ fi
+
+do-configure:
+ @(cd ${CONFIGURE_WRKSRC} && \
+ ${SET_LATE_CONFIGURE_ARGS} \
+ if ! ${SETENV} CC="${CC}" CPP="${CPP}" CXX="${CXX}" \
+ CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" CXXFLAGS="${CXXFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ INSTALL="/usr/bin/install -c ${_BINOWNGRP}" \
+ INSTALL_DATA="${INSTALL_DATA}" \
+ INSTALL_LIB="${INSTALL_LIB}" \
+ INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
+ INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
+ ${CONFIGURE_ENV} ${PYTHON_CMD} ${CONFIGURE_WRKSRC}/${WAF_TOOL} ${CONFIGURE_ARGS} ${CONFIGURE_TARGET}; then \
+ ${ECHO_MSG} "===> Script \"${CONFIGURE_SCRIPT}\" failed unexpectedly."; \
+ (${ECHO_CMD} ${CONFIGURE_FAIL_MESSAGE}) | ${FMT} 75 79 ; \
+ ${FALSE}; \
+ fi)
+
+pre-build:
+.if ! ${PORT_OPTIONS:MMANPAGES}
+ -${MKDIR} ${BUILD_WRKSRC}/bin/default/man
+. for man in ${TDB_MAN3} ${TDB_MAN8}
+ ${INSTALL_MAN} ${FILESDIR}/`basename ${man} .gz` ${BUILD_WRKSRC}/bin/default/man
+. endfor
+.endif
+
+do-build:
+ @(cd ${BUILD_WRKSRC}; \
+ if ! ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${BUILD_WRKSRC}/${WAF_TOOL} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET}; then \
+ if [ x != x${BUILD_FAIL_MESSAGE} ] ; then \
+ ${ECHO_MSG} "===> Compilation failed unexpectedly."; \
+ (${ECHO_CMD} ${BUILD_FAIL_MESSAGE}) | ${FMT} 75 79 ; \
+ fi; \
+ ${FALSE}; \
+ fi)
+
+do-install:
+ @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${INSTALL_WRKSRC}/${WAF_TOOL} ${MAKE_ARGS} ${INSTALL_TARGET})
+
+.include <bsd.port.mk>
diff --git a/databases/ntdb/distinfo b/databases/ntdb/distinfo
new file mode 100644
index 000000000000..2245e2c302fa
--- /dev/null
+++ b/databases/ntdb/distinfo
@@ -0,0 +1,2 @@
+SHA256 (ntdb-1.0.tar.gz) = 817ae862b1e6976cab867468f209d8417a90c7c2fcf0ec079a45645d7e7ebf49
+SIZE (ntdb-1.0.tar.gz) = 794585
diff --git a/databases/ntdb/files/ntdb.3 b/databases/ntdb/files/ntdb.3
new file mode 100644
index 000000000000..1215e9648058
--- /dev/null
+++ b/databases/ntdb/files/ntdb.3
@@ -0,0 +1,115 @@
+'\" t
+.\" Title: ntdb
+.\" Author: [see the "AUTHOR" section]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 03/12/2014
+.\" Manual: System Administration tools
+.\" Source: Samba 4.1
+.\" Language: English
+.\"
+.TH "NTDB" "3" "03/12/2014" "Samba 4\&.1" "System Administration tools"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+ntdb \- A not\-so trivial keyword/data database system
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <ntdb\&.h>
+.fi
+.SH "DESCRIPTION"
+.PP
+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 \*(Aqtdb\*(Aq with \*(Aqntdb\*(Aq in your code! The on\-disk format for ntdb is incompatible with tdb\&.
+.PP
+tdb\*(Aqs 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\&.
+.SH "NTDB API OVERVIEW"
+.PP
+The complete API is documented in the ntdb\&.h header, which is kept up\-to\-date and recommended reading\&.
+.PP
+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()\&.
+.SS "Use With Talloc"
+.PP
+ntdb_open() takes an optional linked list of attributes: in particular you can specify an alternate allocator (such as talloc):
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+#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;
+}
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.PP
+
+\m[blue]\fB\%http://tdb.samba.org/\fR\m[]
+.SH "AUTHOR"
+.PP
+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\&.
+.SH "COPYRIGHT/LICENSE"
+.PP
+Copyright (C) Rusty Russell 2013, IBM Corporation
+.PP
+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\&.
+.PP
+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\&.
+.PP
+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/databases/ntdb/files/ntdbbackup.8 b/databases/ntdb/files/ntdbbackup.8
new file mode 100644
index 000000000000..bfed35cd296f
--- /dev/null
+++ b/databases/ntdb/files/ntdbbackup.8
@@ -0,0 +1,133 @@
+'\" t
+.\" Title: ntdbbackup
+.\" Author: [see the "AUTHOR" section]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 03/12/2014
+.\" Manual: System Administration tools
+.\" Source: Samba 4.1
+.\" Language: English
+.\"
+.TH "NTDBBACKUP" "8" "03/12/2014" "Samba 4\&.1" "System Administration tools"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+ntdbbackup \- tool for backing up and for validating the integrity of samba \&.ntdb files
+.SH "SYNOPSIS"
+.HP \w'\fBntdbbackup\fR\ 'u
+\fBntdbbackup\fR [\-s\ suffix] [\-v] [\-h]
+.SH "DESCRIPTION"
+.PP
+This tool is part of the
+\fBsamba\fR(1)
+suite\&.
+.PP
+\fBntdbbackup\fR
+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\&.
+.SH "OPTIONS"
+.PP
+\-h
+.RS 4
+Get help information\&.
+.RE
+.PP
+\-s suffix
+.RS 4
+The
+\fB\-s\fR
+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\&.
+.RE
+.PP
+\-v
+.RS 4
+The
+\fB\-v\fR
+will check the database for damages (corrupt data) which if detected causes the backup to be restored\&.
+.RE
+.SH "COMMANDS"
+.PP
+\fIGENERAL INFORMATION\fR
+.PP
+The
+\fBntdbbackup\fR
+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:
+.PP
+ntdbbackup [\-s suffix] *\&.ntdb
+.PP
+Before restarting samba the following command may be run to validate \&.ntdb files:
+.PP
+ntdbbackup \-v [\-s suffix] *\&.ntdb
+.PP
+Note that Samba 4 can use \&.tdb files instead, so you should use
+\fBtdbbackup\fR
+on those files\&.
+.PP
+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:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBsecrets\&.(n)tdb\fR
+\- usual location is in the /usr/local/samba/private directory, or on some systems in /etc/samba\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBpassdb\&.(n)tdb\fR
+\- usual location is in the /usr/local/samba/private directory, or on some systems in /etc/samba\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fB*\&.tdb\fR
+and
+\fB*\&.ntdb\fR
+located in the /usr/local/samba/var directory or on some systems in the /var/cache or /var/lib/samba directories\&.
+.RE
+.SH "VERSION"
+.PP
+This man page is correct for version 4 of the Samba suite\&.
+.SH "SEE ALSO"
+.PP
+tdbbackup(8), ntdbrestore(8)
+.SH "AUTHOR"
+.PP
+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\&.
+.PP
+The ntdbbackup man page was written by Rusty Russell, based on the tdbbackup man page by John H Terpstra\&.
diff --git a/databases/ntdb/files/ntdbdump.8 b/databases/ntdb/files/ntdbdump.8
new file mode 100644
index 000000000000..ac52ca3b9452
--- /dev/null
+++ b/databases/ntdb/files/ntdbdump.8
@@ -0,0 +1,68 @@
+'\" t
+.\" Title: ntdbdump
+.\" Author: [see the "AUTHOR" section]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 03/12/2014
+.\" Manual: System Administration tools
+.\" Source: Samba 4.1
+.\" Language: English
+.\"
+.TH "NTDBDUMP" "8" "03/12/2014" "Samba 4\&.1" "System Administration tools"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+ntdbdump \- tool for printing the contents of an NTDB file
+.SH "SYNOPSIS"
+.HP \w'\fBntdbdump\fR\ 'u
+\fBntdbdump\fR [\-k\ \fIkeyname\fR] [\-e] [\-h] {filename}
+.SH "DESCRIPTION"
+.PP
+This tool is part of the
+\fBsamba\fR(1)
+suite\&.
+.PP
+\fBntdbdump\fR
+is a very simple utility that \*(Aqdumps\*(Aq the contents of a NTDB (New Trivial DataBase) file to standard output in a human\-readable format\&.
+.PP
+This tool can be used when debugging problems with NTDB files\&. It is intended for those who are somewhat familiar with Samba internals\&.
+.SH "OPTIONS"
+.PP
+\-h
+.RS 4
+Get help information\&.
+.RE
+.PP
+\-k \fIkeyname\fR
+.RS 4
+The
+\fB\-k\fR
+option restricts dumping to a single key, if found\&.
+.RE
+.SH "SEE ALSO"
+.PP
+tdbdump(8), ntdbtool(8)
+.SH "VERSION"
+.PP
+This man page is correct for version 4 of the Samba suite\&.
+.SH "AUTHOR"
+.PP
+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\&.
+.PP
+The ntdbdump man page was written by Rusty Russell, base on the tdbdump man page by Jelmer Vernooij\&.
diff --git a/databases/ntdb/files/ntdbrestore.8 b/databases/ntdb/files/ntdbrestore.8
new file mode 100644
index 000000000000..1b2d882ff3dc
--- /dev/null
+++ b/databases/ntdb/files/ntdbrestore.8
@@ -0,0 +1,57 @@
+'\" t
+.\" Title: ntdbrestore
+.\" Author: [see the "AUTHOR" section]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 03/12/2014
+.\" Manual: System Administration tools
+.\" Source: Samba 4.1
+.\" Language: English
+.\"
+.TH "NTDBRESTORE" "8" "03/12/2014" "Samba 4\&.1" "System Administration tools"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+ntdbrestore \- tool for creating a NTDB file out of a ntdbdump output
+.SH "SYNOPSIS"
+.HP \w'\fBntdbrestore\fR\ 'u
+\fBntdbrestore\fR {ntdbfilename}
+.SH "DESCRIPTION"
+.PP
+This tool is part of the
+\fBsamba\fR(1)
+suite\&.
+.PP
+\fBntdbrestore\fR
+is a very simple utility that \*(Aqrestores\*(Aq the contents of dump file into NTDB (New Trivial DataBase) file\&. The dump file is obtained from the ntdbdump or tdbdump commands\&.
+.PP
+This tool wait on the standard input for the content of the dump and will write the ntdb in the ntdbfilename parameter\&.
+.PP
+This tool can be used to translate between ntdb and tdb files by dumping and restoring\&.
+.SH "VERSION"
+.PP
+This man page is correct for version 4 of the Samba suite\&.
+.SH "SEE ALSO"
+.PP
+ntdbdump(8), tdbrestore(8)
+.SH "AUTHOR"
+.PP
+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\&.
+.PP
+The ntdbrestore man page was written by Rusty Russell, based on the tdbrestore man page by Matthieu Patou\&.
diff --git a/databases/ntdb/files/ntdbtool.8 b/databases/ntdb/files/ntdbtool.8
new file mode 100644
index 000000000000..351d58e7b5d3
--- /dev/null
+++ b/databases/ntdb/files/ntdbtool.8
@@ -0,0 +1,167 @@
+'\" t
+.\" Title: ntdbtool
+.\" Author: [see the "AUTHOR" section]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 03/12/2014
+.\" Manual: System Administration tools
+.\" Source: Samba 4.1
+.\" Language: English
+.\"
+.TH "NTDBTOOL" "8" "03/12/2014" "Samba 4\&.1" "System Administration tools"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+ntdbtool \- manipulate the contents NTDB files
+.SH "SYNOPSIS"
+.HP \w'\fBntdbtool\fR\ 'u
+\fBntdbtool\fR
+.HP \w'\fBntdbtool\fR\ 'u
+\fBntdbtool\fR \fINTDBFILE\fR [\fICOMMANDS\fR...]
+.SH "DESCRIPTION"
+.PP
+This tool is part of the
+\fBsamba\fR(1)
+suite\&.
+.PP
+\fBntdbtool\fR
+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\&.
+.SH "COMMANDS"
+.PP
+\fBcreate\fR \fINTDBFILE\fR
+.RS 4
+Create a new database named
+\fINTDBFILE\fR\&.
+.RE
+.PP
+\fBopen\fR \fINTDBFILE\fR
+.RS 4
+Open an existing database named
+\fINTDBFILE\fR\&.
+.RE
+.PP
+\fBerase\fR
+.RS 4
+Erase the current database\&.
+.RE
+.PP
+\fBdump\fR
+.RS 4
+Dump the current database as strings\&.
+.RE
+.PP
+\fBcdump\fR
+.RS 4
+Dump the current database as connection records\&.
+.RE
+.PP
+\fBkeys\fR
+.RS 4
+Dump the current database keys as strings\&.
+.RE
+.PP
+\fBhexkeys\fR
+.RS 4
+Dump the current database keys as hex values\&.
+.RE
+.PP
+\fBinfo\fR
+.RS 4
+Print summary information about the current database\&.
+.RE
+.PP
+\fBinsert\fR \fIKEY\fR \fIDATA\fR
+.RS 4
+Insert a record into the current database\&.
+.RE
+.PP
+\fBmove\fR \fIKEY\fR \fINTDBFILE\fR
+.RS 4
+Move a record from the current database into
+\fINTDBFILE\fR\&.
+.RE
+.PP
+\fBstore\fR \fIKEY\fR \fIDATA\fR
+.RS 4
+Store (replace) a record in the current database\&.
+.RE
+.PP
+\fBshow\fR \fIKEY\fR
+.RS 4
+Show a record by key\&.
+.RE
+.PP
+\fBdelete\fR \fIKEY\fR
+.RS 4
+Delete a record by key\&.
+.RE
+.PP
+\fBlist\fR
+.RS 4
+Print the current database hash table and free list\&.
+.RE
+.PP
+\fBfree\fR
+.RS 4
+Print the current database and free list\&.
+.RE
+.PP
+\fB!\fR \fICOMMAND\fR
+.RS 4
+Execute the given system command\&.
+.RE
+.PP
+\fBfirst\fR
+.RS 4
+Print the first record in the current database\&.
+.RE
+.PP
+\fBnext\fR
+.RS 4
+Print the next record in the current database\&.
+.RE
+.PP
+\fBcheck\fR
+.RS 4
+Check the integrity of the current database\&.
+.RE
+.PP
+\fBrepack\fR
+.RS 4
+Repack a database using a temporary file to remove fragmentation\&.
+.RE
+.PP
+\fBquit\fR
+.RS 4
+Exit
+\fBntdbtool\fR\&.
+.RE
+.SH "SEE ALSO"
+.PP
+tdbtool(8)
+.SH "CAVEATS"
+.PP
+The contents of the Samba NTDB files are private to the implementation and should not be altered with
+\fBntdbtool\fR\&.
+.SH "VERSION"
+.PP
+This man page is correct for version 4\&.0 of the Samba suite\&.
+.SH "AUTHOR"
+.PP
+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/databases/ntdb/files/patch-buildtools__wafsamba__samba_install.py b/databases/ntdb/files/patch-buildtools__wafsamba__samba_install.py
new file mode 100644
index 000000000000..61e6a661673c
--- /dev/null
+++ b/databases/ntdb/files/patch-buildtools__wafsamba__samba_install.py
@@ -0,0 +1,11 @@
+--- ./buildtools/wafsamba/samba_install.py.orig 2012-04-11 12:36:11.000000000 +0000
++++ ./buildtools/wafsamba/samba_install.py 2013-01-29 20:54:59.749863922 +0000
+@@ -109,7 +109,7 @@
+ inst_name = bld.make_libname(t.target)
+ elif self.vnum:
+ vnum_base = self.vnum.split('.')[0]
+- install_name = bld.make_libname(target_name, version=self.vnum)
++ install_name = bld.make_libname(target_name, version=vnum_base)
+ install_link = bld.make_libname(target_name, version=vnum_base)
+ inst_name = bld.make_libname(t.target)
+ if not self.private_library:
diff --git a/databases/ntdb/files/patch-wscript b/databases/ntdb/files/patch-wscript
new file mode 100644
index 000000000000..27103d38c7bc
--- /dev/null
+++ b/databases/ntdb/files/patch-wscript
@@ -0,0 +1,11 @@
+--- ./wscript.orig 2013-11-15 21:37:13.000000000 +0000
++++ ./wscript 2014-03-12 12:53:25.482302689 +0000
+@@ -133,7 +133,7 @@
+ bld.RECURSE('lib/ccan')
+
+ if bld.env.standalone_ntdb:
+- bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
++ bld.env.PKGCONFIGDIR = '%%PKGCONFIGDIR%%'
+ private_library = False
+ else:
+ private_library = True
diff --git a/databases/ntdb/pkg-descr b/databases/ntdb/pkg-descr
new file mode 100644
index 000000000000..624574f89d00
--- /dev/null
+++ b/databases/ntdb/pkg-descr
@@ -0,0 +1,6 @@
+TDB is a Trivial Database. In concept, it is very much like GDBM, and
+BSD's DB except that it allows multiple simultaneous writers and uses
+locking internally to keep writers from trampling on each other. TDB is
+also extremely small.
+
+WWW: http://tdb.samba.org/