mirror of
https://github.com/samba-team/samba.git
synced 2024-12-28 07:21:54 +03:00
parent
fb5d4f9c86
commit
847644bdac
@ -296,7 +296,7 @@ static int ldb_comparison_objectclass(struct ldb_context *ldb, void *mem_ctx,
|
||||
}
|
||||
for (i=0;subclasses[i];i++) {
|
||||
struct ldb_val vs;
|
||||
vs.data = discard_const(subclasses[i]);
|
||||
vs.data = (uint8 *)discard_const(subclasses[i]);
|
||||
vs.length = strlen(subclasses[i]);
|
||||
if (ldb_comparison_objectclass(ldb, mem_ctx, &vs, v2) == 0) {
|
||||
return 0;
|
||||
|
@ -154,7 +154,8 @@ static LDAPMod **lldb_msg_to_mods(void *mem_ctx, const struct ldb_message *msg,
|
||||
if (!mods[num_mods]->mod_vals.modv_bvals[j]) {
|
||||
goto failed;
|
||||
}
|
||||
mods[num_mods]->mod_vals.modv_bvals[j]->bv_val = el->values[j].data;
|
||||
mods[num_mods]->mod_vals.modv_bvals[j]->bv_val =
|
||||
(char *)el->values[j].data;
|
||||
mods[num_mods]->mod_vals.modv_bvals[j]->bv_len = el->values[j].length;
|
||||
}
|
||||
mods[num_mods]->mod_vals.modv_bvals[j] = NULL;
|
||||
@ -212,7 +213,8 @@ static int lldb_add_msg_attr(struct ldb_context *ldb,
|
||||
for (i=0;i<count;i++) {
|
||||
/* we have to ensure this is null terminated so that
|
||||
ldb_msg_find_attr_as_string() can work */
|
||||
el->values[i].data = talloc_size(el->values, bval[i]->bv_len+1);
|
||||
el->values[i].data =
|
||||
(uint8_t *)talloc_size(el->values, bval[i]->bv_len+1);
|
||||
if (!el->values[i].data) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
@ -270,7 +272,9 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req)
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
|
||||
expression = ldb_filter_from_tree(lldb_ac, req->op.search.tree);
|
||||
expression = ldb_filter_from_tree(
|
||||
lldb_ac,
|
||||
CONST_DISCARD(struct ldb_parse_tree *, req->op.search.tree));
|
||||
if (expression == NULL) {
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
|
@ -60,7 +60,8 @@ static const struct {
|
||||
*/
|
||||
static void ltdb_attributes_unload(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
struct ldb_message *msg;
|
||||
int i;
|
||||
|
||||
@ -107,7 +108,8 @@ static int ltdb_attributes_flags(struct ldb_message_element *el, unsigned *v)
|
||||
*/
|
||||
static int ltdb_attributes_load(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
struct ldb_message *msg = ltdb->cache->attributes;
|
||||
struct ldb_dn *dn;
|
||||
int i;
|
||||
@ -175,7 +177,8 @@ failed:
|
||||
*/
|
||||
static int ltdb_subclasses_load(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
struct ldb_message *msg = ltdb->cache->subclasses;
|
||||
struct ldb_dn *dn;
|
||||
int i, j;
|
||||
@ -210,7 +213,8 @@ failed:
|
||||
*/
|
||||
static void ltdb_subclasses_unload(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
struct ldb_message *msg;
|
||||
int i;
|
||||
|
||||
@ -234,7 +238,8 @@ static void ltdb_subclasses_unload(struct ldb_module *module)
|
||||
*/
|
||||
static int ltdb_baseinfo_init(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
struct ldb_message *msg;
|
||||
struct ldb_message_element el;
|
||||
struct ldb_val val;
|
||||
@ -287,7 +292,8 @@ failed:
|
||||
*/
|
||||
static void ltdb_cache_free(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
|
||||
ltdb->sequence_number = 0;
|
||||
talloc_free(ltdb->cache);
|
||||
@ -310,11 +316,12 @@ int ltdb_cache_reload(struct ldb_module *module)
|
||||
*/
|
||||
int ltdb_cache_load(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
struct ldb_dn *baseinfo_dn = NULL;
|
||||
struct ldb_dn *indexlist_dn = NULL;
|
||||
uint64_t seq;
|
||||
struct ldb_message *baseinfo;
|
||||
struct ldb_message *baseinfo = NULL;
|
||||
|
||||
/* a very fast check to avoid extra database reads */
|
||||
if (ltdb->cache != NULL &&
|
||||
@ -416,7 +423,8 @@ failed:
|
||||
*/
|
||||
int ltdb_increase_sequence_number(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
struct ldb_message *msg;
|
||||
struct ldb_message_element el[2];
|
||||
struct ldb_val val;
|
||||
@ -493,7 +501,8 @@ int ltdb_increase_sequence_number(struct ldb_module *module)
|
||||
*/
|
||||
int ltdb_attribute_flags(struct ldb_module *module, const char *attr_name)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
const struct ldb_message_element *attr_el;
|
||||
int i, j, ret=0;
|
||||
|
||||
|
@ -114,7 +114,7 @@ int ltdb_pack_data(struct ldb_module *module,
|
||||
}
|
||||
|
||||
/* allocate it */
|
||||
data->dptr = talloc_array(ldb, uint8_t, size);
|
||||
data->dptr = talloc_array(ldb, char, size);
|
||||
if (!data->dptr) {
|
||||
talloc_free(dn);
|
||||
errno = ENOMEM;
|
||||
@ -122,7 +122,7 @@ int ltdb_pack_data(struct ldb_module *module,
|
||||
}
|
||||
data->dsize = size;
|
||||
|
||||
p = data->dptr;
|
||||
p = (uint8_t *)data->dptr;
|
||||
put_uint32(p, 0, LTDB_PACKING_FORMAT);
|
||||
put_uint32(p, 4, real_elements);
|
||||
p += 8;
|
||||
@ -173,7 +173,7 @@ int ltdb_unpack_data(struct ldb_module *module,
|
||||
|
||||
message->elements = NULL;
|
||||
|
||||
p = data->dptr;
|
||||
p = (uint8_t *)data->dptr;
|
||||
if (data->dsize < 8) {
|
||||
errno = EIO;
|
||||
goto failed;
|
||||
@ -268,7 +268,7 @@ int ltdb_unpack_data(struct ldb_module *module,
|
||||
}
|
||||
|
||||
message->elements[i].values[j].length = len;
|
||||
message->elements[i].values[j].data = talloc_size(message->elements[i].values, len+1);
|
||||
message->elements[i].values[j].data = (uint8_t *)talloc_size(message->elements[i].values, len+1);
|
||||
if (message->elements[i].values[j].data == NULL) {
|
||||
errno = ENOMEM;
|
||||
goto failed;
|
||||
|
@ -211,7 +211,8 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module,
|
||||
*/
|
||||
int ltdb_search_dn1(struct ldb_module *module, const struct ldb_dn *dn, struct ldb_message *msg)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
int ret;
|
||||
TDB_DATA tdb_key, tdb_data;
|
||||
|
||||
@ -253,7 +254,8 @@ int ltdb_search_dn1(struct ldb_module *module, const struct ldb_dn *dn, struct l
|
||||
*/
|
||||
static int ltdb_lock_read(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
return tdb_lockall_read(ltdb->tdb);
|
||||
}
|
||||
|
||||
@ -262,7 +264,8 @@ static int ltdb_lock_read(struct ldb_module *module)
|
||||
*/
|
||||
static int ltdb_unlock_read(struct ldb_module *module)
|
||||
{
|
||||
struct ltdb_private *ltdb = module->private_data;
|
||||
struct ltdb_private *ltdb =
|
||||
(struct ltdb_private *)module->private_data;
|
||||
return tdb_unlockall_read(ltdb->tdb);
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
key.dptr = (uint8_t *)key_str;
|
||||
key.dptr = (char *)key_str;
|
||||
key.dsize = strlen(key_str) + 1;
|
||||
|
||||
return key;
|
||||
|
@ -59,8 +59,8 @@ static int ltdb_wrap_destructor(struct ltdb_wrap *w)
|
||||
}
|
||||
|
||||
#if defined(_SAMBA_BUILD_) && (_SAMBA_BUILD_ <= 3)
|
||||
static void ltdb_log_fn(struct tdb_context *tdb, int level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
|
||||
static void ltdb_log_fn(struct tdb_context *tdb, int level, const char *fmt, ...)
|
||||
static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
|
||||
static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...)
|
||||
{
|
||||
/* until we merge the tdb debug changes into samba3, we don't know
|
||||
how serious the error is, and we can't go via the ldb loggin code */
|
||||
@ -147,7 +147,9 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode, log_ctx_p, NULL);
|
||||
w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode,
|
||||
(const struct tdb_logging_context *)log_ctx_p,
|
||||
NULL);
|
||||
if (w->tdb == NULL) {
|
||||
talloc_free(w);
|
||||
return NULL;
|
||||
|
@ -244,7 +244,7 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req
|
||||
searchable, but are stored using a different name in the
|
||||
backend */
|
||||
for (i=0;i<ARRAY_SIZE(parse_tree_sub);i++) {
|
||||
ldb_parse_tree_attr_replace(req->op.search.tree,
|
||||
ldb_parse_tree_attr_replace(CONST_DISCARD(struct ldb_parse_tree *,req->op.search.tree),
|
||||
parse_tree_sub[i].attr,
|
||||
parse_tree_sub[i].replace);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user