1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ldb/tools: only use LDB_FLG_SHOW_BINARY for 'ldbsearch'

--show-binary is only useful for ldbseach in all other cases
it will destroy data.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Feb 24 03:59:01 CET 2017 on sn-devel-144
This commit is contained in:
Stefan Metzmacher 2017-01-19 04:29:13 +01:00 committed by Andrew Bartlett
parent fcf5e5a9b8
commit a2daa664cc
3 changed files with 30 additions and 5 deletions

View File

@ -93,9 +93,10 @@ static bool add_control(TALLOC_CTX *mem_ctx, const char *control)
/**
process command line options
*/
struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb,
static struct ldb_cmdline *ldb_cmdline_process_internal(struct ldb_context *ldb,
int argc, const char **argv,
void (*usage)(struct ldb_context *))
void (*usage)(struct ldb_context *),
bool search)
{
struct ldb_cmdline *ret=NULL;
poptContext pc;
@ -278,8 +279,15 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb,
flags |= LDB_FLG_NOSYNC;
}
if (options.show_binary) {
flags |= LDB_FLG_SHOW_BINARY;
if (search) {
/*
* For now we're not adding LDB_FLG_RDONLY,
* as that would result in no tdb locking.
*/
if (options.show_binary) {
flags |= LDB_FLG_SHOW_BINARY;
}
}
if (options.tracing) {
@ -317,6 +325,20 @@ failed:
return NULL;
}
struct ldb_cmdline *ldb_cmdline_process_search(struct ldb_context *ldb,
int argc, const char **argv,
void (*usage)(struct ldb_context *))
{
return ldb_cmdline_process_internal(ldb, argc, argv, usage, true);
}
struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb,
int argc, const char **argv,
void (*usage)(struct ldb_context *))
{
return ldb_cmdline_process_internal(ldb, argc, argv, usage, false);
}
/* this function check controls reply and determines if more
* processing is needed setting up the request controls correctly
*

View File

@ -46,6 +46,9 @@ struct ldb_cmdline {
int tracing;
};
struct ldb_cmdline *ldb_cmdline_process_search(struct ldb_context *ldb,
int argc, const char **argv,
void (*usage)(struct ldb_context *));
struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc,
const char **argv,
void (*usage)(struct ldb_context *));

View File

@ -300,7 +300,7 @@ int main(int argc, const char **argv)
return LDB_ERR_OPERATIONS_ERROR;
}
options = ldb_cmdline_process(ldb, argc, argv, usage);
options = ldb_cmdline_process_search(ldb, argc, argv, usage);
/* the check for '=' is for compatibility with ldapsearch */
if (!options->interactive &&