summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-01 18:45:25 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-01 18:55:20 +1100
commit6f2c4abadd6097d949b388cc4d9c4ebd77f0df10 (patch)
tree591f61a1a94fb7070065351a4f90987ea2d3e45d /source4/lib
parentf924a022cbc973ae646bff5119a1784e979a052f (diff)
downloadsamba-6f2c4abadd6097d949b388cc4d9c4ebd77f0df10.tar.gz
samba-6f2c4abadd6097d949b388cc4d9c4ebd77f0df10.tar.bz2
samba-6f2c4abadd6097d949b388cc4d9c4ebd77f0df10.zip
s4-ldb: convert existing ldb tools to use new command line hooks
the usage() function needs to take a ldb context, as the popt_options is specific to the ldb context Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/tools/ldbadd.c4
-rw-r--r--source4/lib/ldb/tools/ldbdel.c6
-rw-r--r--source4/lib/ldb/tools/ldbedit.c11
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c4
-rw-r--r--source4/lib/ldb/tools/ldbrename.c6
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c10
-rw-r--r--source4/lib/ldb/tools/ldbtest.c5
-rw-r--r--source4/lib/ldb/wscript59
8 files changed, 29 insertions, 76 deletions
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c
index 42470656fb..ab456f3d33 100644
--- a/source4/lib/ldb/tools/ldbadd.c
+++ b/source4/lib/ldb/tools/ldbadd.c
@@ -38,11 +38,11 @@
static unsigned int failures;
static struct ldb_cmdline *options;
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbadd <options> <ldif...>\n");
printf("Adds records to a ldb, reading ldif the specified list of files\n\n");
- ldb_cmdline_help("ldbadd", stdout);
+ ldb_cmdline_help(ldb, "ldbadd", stdout);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c
index 6994b3ddb6..6f7c8ae4a3 100644
--- a/source4/lib/ldb/tools/ldbdel.c
+++ b/source4/lib/ldb/tools/ldbdel.c
@@ -73,11 +73,11 @@ static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struc
return 0;
}
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbdel <options> <DN...>\n");
printf("Deletes records from a ldb\n\n");
- ldb_cmdline_help("ldbdel", stdout);
+ ldb_cmdline_help(ldb, "ldbdel", stdout);
exit(1);
}
@@ -94,7 +94,7 @@ int main(int argc, const char **argv)
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc < 1) {
- usage();
+ usage(ldb);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 4deeb30ee9..b311073b05 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -31,13 +31,8 @@
* Author: Andrew Tridgell
*/
-#ifdef _SAMBA_BUILD_
-#include "includes.h"
-#include <system/filesys.h>
-#else
#include "ldb_includes.h"
-#endif
-
+#include "system/filesys.h"
#include "ldb.h"
#include "tools/cmdline.h"
#include "tools/ldbutil.h"
@@ -287,10 +282,10 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1,
return merge_edits(ldb, msgs1, count1, msgs2, count2);
}
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbedit <options> <expression> <attributes ...>\n");
- ldb_cmdline_help("ldbedit", stdout);
+ ldb_cmdline_help(ldb, "ldbedit", stdout);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index ecbdadfd65..d5252dc206 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -38,11 +38,11 @@
static int failures;
static struct ldb_cmdline *options;
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbmodify <options> <ldif...>\n");
printf("Modifies a ldb based upon ldif change records\n\n");
- ldb_cmdline_help("ldbmodify", stdout);
+ ldb_cmdline_help(ldb, "ldbmodify", stdout);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c
index e0f258ce85..7473a77fda 100644
--- a/source4/lib/ldb/tools/ldbrename.c
+++ b/source4/lib/ldb/tools/ldbrename.c
@@ -36,11 +36,11 @@
#include "ldb.h"
#include "tools/cmdline.h"
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbrename [<options>] <olddn> <newdn>\n");
printf("Renames records in a ldb\n\n");
- ldb_cmdline_help("ldbmodify", stdout);
+ ldb_cmdline_help(ldb, "ldbmodify", stdout);
exit(1);
}
@@ -58,7 +58,7 @@ int main(int argc, const char **argv)
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc < 2) {
- usage();
+ usage(ldb);
}
dn1 = ldb_dn_new(ldb, ldb, options->argv[0]);
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index 55144a7a8c..458d7115ed 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -31,20 +31,14 @@
* Author: Andrew Tridgell
*/
-#ifdef _SAMBA_BUILD_
-#include "includes.h"
-#include <ldb.h>
-#else
#include "ldb_includes.h"
#include "ldb.h"
-#endif
-
#include "tools/cmdline.h"
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbsearch <options> <expression> <attrs...>\n");
- ldb_cmdline_help("ldbsearch", stdout);
+ ldb_cmdline_help(ldb, "ldbsearch", stdout);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index 94dd2c696d..c8d35732f8 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -31,12 +31,7 @@
* Author: Andrew Tridgell
*/
-#ifdef _SAMBA_BUILD_
-#include "includes.h"
-#else
#include "ldb_includes.h"
-#endif
-
#include "ldb.h"
#include "tools/cmdline.h"
diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript
index ebd653c9af..3204ba8e32 100644
--- a/source4/lib/ldb/wscript
+++ b/source4/lib/ldb/wscript
@@ -37,8 +37,6 @@ def configure(conf):
#
conf.CONFIG_PATH('LDB_MODULESDIR', conf.SUBST_ENV_VAR('MODULESDIR') + '/ldb')
- s4_build = getattr(conf.env, '_SAMBA_BUILD_', 0) == 4
-
conf.env.standalone_ldb = conf.IN_LAUNCH_DIR()
if not conf.env.standalone_ldb:
@@ -72,10 +70,6 @@ def build(bld):
bld.RECURSE('lib/popt')
bld.RECURSE('lib/replace')
- # in Samba4 we build some extra modules, and add extra
- # capabilities to the ldb cmdline tools
- s4_build = getattr(bld.env, '_SAMBA_BUILD_', 0) == 4
-
LDB_MAP_SRC = bld.SUBDIR('ldb_map',
'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
@@ -84,23 +78,13 @@ def build(bld):
ldb_debug.c ldb_dn.c ldb_match.c ldb_options.c
ldb_attributes.c attrib_handlers.c ldb_controls.c qsort.c''')
- if s4_build:
- # this is only in the s4 build
- bld.SAMBA_MODULE('ldb_ildap', 'ldb_ildap/ldb_ildap.c',
- init_function='ldb_ildap_init',
- module_init_name='ldb_init_module',
- deps='talloc cli-ldap CREDENTIALS auth_system_session',
- internal_module=False,
- subsystem='ldb')
- else:
- # this is not included in the s4 build
- bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
- init_function='ldb_ldap_init',
- module_init_name='ldb_init_module',
- deps='talloc lber ldap ldb',
- enabled=bld.env.ENABLE_LDAP_BACKEND,
- internal_module=True,
- subsystem='ldb')
+ bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
+ init_function='ldb_ldap_init',
+ module_init_name='ldb_init_module',
+ deps='talloc lber ldap ldb',
+ enabled=bld.env.ENABLE_LDAP_BACKEND,
+ internal_module=False,
+ subsystem='ldb')
# we're not currently linking against the ldap libs, but ldb.pc.in
# has @LDAP_LIBS@
@@ -127,17 +111,8 @@ def build(bld):
# the current modules, not the installed ones
modules_dir = os.path.join(os.getcwd(), 'bin/modules/ldb')
- if bld.env.standalone_ldb:
- # do ABI checking on the standalone ldb
- abi_file = 'ABI/ldb-%s.sigs' % VERSION
- abi_match = '!ldb_*module_ops !ldb_*backend_ops ldb_*'
- private_library = False
- vnum = VERSION
- else:
- abi_file = None
- abi_match = None
- private_library = True
- vnum = None
+ abi_file = 'ABI/ldb-%s.sigs' % VERSION
+ abi_match = '!ldb_*module_ops !ldb_*backend_ops ldb_*'
bld.SAMBA_LIBRARY('ldb',
COMMON_SRC + ' ' + LDB_MAP_SRC,
@@ -146,10 +121,11 @@ def build(bld):
public_headers='include/ldb.h include/ldb_errors.h '\
'include/ldb_module.h include/ldb_handlers.h',
pc_files='ldb.pc',
- vnum=vnum, manpages='man/ldb.3',
+ vnum=VERSION,
+ manpages='man/ldb.3',
abi_file = abi_file,
- abi_match = abi_match,
- private_library=private_library)
+ abi_match = abi_match)
+
bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
deps='ldb pyldb-util',
@@ -181,7 +157,6 @@ def build(bld):
'modules/paged_searches.c',
init_function='ldb_paged_searches_init',
module_init_name='ldb_init_module',
- enabled = s4_build,
deps='ldb',
subsystem='ldb')
@@ -231,15 +206,9 @@ def build(bld):
includes='include',
cflags='-DLDB_MODULESDIR=\"%s\" -DLDB_VERSION=\"%s\"' % (modules_dir, VERSION))
- if s4_build:
- extra_cmdline_deps = ' LDBSAMBA POPT_SAMBA POPT_CREDENTIALS ' \
- 'cmdline-credentials gensec'
- else:
- extra_cmdline_deps = ''
-
bld.SAMBA_LIBRARY('ldb-cmdline',
source='tools/ldbutil.c tools/cmdline.c',
- deps='ldb dl popt' + extra_cmdline_deps,
+ deps='ldb dl popt',
private_library=True)
LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'