Commit c978bd67 authored by Jelmer Vernooij's avatar Jelmer Vernooij

Merge tag 'upstream/1.1.24'

Upstream version 1.1.24

# gpg: Signature made Wed 16 Dec 2015 01:08:23 GMT using RSA key ID 04D1E9F8
# gpg: Good signature from "Jelmer Vernooij <jelmer@jelmer.uk>" [ultimate]
# gpg:                 aka "Jelmer Vernooij <jelmer@samba.org>" [ultimate]
# gpg:                 aka "Jelmer Vernooij <jelmer@apache.org>" [ultimate]
# gpg:                 aka "Jelmer Vernooij <jelmer@debian.org>" [ultimate]
# gpg:                 aka "Jelmer Vernooij <jelmer@ubuntu.com>" [ultimate]
# gpg:                 aka "Jelmer Vernooij <jelmer@vernstok.nl>" [ultimate]
# gpg:                 aka "Jelmer Vernooij <jelmer@jelmer.co.uk>" [ultimate]
# gpg:                 aka "Jelmer Vernooij <jelmer@openchange.org>" [ultimate]
# gpg:                 aka "Jelmer Vernooij <jrvernooij@tigris.org>" [ultimate]
parents 2a28aeb7 4a1aed9d
This diff is collapsed.
pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
......@@ -225,7 +225,7 @@ def abi_build_vscript(task):
def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None):
'''generate a vscript file for our public libraries'''
if abi_directory:
source = bld.path.ant_glob('%s/%s-[0-9]*.sigs' % (abi_directory, libname))
source = bld.path.ant_glob('%s/%s-[0-9]*.sigs' % (abi_directory, libname), flat=True)
def abi_file_key(path):
return version_key(path[:-len(".sigs")].rsplit("-")[-1])
source = sorted(source.split(), key=abi_file_key)
......
......@@ -4,7 +4,7 @@ import os, sys
import Build, Options, preproc, Logs
from Configure import conf
from TaskGen import feature
from samba_utils import TO_LIST, GET_TARGET_TYPE, SET_TARGET_TYPE, runonce, unique_list, mkdir_p
from samba_utils import TO_LIST, GET_TARGET_TYPE, SET_TARGET_TYPE, unique_list, mkdir_p
missing_headers = set()
......@@ -13,7 +13,6 @@ missing_headers = set()
# to waf a bit easier for those used to autoconf
# m4 files
@runonce
@conf
def DEFINE(conf, d, v, add_to_cflags=False, quote=False):
'''define a config option'''
......@@ -101,6 +100,7 @@ def CHECK_HEADER(conf, h, add_headers=False, lib=None):
type='nolink',
execute=0,
ccflags=ccflags,
mandatory=False,
includes=cpppath,
uselib=lib.upper(),
msg="Checking for header %s" % h)
......@@ -486,6 +486,7 @@ def CHECK_LDFLAGS(conf, ldflags):
return conf.check(fragment='int main(void) { return 0; }\n',
execute=0,
ldflags=ldflags,
mandatory=False,
msg="Checking linker accepts %s" % ldflags)
......@@ -569,9 +570,9 @@ int foo()
(ccflags, ldflags, cpppath) = library_flags(conf, lib)
if shlib:
res = conf.check(features='c cshlib', fragment=fragment, lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper())
res = conf.check(features='c cshlib', fragment=fragment, lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
else:
res = conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper())
res = conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
if not res:
if mandatory:
......@@ -671,6 +672,7 @@ def SAMBA_CONFIG_H(conf, path=None):
execute=0,
ccflags='-fstack-protector',
ldflags='-fstack-protector',
mandatory=False,
msg='Checking if toolchain accepts -fstack-protector'):
conf.ADD_CFLAGS('-fstack-protector')
conf.ADD_LDFLAGS('-fstack-protector')
......
......@@ -3,7 +3,7 @@
import sys
import Build, Options, Logs
from Configure import conf
from samba_utils import TO_LIST, runonce
from samba_utils import TO_LIST
def PRIVATE_NAME(bld, name, private_extension, private_library):
'''possibly rename a library to include a bundled extension'''
......@@ -108,7 +108,6 @@ def LIB_MUST_BE_PRIVATE(conf, libname):
return ('ALL' in conf.env.PRIVATE_LIBS or
libname in conf.env.PRIVATE_LIBS)
@runonce
@conf
def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0',
onlyif=None, implied_deps=None, pkg=None):
......@@ -122,7 +121,6 @@ def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0',
implied_deps=implied_deps,
pkg=pkg)
@runonce
@conf
def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
checkfunctions=None, headers=None, checkcode=None,
......@@ -219,7 +217,6 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
def tuplize_version(version):
return tuple([int(x) for x in version.split(".")])
@runonce
@conf
def CHECK_BUNDLED_SYSTEM_PYTHON(conf, libname, modulename, minversion='0.0.0'):
'''check if a python module is available on the system and
......
......@@ -196,7 +196,7 @@ int foo(int v) {
return v * 2;
}
'''
return conf.check(features='c cshlib',vnum="1",fragment=snip,msg=msg)
return conf.check(features='c cshlib',vnum="1",fragment=snip,msg=msg, mandatory=False)
@conf
def CHECK_NEED_LC(conf, msg):
......@@ -258,7 +258,7 @@ int foo(int v) {
ldb_module = PyImport_ImportModule("ldb");
return v * 2;
}'''
return conf.check(features='c cshlib',uselib='PYEMBED',fragment=snip,msg=msg)
return conf.check(features='c cshlib',uselib='PYEMBED',fragment=snip,msg=msg, mandatory=False)
# this one is quite complex, and should probably be broken up
# into several parts. I'd quite like to create a set of CHECK_COMPOUND()
......
......@@ -260,15 +260,10 @@ def add_init_functions(self):
def check_duplicate_sources(bld, tgt_list):
'''see if we are compiling the same source file more than once
without an allow_duplicates attribute'''
'''see if we are compiling the same source file more than once'''
debug('deps: checking for duplicate sources')
targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
ret = True
global tstart
for t in tgt_list:
source_list = TO_LIST(getattr(t, 'source', ''))
......@@ -286,7 +281,6 @@ def check_duplicate_sources(bld, tgt_list):
# build a list of targets that each source file is part of
for t in tgt_list:
sources = []
if not targets[t.sname] in [ 'LIBRARY', 'BINARY', 'PYTHON' ]:
continue
for obj in t.add_objects:
......@@ -306,24 +300,7 @@ def check_duplicate_sources(bld, tgt_list):
if len(subsystems[s][tname]) > 1:
raise Utils.WafError("ERROR: source %s is in more than one subsystem of target '%s': %s" % (s, tname, subsystems[s][tname]))
return ret
def check_orphaned_targets(bld, tgt_list):
'''check if any build targets are orphaned'''
target_dict = LOCAL_CACHE(bld, 'TARGET_TYPE')
debug('deps: checking for orphaned targets')
for t in tgt_list:
if getattr(t, 'samba_used', False):
continue
type = target_dict[t.sname]
if not type in ['BINARY', 'LIBRARY', 'MODULE', 'ET', 'PYTHON']:
if re.search('^PIDL_', t.sname) is None:
Logs.warn("Target %s of type %s is unused by any other target" % (t.sname, type))
return True
def check_group_ordering(bld, tgt_list):
'''see if we have any dependencies that violate the group ordering
......@@ -366,7 +343,7 @@ def check_group_ordering(bld, tgt_list):
ret = False
return ret
Build.BuildContext.check_group_ordering = check_group_ordering
def show_final_deps(bld, tgt_list):
'''show the final dependencies for all targets'''
......@@ -1157,15 +1134,13 @@ def check_project_rules(bld):
debug('deps: project rules stage1 completed')
#check_orphaned_targets(bld, tgt_list)
if not check_duplicate_sources(bld, tgt_list):
Logs.error("Duplicate sources present - aborting")
sys.exit(1)
debug("deps: check_duplicate_sources: %f" % (time.clock() - tstart))
if not check_group_ordering(bld, tgt_list):
if not bld.check_group_ordering(tgt_list):
Logs.error("Bad group ordering - aborting")
sys.exit(1)
......
......@@ -4,7 +4,7 @@
# library use
import os
import Options, Utils
import Utils
from TaskGen import feature, before, after
from samba_utils import LIB_PATH, MODE_755, install_rpath, build_rpath
......@@ -19,7 +19,7 @@ def install_binary(self):
install_ldflags = install_rpath(self)
build_ldflags = build_rpath(bld)
if not Options.is_install:
if not self.bld.is_install:
# just need to set rpath if we are not installing
self.env.RPATH = build_ldflags
return
......@@ -68,7 +68,7 @@ def install_library(self):
install_ldflags = install_rpath(self)
build_ldflags = build_rpath(bld)
if not Options.is_install or not getattr(self, 'samba_install', True):
if not self.bld.is_install or not getattr(self, 'samba_install', True):
# just need to set the build rpath if we are not installing
self.env.RPATH = build_ldflags
return
......@@ -92,6 +92,7 @@ def install_library(self):
t = self.clone(self.env)
t.posted = False
t.target += '.inst'
t.name = self.name + '.inst'
self.env.RPATH = build_ldflags
else:
t = self
......
......@@ -266,24 +266,4 @@ def apply_lib_vars(self):
if val:
self.env.append_value(v, val)
@feature('cprogram', 'cshlib', 'cstaticlib')
@after('apply_lib_vars')
@before('apply_obj_vars')
def samba_before_apply_obj_vars(self):
"""before apply_obj_vars for uselib, this removes the standard pathes"""
def is_standard_libpath(env, path):
for _path in env.STANDARD_LIBPATH:
if _path == os.path.normpath(path):
return True
return False
v = self.env
for i in v['RPATH']:
if is_standard_libpath(v, i):
v['RPATH'].remove(i)
for i in v['LIBPATH']:
if is_standard_libpath(v, i):
v['LIBPATH'].remove(i)
......@@ -7,7 +7,7 @@ def write_version_header(task):
'''print version.h contents'''
src = task.inputs[0].srcpath(task.env)
version = samba_version_file(src, task.env.srcdir, env=task.env, is_install=task.env.is_install)
version = samba_version_file(src, task.env.srcdir, env=task.env, is_install=task.generator.bld.is_install)
string = str(version)
task.outputs[0].write(string)
......@@ -25,7 +25,6 @@ def SAMBA_MKVERSION(bld, target):
source= 'VERSION',
target=target,
always=bld.is_install)
t.env.is_install = bld.is_install
Build.BuildContext.SAMBA_MKVERSION = SAMBA_MKVERSION
......
......@@ -5,12 +5,6 @@ done = {}
@conf
def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)):
#
# TODO: use the @runonce mechanism for this.
# The problem is that @runonce currently does
# not seem to work together with @conf...
# So @runonce (and/or) @conf needs fixing.
#
if "done" in done:
return
done["done"] = True
......
# waf build tool for building IDL files with pidl
import os
import Build, Logs, Utils
import Build, Logs, Utils, Configure
from Configure import conf
@conf
......@@ -63,7 +63,12 @@ def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
del(conf.env.defines['PYTHONARCHDIR'])
def _check_python_headers(conf, mandatory):
conf.check_python_headers(mandatory=mandatory)
try:
Configure.ConfigurationError
conf.check_python_headers(mandatory=mandatory)
except Configure.ConfigurationError:
if mandatory:
raise
if conf.env['PYTHON_VERSION'] > '3':
abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0]
......
......@@ -3,7 +3,7 @@
import os, sys, re, fnmatch, shlex
import Build, Options, Utils, Task, Logs, Configure
from TaskGen import feature, before
from TaskGen import feature, before, after
from Configure import conf, ConfigurationContext
from Logs import debug
......@@ -35,22 +35,6 @@ def GET_TARGET_TYPE(ctx, target):
return cache[target]
######################################################
# this is used as a decorator to make functions only
# run once. Based on the idea from
# http://stackoverflow.com/questions/815110/is-there-a-decorator-to-simply-cache-function-return-values
def runonce(function):
runonce_ret = {}
def runonce_wrapper(*args):
if args in runonce_ret:
return runonce_ret[args]
else:
ret = function(*args)
runonce_ret[args] = ret
return ret
return runonce_wrapper
def ADD_LD_LIBRARY_PATH(path):
'''add something to LD_LIBRARY_PATH'''
if 'LD_LIBRARY_PATH' in os.environ:
......@@ -135,27 +119,6 @@ def dict_concat(d1, d2):
if t not in d1:
d1[t] = d2[t]
def exec_command(self, cmd, **kw):
'''this overrides the 'waf -v' debug output to be in a nice
unix like format instead of a python list.
Thanks to ita on #waf for this'''
_cmd = cmd
if isinstance(cmd, list):
_cmd = ' '.join(cmd)
debug('runner: %s' % _cmd)
if self.log:
self.log.write('%s\n' % cmd)
kw['log'] = self.log
try:
if not kw.get('cwd', None):
kw['cwd'] = self.cwd
except AttributeError:
self.cwd = kw['cwd'] = self.bldnode.abspath()
return Utils.exec_command(cmd, **kw)
Build.BuildContext.exec_command = exec_command
def ADD_COMMAND(opt, name, function):
'''add a new top level command to waf'''
Utils.g_module.__dict__[name] = function
......@@ -683,3 +646,26 @@ def AD_DC_BUILD_IS_ENABLED(self):
return False
Build.BuildContext.AD_DC_BUILD_IS_ENABLED = AD_DC_BUILD_IS_ENABLED
@feature('cprogram', 'cshlib', 'cstaticlib')
@after('apply_lib_vars')
@before('apply_obj_vars')
def samba_before_apply_obj_vars(self):
"""before apply_obj_vars for uselib, this removes the standard paths"""
def is_standard_libpath(env, path):
for _path in env.STANDARD_LIBPATH:
if _path == os.path.normpath(path):
return True
return False
v = self.env
for i in v['RPATH']:
if is_standard_libpath(v, i):
v['RPATH'].remove(i)
for i in v['LIBPATH']:
if is_standard_libpath(v, i):
v['LIBPATH'].remove(i)
......@@ -130,7 +130,6 @@ def fake_build_environment(info=True, flush=False):
Options.commands['install'] = False
Options.commands['uninstall'] = False
Options.is_install = False
bld.is_install = 0 # False
......
......@@ -282,7 +282,7 @@ def SAMBA_LIBRARY(bld, libname, source,
if not vscriptpath:
raise Utils.WafError("unable to find vscript path for %s" % vscript)
bld.add_manual_dependency(fullpath, vscriptpath)
if Options.is_install:
if bld.is_install:
# also make the .inst file depend on the vscript
instname = apply_pattern(bundled_name + '.inst', bld.env.shlib_PATTERN)
bld.add_manual_dependency(bld.path.find_or_declare(instname), bld.path.find_or_declare(vscript))
......@@ -674,7 +674,7 @@ Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
@runonce
@Utils.run_once
def SETUP_BUILD_GROUPS(bld):
'''setup build groups used to ensure that the different build
phases happen consecutively'''
......@@ -727,7 +727,7 @@ def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
'''used to copy scripts from the source tree into the build directory
for use by selftest'''
source = bld.path.ant_glob(pattern)
source = bld.path.ant_glob(pattern, flat=True)
bld.SET_BUILD_GROUP('build_source')
for s in TO_LIST(source):
......@@ -856,7 +856,7 @@ Build.BuildContext.INSTALL_FILES = INSTALL_FILES
def INSTALL_WILDCARD(bld, destdir, pattern, chmod=MODE_644, flat=False,
python_fixup=False, exclude=None, trim_path=None):
'''install a set of files matching a wildcard pattern'''
files=TO_LIST(bld.path.ant_glob(pattern))
files=TO_LIST(bld.path.ant_glob(pattern, flat=True))
if trim_path:
files2 = []
for f in files:
......
......@@ -203,7 +203,7 @@ def set_options(opt):
metavar="PYTHON", dest='EXTRA_PYTHON', default=None)
@wafsamba.runonce
@Utils.run_once
def configure(conf):
conf.env.hlist = []
conf.env.srcdir = conf.srcdir
......@@ -216,6 +216,7 @@ def configure(conf):
# load our local waf extensions
conf.check_tool('gnu_dirs')
conf.check_tool('wafsamba')
conf.check_tool('print_commands')
conf.CHECK_CC_ENV()
......
......@@ -407,7 +407,7 @@ char *ldb_control_to_string(TALLOC_CTX *mem_ctx, const struct ldb_control *contr
/*
* A little trick to allow to use constants defined in headers rather than
* A little trick to allow one to use constants defined in headers rather than
* hardwritten in the file.
* "sizeof" will return the \0 char as well so it will take the place of ":"
* in the length of the string.
......
......@@ -189,33 +189,23 @@ struct ldb_dn *ldb_dn_new_fmt(TALLOC_CTX *mem_ctx,
/* see RFC2253 section 2.4 */
static int ldb_dn_escape_internal(char *dst, const char *src, int len)
{
const char *p, *s;
char c;
char *d;
size_t l;
p = s = src;
int i;
d = dst;
while (p - src < len) {
p += strcspn(p, ",=\n\r+<>#;\\\" ");
if (p - src == len) /* found no escapable chars */
break;
/* copy the part of the string before the stop */
memcpy(d, s, p - s);
d += (p - s); /* move to current position */
switch (*p) {
for (i = 0; i < len; i++){
c = src[i];
switch (c) {
case ' ':
if (p == src || (p-src)==(len-1)) {
if (i == 0 || i == len - 1) {
/* if at the beginning or end
* of the string then escape */
*d++ = '\\';
*d++ = *p++;
*d++ = c;
} else {
/* otherwise don't escape */
*d++ = *p++;
*d++ = c;
}
break;
......@@ -231,36 +221,36 @@ static int ldb_dn_escape_internal(char *dst, const char *src, int len)
case '?':
/* these must be escaped using \c form */
*d++ = '\\';
*d++ = *p++;
*d++ = c;
break;
default: {
case ';':
case '\r':
case '\n':
case '=':
case '\0': {
/* any others get \XX form */
unsigned char v;
const char *hexbytes = "0123456789ABCDEF";
v = *(const unsigned char *)p;
v = (const unsigned char)c;
*d++ = '\\';
*d++ = hexbytes[v>>4];
*d++ = hexbytes[v&0xF];
p++;
break;
}
default:
*d++ = c;
}
s = p; /* move forward */
}
/* copy the last part (with zero) and return */
l = len - (s - src);
memcpy(d, s, l + 1);
/* return the length of the resulting string */
return (l + (d - dst));
return (d - dst);
}
char *ldb_dn_escape_value(TALLOC_CTX *mem_ctx, struct ldb_val value)
{
char *dst;
size_t len;
if (!value.length)
return NULL;
......@@ -271,10 +261,14 @@ char *ldb_dn_escape_value(TALLOC_CTX *mem_ctx, struct ldb_val value)
return NULL;
}
ldb_dn_escape_internal(dst, (const char *)value.data, value.length);
dst = talloc_realloc(mem_ctx, dst, char, strlen(dst) + 1);
len = ldb_dn_escape_internal(dst, (const char *)value.data, value.length);
dst = talloc_realloc(mem_ctx, dst, char, len + 1);
if ( ! dst) {
talloc_free(dst);
return NULL;
}
dst[len] = '\0';
return dst;
}
......@@ -592,12 +586,15 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
p++;
*d++ = '\0';
dn->components[dn->comp_num].value.data = (uint8_t *)talloc_strdup(dn->components, dt);
dn->components[dn->comp_num].value.data = \
(uint8_t *)talloc_memdup(dn->components, dt, l + 1);
dn->components[dn->comp_num].value.length = l;
if ( ! dn->components[dn->comp_num].value.data) {
/* ouch ! */
goto failed;
}
talloc_set_name_const(dn->components[dn->comp_num].value.data,
(const char *)dn->components[dn->comp_num].value.data);
dt = d;
......@@ -713,11 +710,13 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
*d++ = '\0';
dn->components[dn->comp_num].value.length = l;
dn->components[dn->comp_num].value.data =
(uint8_t *)talloc_strdup(dn->components, dt);
(uint8_t *)talloc_memdup(dn->components, dt, l + 1);
if ( ! dn->components[dn->comp_num].value.data) {
/* ouch */
goto failed;
}
talloc_set_name_const(dn->components[dn->comp_num].value.data,
(const char *)dn->components[dn->comp_num].value.data);
dn->comp_num++;
......
......@@ -241,7 +241,6 @@ static int ldb_wildcard_compare(struct ldb_context *ldb,
struct ldb_val val;
struct ldb_val cnk;
struct ldb_val *chunk;
char *p, *g;
uint8_t *save_p = NULL;
unsigned int c = 0;
......@@ -271,6 +270,14 @@ static int ldb_wildcard_compare(struct ldb_context *ldb,
if (cnk.length > val.length) {
goto mismatch;
}
/*
* Empty strings are returned as length 0. Ensure
* we can cope with this.
*/
if (cnk.length == 0) {
goto mismatch;
}
if (memcmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) goto mismatch;
val.length -= cnk.length;
val.data += cnk.length;
......@@ -280,20 +287,36 @@ static int ldb_wildcard_compare(struct ldb_context *ldb,
}
while (tree->u.substring.chunks[c]) {
uint8_t *p;
chunk = tree->u.substring.chunks[c];
if(a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto mismatch;
/* FIXME: case of embedded nulls */
p = strstr((char *)val.data, (char *)cnk.data);
/*
* Empty strings are returned as length 0. Ensure
* we can cope with this.
*/
if (cnk.length == 0) {
goto mismatch;
}
/*
* Values might be binary blobs. Don't use string
* search, but memory search instead.
*/
p = memmem((const void *)val.data,val.length,
(const void *)cnk.data, cnk.length);
if (p == NULL) goto mismatch;
if ( (! tree->u.substring.chunks[c + 1]) && (! tree->u.substring.end_with_wildcard) ) {
uint8_t *g;
do { /* greedy */
g = strstr((char *)p + cnk.length, (char *)cnk.data);
g = memmem(p + cnk.length,
val.length - (p - val.data),
(const uint8_t *)cnk.data,
cnk.length);
if (g) p = g;
} while(g);
}
val.length = val.length - (p - (char *)(val.data)) - cnk.length;
val.length = val.length - (p - (uint8_t *)(val.data)) - cnk.length;
val.data = (uint8_t *)(p + cnk.length);
c++;
talloc_free(cnk.data);
......
......@@ -382,4 +382,16 @@ struct ldb_extended_match_rule
int ldb_register_extended_match_rule(struct ldb_context *ldb,
const struct ldb_extended_match_rule *rule);
/*
* these pack/unpack functions are exposed in the library for use by
* ldb tools like ldbdump and for use in tests,
* but are not part of the public API
*/
int ldb_pack_data(struct ldb_context *ldb,
const struct ldb_message *message,
struct ldb_val *data);
int ldb_unpack_data(struct ldb_context *ldb,
const struct ldb_val *data,
struct ldb_message *message);
#endif
......@@ -200,17 +200,6 @@ struct ldb_ldif *ldb_ldif_read_file_state(struct ldb_context *ldb,
char *ldb_ldif_write_redacted_trace_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
const struct ldb_ldif *ldif);
/*
* these pack/unpack functions are exposed in the library for use by
* ldb tools like ldbdump, but are not part of the public API
*/
int ldb_pack_data(struct ldb_context *ldb,
const struct ldb_message *message,
struct ldb_val *data);
int ldb_unpack_data(struct ldb_context *ldb,
const struct ldb_val *data,
struct ldb_message *message);
/*
* Get the LDB context in use on an LDB DN.
*
......
......@@ -407,10 +407,18 @@ int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs)
}
talloc_free(msg->elements);
msg->elements = talloc_realloc(msg, el2, struct ldb_message_element, msg->num_elements);
if (num_elements > 0) {
msg->elements = talloc_realloc(msg, el2, struct ldb_message_element,
num_elements);