/*
return the list of subclasses for a class
*/
-const char **ldb_subclass_list(struct ldb_context *ldb, const char *class)
+const char **ldb_subclass_list(struct ldb_context *ldb, const char *classname)
{
int i;
for (i=0;i<ldb->schema.num_classes;i++) {
- if (ldb_attr_cmp(class, ldb->schema.classes[i].name) == 0) {
+ if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) {
return (const char **)ldb->schema.classes[i].subclasses;
}
}
/*
add a new subclass
*/
-static int ldb_subclass_new(struct ldb_context *ldb, const char *class, const char *subclass)
+static int ldb_subclass_new(struct ldb_context *ldb, const char *classname, const char *subclass)
{
struct ldb_subclass *s, *c;
s = talloc_realloc(ldb, ldb->schema.classes, struct ldb_subclass, ldb->schema.num_classes+1);
ldb->schema.classes = s;
c = &s[ldb->schema.num_classes];
- c->name = talloc_strdup(s, class);
+ c->name = talloc_strdup(s, classname);
if (c->name == NULL) goto failed;
c->subclasses = talloc_array(s, char *, 2);
/*
add a subclass
*/
-int ldb_subclass_add(struct ldb_context *ldb, const char *class, const char *subclass)
+int ldb_subclass_add(struct ldb_context *ldb, const char *classname, const char *subclass)
{
int i, n;
struct ldb_subclass *c;
char **s;
for (i=0;i<ldb->schema.num_classes;i++) {
- if (ldb_attr_cmp(class, ldb->schema.classes[i].name) == 0) {
+ if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) {
break;
}
}
if (i == ldb->schema.num_classes) {
- return ldb_subclass_new(ldb, class, subclass);
+ return ldb_subclass_new(ldb, classname, subclass);
}
c = &ldb->schema.classes[i];
/*
remove a set of subclasses for a class
*/
-void ldb_subclass_remove(struct ldb_context *ldb, const char *class)
+void ldb_subclass_remove(struct ldb_context *ldb, const char *classname)
{
int i;
struct ldb_subclass *c;
for (i=0;i<ldb->schema.num_classes;i++) {
- if (ldb_attr_cmp(class, ldb->schema.classes[i].name) == 0) {
+ if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) {
break;
}
}
*/
struct ldb_dn *ldb_dn_copy_partial(void *mem_ctx, const struct ldb_dn *dn, int num_el)
{
- struct ldb_dn *new;
+ struct ldb_dn *newdn;
int i, n, e;
if (dn == NULL) return NULL;
if (num_el <= 0) return NULL;
- new = ldb_dn_new(mem_ctx);
- LDB_DN_NULL_FAILED(new);
+ newdn = ldb_dn_new(mem_ctx);
+ LDB_DN_NULL_FAILED(newdn);
- new->comp_num = num_el;
- n = new->comp_num - 1;
- new->components = talloc_array(new, struct ldb_dn_component, new->comp_num);
+ newdn->comp_num = num_el;
+ n = newdn->comp_num - 1;
+ newdn->components = talloc_array(newdn, struct ldb_dn_component, newdn->comp_num);
- if (dn->comp_num == 0) return new;
+ if (dn->comp_num == 0) return newdn;
e = dn->comp_num - 1;
- for (i = 0; i < new->comp_num; i++) {
- new->components[n - i] = ldb_dn_copy_component(new->components,
+ for (i = 0; i < newdn->comp_num; i++) {
+ newdn->components[n - i] = ldb_dn_copy_component(newdn->components,
&(dn->components[e - i]));
if ((e - i) == 0) {
- return new;
+ return newdn;
}
}
- return new;
+ return newdn;
failed:
- talloc_free(new);
+ talloc_free(newdn);
return NULL;
}
const char * value,
const struct ldb_dn *base)
{
- struct ldb_dn *new;
+ struct ldb_dn *newdn;
if (! ldb_valid_attr_name(attr)) return NULL;
if (value == NULL || value == '\0') return NULL;
if (base != NULL) {
- new = ldb_dn_copy_partial(mem_ctx, base, base->comp_num + 1);
- LDB_DN_NULL_FAILED(new);
+ newdn = ldb_dn_copy_partial(mem_ctx, base, base->comp_num + 1);
+ LDB_DN_NULL_FAILED(newdn);
} else {
- new = ldb_dn_new(mem_ctx);
- LDB_DN_NULL_FAILED(new);
+ newdn = ldb_dn_new(mem_ctx);
+ LDB_DN_NULL_FAILED(newdn);
- new->comp_num = 1;
- new->components = talloc_array(new, struct ldb_dn_component, new->comp_num);
+ newdn->comp_num = 1;
+ newdn->components = talloc_array(newdn, struct ldb_dn_component, newdn->comp_num);
}
- new->components[0].name = talloc_strdup(new->components, attr);
- LDB_DN_NULL_FAILED(new->components[0].name);
+ newdn->components[0].name = talloc_strdup(newdn->components, attr);
+ LDB_DN_NULL_FAILED(newdn->components[0].name);
- new->components[0].value.data = (uint8_t *)talloc_strdup(new->components, value);
- LDB_DN_NULL_FAILED(new->components[0].value.data);
- new->components[0].value.length = strlen((char *)new->components[0].value.data);
+ newdn->components[0].value.data = (uint8_t *)talloc_strdup(newdn->components, value);
+ LDB_DN_NULL_FAILED(newdn->components[0].value.data);
+ newdn->components[0].value.length = strlen((char *)newdn->components[0].value.data);
- return new;
+ return newdn;
failed:
- talloc_free(new);
+ talloc_free(newdn);
return NULL;
}
struct ldb_dn *ldb_dn_compose(void *mem_ctx, const struct ldb_dn *dn1, const struct ldb_dn *dn2)
{
int i;
- struct ldb_dn *new;
+ struct ldb_dn *newdn;
if (dn2 == NULL && dn1 == NULL) {
return NULL;
}
if (dn2 == NULL) {
- new = ldb_dn_new(mem_ctx);
- LDB_DN_NULL_FAILED(new);
+ newdn = ldb_dn_new(mem_ctx);
+ LDB_DN_NULL_FAILED(newdn);
- new->comp_num = dn1->comp_num;
- new->components = talloc_array(new, struct ldb_dn_component, new->comp_num);
+ newdn->comp_num = dn1->comp_num;
+ newdn->components = talloc_array(newdn, struct ldb_dn_component, newdn->comp_num);
} else {
int comp_num = dn2->comp_num;
if (dn1 != NULL) comp_num += dn1->comp_num;
- new = ldb_dn_copy_partial(mem_ctx, dn2, comp_num);
+ newdn = ldb_dn_copy_partial(mem_ctx, dn2, comp_num);
}
if (dn1 == NULL) {
- return new;
+ return newdn;
}
for (i = 0; i < dn1->comp_num; i++) {
- new->components[i] = ldb_dn_copy_component(new->components,
+ newdn->components[i] = ldb_dn_copy_component(newdn->components,
&(dn1->components[i]));
}
- return new;
+ return newdn;
failed:
- talloc_free(new);
+ talloc_free(newdn);
return NULL;
}
const char *attr, const char *syntax);
/* The following definitions come from lib/ldb/common/ldb_attributes.c */
-const char **ldb_subclass_list(struct ldb_context *ldb, const char *class);
-void ldb_subclass_remove(struct ldb_context *ldb, const char *class);
-int ldb_subclass_add(struct ldb_context *ldb, const char *class, const char *subclass);
+const char **ldb_subclass_list(struct ldb_context *ldb, const char *classname);
+void ldb_subclass_remove(struct ldb_context *ldb, const char *classname);
+int ldb_subclass_add(struct ldb_context *ldb, const char *classname, const char *subclass);
int ldb_handler_copy(struct ldb_context *ldb, void *mem_ctx,
const struct ldb_val *in, struct ldb_val *out);
static struct results_store *new_store(struct private_data *priv)
{
- struct results_store *new;
+ struct results_store *newr;
int new_id = priv->next_free_id++;
/* TODO: we should have a limit on the number of
* outstanding paged searches
*/
- new = talloc(priv, struct results_store);
- if (!new) return NULL;
+ newr = talloc(priv, struct results_store);
+ if (!newr) return NULL;
- new->cookie = talloc_asprintf(new, "%d", new_id);
- if (!new->cookie) {
- talloc_free(new);
+ newr->cookie = talloc_asprintf(newr, "%d", new_id);
+ if (!newr->cookie) {
+ talloc_free(newr);
return NULL;
}
- new->timestamp = time(NULL);
+ newr->timestamp = time(NULL);
- new->num_sent = 0; /* To be removed */
- new->result = NULL; /* To be removed */
+ newr->num_sent = 0; /* To be removed */
+ newr->result = NULL; /* To be removed */
- new->first = NULL;
- new->num_entries = 0;
- new->first_ref = NULL;
- new->controls = NULL;
+ newr->first = NULL;
+ newr->num_entries = 0;
+ newr->first_ref = NULL;
+ newr->controls = NULL;
/* put this entry as first */
- new->prev = NULL;
- new->next = priv->store;
- if (priv->store != NULL) priv->store->prev = new;
- priv->store = new;
+ newr->prev = NULL;
+ newr->next = priv->store;
+ if (priv->store != NULL) priv->store->prev = newr;
+ priv->store = newr;
- talloc_set_destructor(new, store_destructor);
+ talloc_set_destructor(newr, store_destructor);
- return new;
+ return newr;
}
struct paged_context {