{
struct ldb_cmdline options, *ret=NULL;
poptContext pc;
- int r, num_options = 0;
- char opt;
+#ifdef _SAMBA_BUILD_
+ int r;
+#endif
+ int num_options = 0;
+ int opt;
struct poptOption popt_options[] = {
POPT_AUTOHELP
{ "url", 'H', POPT_ARG_STRING, &options.url, 0, "database URL", "URL" },
{ "all", 'a', POPT_ARG_NONE, &options.all_records, 0, "dn=*", NULL },
{ "sorted", 'S', POPT_ARG_NONE, &options.sorted, 0, "sort attributes", NULL },
{ "sasl-mechanism", 0, POPT_ARG_STRING, &options.sasl_mechanism, 0, "choose SASL mechanism", "MECHANISM" },
+ { "input", 'I', POPT_ARG_STRING, &options.input, 0, "Input File", "Input" },
+ { "output", 'O', POPT_ARG_STRING, &options.output, 0, "Output File", "Output" },
{ NULL, 'o', POPT_ARG_STRING, NULL, 'o', "ldb_connect option", "OPTION" },
#ifdef _SAMBA_BUILD_
POPT_COMMON_SAMBA
case 'o':
options.options = talloc_realloc(ret, options.options,
- const char *, num_options+2);
+ const char *, num_options+3);
if (options.options == NULL) {
ldb_oom(ldb);
goto failed;
}
- options.options[num_options++] = poptGetOptArg(pc);
+ options.options[num_options] = poptGetOptArg(pc);
options.options[num_options+1] = NULL;
+ num_options++;
break;
default:
goto failed;
}
- if (ldb_connect(ldb, ret->url, 0, ret->options) != 0) {
- fprintf(stderr, "Failed to connect to %s - %s\n",
- ret->url, ldb_errstring(ldb));
- goto failed;
+ if (strcmp(ret->url, "NONE") != 0) {
+ if (ldb_connect(ldb, ret->url, 0, ret->options) != 0) {
+ fprintf(stderr, "Failed to connect to %s - %s\n",
+ ret->url, ldb_errstring(ldb));
+ goto failed;
+ }
}
return ret;