This library 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 2 of the License, or (at your option) any later version.
+ version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
/*
* Author: Andrew Tridgell
*/
-#include "includes.h"
-#include "ldb/include/includes.h"
-#include "ldb/tools/cmdline.h"
+#include "ldb_includes.h"
+#include "tools/cmdline.h"
static struct ldb_cmdline *options;
if (ldb_modify(ldb, mod) != 0) {
fprintf(stderr, "failed to modify %s - %s\n",
- ldb_dn_linearize(ldb, msg1->dn), ldb_errstring(ldb));
+ ldb_dn_get_linearized(msg1->dn), ldb_errstring(ldb));
return -1;
}
int ret = 0;
int adds=0, modifies=0, deletes=0;
+ if (ldb_transaction_start(ldb) != 0) {
+ fprintf(stderr, "Failed to start transaction: %s\n", ldb_errstring(ldb));
+ return -1;
+ }
+
/* do the adds and modifies */
for (i=0;i<count2;i++) {
msg = msg_find(ldb, msgs1, count1, msgs2[i]->dn);
}
if (ldb_add(ldb, msgs2[i]) != 0) {
fprintf(stderr, "failed to add %s - %s\n",
- ldb_dn_linearize(ldb, msgs2[i]->dn),
+ ldb_dn_get_linearized(msgs2[i]->dn),
ldb_errstring(ldb));
return -1;
}
}
if (ldb_delete(ldb, msgs1[i]->dn) != 0) {
fprintf(stderr, "failed to delete %s - %s\n",
- ldb_dn_linearize(ldb, msgs1[i]->dn),
+ ldb_dn_get_linearized(msgs1[i]->dn),
ldb_errstring(ldb));
return -1;
}
}
}
+ if (ldb_transaction_commit(ldb) != 0) {
+ fprintf(stderr, "Failed to commit transaction: %s\n", ldb_errstring(ldb));
+ return -1;
+ }
+
printf("# %d adds %d modifies %d deletes\n", adds, modifies, deletes);
return ret;
const char *expression = "(|(objectClass=*)(distinguishedName=*))";
const char * const * attrs = NULL;
- ldb_global_init();
-
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
}
}
- ret = ldb_search(ldb, basedn, options->scope, expression, attrs, &result);
+ ret = ldb_search(ldb, ldb, &result, basedn, options->scope, attrs, "%s", expression);
if (ret != LDB_SUCCESS) {
printf("search failed - %s\n", ldb_errstring(ldb));
exit(1);