In most cases we do count LDB objects which are enumerated within the "unsigned"
type. Therefore no need to use "signed" counters.
*/
int handle_controls_reply(struct ldb_control **reply, struct ldb_control **request)
{
*/
int handle_controls_reply(struct ldb_control **reply, struct ldb_control **request)
{
- int i, j;
- int ret = 0;
+ unsigned int i, j;
+ int ret = 0;
if (reply == NULL || request == NULL) return -1;
if (reply == NULL || request == NULL) return -1;
#include "tools/cmdline.h"
#include "ldbutil.h"
#include "tools/cmdline.h"
#include "ldbutil.h"
+static unsigned int failures;
static struct ldb_cmdline *options;
static void usage(void)
static struct ldb_cmdline *options;
static void usage(void)
/*
add records from an opened file
*/
/*
add records from an opened file
*/
-static int process_file(struct ldb_context *ldb, FILE *f, int *count)
+static int process_file(struct ldb_context *ldb, FILE *f, unsigned int *count)
{
struct ldb_ldif *ldif;
int ret = LDB_SUCCESS;
{
struct ldb_ldif *ldif;
int ret = LDB_SUCCESS;
int main(int argc, const char **argv)
{
struct ldb_context *ldb;
int main(int argc, const char **argv)
{
struct ldb_context *ldb;
+ unsigned int i, count = 0;
+ int ret=0;
ldb = ldb_init(NULL, NULL);
ldb = ldb_init(NULL, NULL);
static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struct ldb_control **req_ctrls)
{
static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struct ldb_control **req_ctrls)
{
+ int ret;
+ unsigned int i, total=0;
const char *attrs[] = { NULL };
struct ldb_result *res;
const char *attrs[] = { NULL };
struct ldb_result *res;
*/
static struct ldb_message *msg_find(struct ldb_context *ldb,
struct ldb_message **msgs,
*/
static struct ldb_message *msg_find(struct ldb_context *ldb,
struct ldb_message **msgs,
for (i=0;i<count;i++) {
if (ldb_dn_compare(dn, msgs[i]->dn) == 0) {
return msgs[i];
for (i=0;i<count;i++) {
if (ldb_dn_compare(dn, msgs[i]->dn) == 0) {
return msgs[i];
merge the changes in msgs2 into the messages from msgs1
*/
static int merge_edits(struct ldb_context *ldb,
merge the changes in msgs2 into the messages from msgs1
*/
static int merge_edits(struct ldb_context *ldb,
- struct ldb_message **msgs1, int count1,
- struct ldb_message **msgs2, int count2)
+ struct ldb_message **msgs1, unsigned int count1,
+ struct ldb_message **msgs2, unsigned int count2)
struct ldb_message *msg;
int ret = 0;
int adds=0, modifies=0, deletes=0;
struct ldb_message *msg;
int ret = 0;
int adds=0, modifies=0, deletes=0;
save a set of messages as ldif to a file
*/
static int save_ldif(struct ldb_context *ldb,
save a set of messages as ldif to a file
*/
static int save_ldif(struct ldb_context *ldb,
- FILE *f, struct ldb_message **msgs, int count)
+ FILE *f, struct ldb_message **msgs, unsigned int count)
fprintf(f, "# editing %d records\n", count);
fprintf(f, "# editing %d records\n", count);
/*
edit the ldb search results in msgs using the user selected editor
*/
/*
edit the ldb search results in msgs using the user selected editor
*/
-static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int count1,
- const char *editor)
+static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1,
+ unsigned int count1, const char *editor)
char *cmd;
struct ldb_ldif *ldif;
struct ldb_message **msgs2 = NULL;
char *cmd;
struct ldb_ldif *ldif;
struct ldb_message **msgs2 = NULL;
+ unsigned int count2 = 0;
/* write out the original set of messages to a temporary
file */
/* write out the original set of messages to a temporary
file */
struct ldb_control **req_ctrls;
int sort;
struct ldb_control **req_ctrls;
int sort;
+ unsigned int num_stored;
struct ldb_message **store;
struct ldb_message **store;
+ unsigned int refs_stored;
- int entries;
- int refs;
+ unsigned int entries;
+ unsigned int refs;
goto again;
if (sctx->sort && (sctx->num_stored != 0 || sctx->refs != 0)) {
goto again;
if (sctx->sort && (sctx->num_stored != 0 || sctx->refs != 0)) {
if (sctx->num_stored) {
LDB_TYPESAFE_QSORT(sctx->store, sctx->num_stored, ldb, do_compare_msg);
if (sctx->num_stored) {
LDB_TYPESAFE_QSORT(sctx->store, sctx->num_stored, ldb, do_compare_msg);
static void add_records(struct ldb_context *ldb,
struct ldb_dn *basedn,
static void add_records(struct ldb_context *ldb,
struct ldb_dn *basedn,
{
struct ldb_message msg;
{
struct ldb_message msg;
#if 0
if (ldb_lock(ldb, "transaction") != 0) {
#if 0
if (ldb_lock(ldb, "transaction") != 0) {
static void modify_records(struct ldb_context *ldb,
struct ldb_dn *basedn,
static void modify_records(struct ldb_context *ldb,
struct ldb_dn *basedn,
{
struct ldb_message msg;
{
struct ldb_message msg;
for (i=0;i<count;i++) {
struct ldb_message_element el[3];
for (i=0;i<count;i++) {
struct ldb_message_element el[3];
static void delete_records(struct ldb_context *ldb,
struct ldb_dn *basedn,
static void delete_records(struct ldb_context *ldb,
struct ldb_dn *basedn,
for (i=0;i<count;i++) {
struct ldb_dn *dn;
for (i=0;i<count;i++) {
struct ldb_dn *dn;
-static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nrecords, int nsearches)
+static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn,
+ unsigned int nrecords, unsigned int nsearches)
for (i=0;i<nsearches;i++) {
int uid = (i * 700 + 17) % (nrecords * 2);
for (i=0;i<nsearches;i++) {
int uid = (i * 700 + 17) % (nrecords * 2);
-static void start_test(struct ldb_context *ldb, int nrecords, int nsearches)
+static void start_test(struct ldb_context *ldb, unsigned int nrecords,
+ unsigned int nsearches)
printf("Testing with num-records=%d and num-searches=%d\n",
options->num_records, options->num_searches);
printf("Testing with num-records=%d and num-searches=%d\n",
options->num_records, options->num_searches);
- start_test(ldb, options->num_records, options->num_searches);
+ start_test(ldb,
+ (unsigned int) options->num_records,
+ (unsigned int) options->num_searches);