summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-03-03 00:23:09 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-03-03 00:23:09 +0100
commitc7dc53b8514f83800184d2b20b1897e54843a614 (patch)
tree4f09d783271dc5e38809ed02c8252d73f8b147e5 /source4/lib
parent375df425c5014dc852995038e8e5668f98af8ba3 (diff)
parent85d53f7b603f7c15b007f8c3fdde1989f07a6eb2 (diff)
downloadsamba-c7dc53b8514f83800184d2b20b1897e54843a614.tar.gz
samba-c7dc53b8514f83800184d2b20b1897e54843a614.tar.bz2
samba-c7dc53b8514f83800184d2b20b1897e54843a614.zip
Merge branch 'v4-0-test' into id10ts-registry
(This used to be commit f98b59021a5ea39c7970ebc5520d17775e500b8c)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/appweb/mpr/miniMpr.c7
-rw-r--r--source4/lib/appweb/mpr/miniMpr.h2
-rw-r--r--source4/lib/basic.mk12
-rw-r--r--source4/lib/charset/config.mk6
-rw-r--r--source4/lib/charset/util_unistr.c34
-rw-r--r--source4/lib/cmdline/config.mk3
-rw-r--r--source4/lib/events/config.mk3
-rw-r--r--source4/lib/ldb/config.mk11
-rw-r--r--source4/lib/ldb/include/ldb.h22
-rw-r--r--source4/lib/ldb/ldb.i84
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c4
-rw-r--r--source4/lib/ldb/ldb_wrap.c158
-rw-r--r--source4/lib/ldb/modules/rdn_name.c3
-rw-r--r--source4/lib/ldb/tools/config.mk18
-rw-r--r--source4/lib/nss_wrapper/config.mk3
-rw-r--r--source4/lib/registry/config.mk15
-rw-r--r--source4/lib/registry/hive.c3
-rw-r--r--source4/lib/registry/hive.h3
-rw-r--r--source4/lib/registry/ldb.c14
-rw-r--r--source4/lib/registry/patchfile.c9
-rw-r--r--source4/lib/registry/patchfile.h1
-rw-r--r--source4/lib/registry/patchfile_dotreg.c3
-rw-r--r--source4/lib/registry/patchfile_preg.c17
-rw-r--r--source4/lib/registry/regf.c10
-rw-r--r--source4/lib/registry/tests/hive.c4
-rw-r--r--source4/lib/registry/tools/regdiff.c2
-rw-r--r--source4/lib/replace/Makefile.in6
-rw-r--r--source4/lib/replace/configure.ac2
-rw-r--r--source4/lib/replace/getifaddrs.c79
-rw-r--r--source4/lib/replace/getifaddrs.m427
-rw-r--r--source4/lib/replace/test/getifaddrs.c100
-rw-r--r--source4/lib/replace/test/testsuite.c9
-rw-r--r--source4/lib/socket_wrapper/config.mk3
-rw-r--r--source4/lib/talloc/config.mk6
-rw-r--r--source4/lib/tdb/config.mk3
-rw-r--r--source4/lib/tdr/config.mk5
-rw-r--r--source4/lib/util/config.mk30
37 files changed, 399 insertions, 322 deletions
diff --git a/source4/lib/appweb/mpr/miniMpr.c b/source4/lib/appweb/mpr/miniMpr.c
index 949d64fcf1..52b23608aa 100644
--- a/source4/lib/appweb/mpr/miniMpr.c
+++ b/source4/lib/appweb/mpr/miniMpr.c
@@ -30,6 +30,7 @@
*/
#include "miniMpr.h"
+#include "param/param.h"
/************************************ Code ************************************/
#if !BLD_APPWEB
@@ -49,6 +50,12 @@ void *mprMemCtx(void)
return mpr_ctx;
}
+/* return the loadparm context being used for all ejs variables */
+struct loadparm_context *mprLpCtx(void)
+{
+ return global_loadparm;
+}
+
void mprFree(void *ptr)
{
talloc_free(ptr);
diff --git a/source4/lib/appweb/mpr/miniMpr.h b/source4/lib/appweb/mpr/miniMpr.h
index 836fdab9f2..15ce30c8df 100644
--- a/source4/lib/appweb/mpr/miniMpr.h
+++ b/source4/lib/appweb/mpr/miniMpr.h
@@ -272,6 +272,8 @@ extern int mprMemcpy(char *dest, int destMax, const char *src, int nbytes);
extern void mprSetCtx(void *ctx);
extern void *mprMemCtx(void);
+struct loadparm_context;
+extern struct loadparm_context *mprLpCtx(void);
/* This function needs to be provided by anyone using ejs */
void ejs_exception(const char *reason);
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index a118636c52..d059bdf49b 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -22,17 +22,23 @@ mkinclude crypto/config.mk
OBJ_FILES = compression/mszip.o
[SUBSYSTEM::GENCACHE]
-PUBLIC_HEADERS = gencache/gencache.h
OBJ_FILES = gencache/gencache.o
PRIVATE_DEPENDENCIES = TDB_WRAP
+
+PUBLIC_HEADERS += lib/gencache/gencache.h
+
[SUBSYSTEM::LDB_WRAP]
-PUBLIC_HEADERS = ldb_wrap.h
OBJ_FILES = ldb_wrap.o
PUBLIC_DEPENDENCIES = LIBLDB
PRIVATE_DEPENDENCIES = LDBSAMBA UTIL_LDB
+
+PUBLIC_HEADERS += lib/ldb_wrap.h
+
[SUBSYSTEM::TDB_WRAP]
-PUBLIC_HEADERS = tdb_wrap.h
OBJ_FILES = tdb_wrap.o
PUBLIC_DEPENDENCIES = LIBTDB
+
+
+PUBLIC_HEADERS += lib/tdb_wrap.h
diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk
index 4f0c80c79d..2766784c52 100644
--- a/source4/lib/charset/config.mk
+++ b/source4/lib/charset/config.mk
@@ -5,9 +5,11 @@ OBJ_FILES = \
iconv.o \
charcnv.o \
util_unistr.o
-PUBLIC_HEADERS = charset.h
-PUBLIC_PROTO_HEADER = charset_proto.h
+PRIVATE_PROTO_HEADER = charset_proto.h
PUBLIC_DEPENDENCIES = ICONV
PRIVATE_DEPENDENCIES = DYNCONFIG
# End SUBSYSTEM CHARSET
################################################
+
+
+PUBLIC_HEADERS += lib/charset/charset.h
diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c
index e0e1aed222..9b87f49800 100644
--- a/source4/lib/charset/util_unistr.c
+++ b/source4/lib/charset/util_unistr.c
@@ -123,6 +123,7 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2)
{
codepoint_t c1=0, c2=0;
size_t size1, size2;
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
/* handle null ptr comparisons to simplify the use in qsort */
if (s1 == s2) return 0;
@@ -130,8 +131,8 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2)
if (s2 == NULL) return 1;
while (*s1 && *s2) {
- c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1);
- c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2);
+ c1 = next_codepoint(iconv_convenience, s1, &size1);
+ c2 = next_codepoint(iconv_convenience, s2, &size2);
s1 += size1;
s2 += size2;
@@ -207,6 +208,7 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n)
{
codepoint_t c1=0, c2=0;
size_t size1, size2;
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
/* handle null ptr comparisons to simplify the use in qsort */
if (s1 == s2) return 0;
@@ -216,8 +218,8 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n)
while (*s1 && *s2 && n) {
n--;
- c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1);
- c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2);
+ c1 = next_codepoint(iconv_convenience, s1, &size1);
+ c2 = next_codepoint(iconv_convenience, s2, &size2);
s1 += size1;
s2 += size2;
@@ -480,6 +482,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
{
size_t size=0;
char *dest;
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
/* this takes advantage of the fact that upper/lower can't
change the length of a character by more than 1 byte */
@@ -490,12 +493,12 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
while (*src) {
size_t c_size;
- codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size);
+ codepoint_t c = next_codepoint(iconv_convenience, src, &c_size);
src += c_size;
c = tolower_w(c);
- c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c);
+ c_size = push_codepoint(iconv_convenience, dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
@@ -520,6 +523,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
{
size_t size=0;
char *dest;
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
if (!src) {
return NULL;
@@ -534,12 +538,12 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
while (*src) {
size_t c_size;
- codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size);
+ codepoint_t c = next_codepoint(iconv_convenience, src, &c_size);
src += c_size;
c = toupper_w(c);
- c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c);
+ c_size = push_codepoint(iconv_convenience, dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
@@ -563,6 +567,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
_PUBLIC_ void strlower_m(char *s)
{
char *d;
+ struct smb_iconv_convenience *iconv_convenience;
/* this is quite a common operation, so we want it to be
fast. We optimise for the ascii case, knowing that all our
@@ -576,12 +581,14 @@ _PUBLIC_ void strlower_m(char *s)
if (!*s)
return;
+ iconv_convenience = lp_iconv_convenience(global_loadparm);
+
d = s;
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size);
- c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, tolower_w(c));
+ codepoint_t c = next_codepoint(iconv_convenience, s, &c_size);
+ c_size2 = push_codepoint(iconv_convenience, d, tolower_w(c));
if (c_size2 > c_size) {
DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strlower_m\n",
c, tolower_w(c), (int)c_size, (int)c_size2));
@@ -599,6 +606,7 @@ _PUBLIC_ void strlower_m(char *s)
_PUBLIC_ void strupper_m(char *s)
{
char *d;
+ struct smb_iconv_convenience *iconv_convenience;
/* this is quite a common operation, so we want it to be
fast. We optimise for the ascii case, knowing that all our
@@ -612,12 +620,14 @@ _PUBLIC_ void strupper_m(char *s)
if (!*s)
return;
+ iconv_convenience = lp_iconv_convenience(global_loadparm);
+
d = s;
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size);
- c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, toupper_w(c));
+ codepoint_t c = next_codepoint(iconv_convenience, s, &c_size);
+ c_size2 = push_codepoint(iconv_convenience, d, toupper_w(c));
if (c_size2 > c_size) {
DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strupper_m\n",
c, toupper_w(c), (int)c_size, (int)c_size2));
diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk
index a1f876d56a..87014d4d53 100644
--- a/source4/lib/cmdline/config.mk
+++ b/source4/lib/cmdline/config.mk
@@ -4,10 +4,11 @@ OBJ_FILES = credentials.o
PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT
[SUBSYSTEM::POPT_SAMBA]
-PUBLIC_HEADERS = popt_common.h
OBJ_FILES = popt_common.o
PUBLIC_DEPENDENCIES = LIBPOPT
+PUBLIC_HEADERS += lib/cmdline/popt_common.h
+
[SUBSYSTEM::POPT_CREDENTIALS]
PRIVATE_PROTO_HEADER = popt_credentials.h
OBJ_FILES = popt_credentials.o
diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk
index 910cf3738f..225a23c634 100644
--- a/source4/lib/events/config.mk
+++ b/source4/lib/events/config.mk
@@ -32,11 +32,12 @@ INIT_FUNCTION = s4_events_standard_init
# Start SUBSYSTEM LIBEVENTS
[SUBSYSTEM::LIBEVENTS]
OBJ_FILES = events.o events_timed.o events_signal.o
-PUBLIC_HEADERS = events.h events_internal.h
PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL
# End SUBSYSTEM LIBEVENTS
##############################
+PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h)
+
[PYTHON::swig_events]
SWIG_FILE = events.i
PRIVATE_DEPENDENCIES = LIBEVENTS
diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk
index d6980f341a..81fd1e9b95 100644
--- a/source4/lib/ldb/config.mk
+++ b/source4/lib/ldb/config.mk
@@ -147,12 +147,14 @@ PUBLIC_DEPENDENCIES = \
LIBTALLOC
PRIVATE_DEPENDENCIES = \
SOCKET_WRAPPER
-MANPAGE = man/ldb.3
-PUBLIC_HEADERS = include/ldb.h include/ldb_errors.h
#
# End SUBSYSTEM ldb
################################################
+PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h
+
+MANPAGES += $(ldbdir)/man/ldb.3
+
################################################
# Start BINARY ldbtest
[BINARY::ldbtest]
@@ -167,7 +169,6 @@ PRIVATE_DEPENDENCIES = \
# Start BINARY oLschema2ldif
[BINARY::oLschema2ldif]
INSTALLDIR = BINDIR
-MANPAGE = man/oLschema2ldif.1
OBJ_FILES= \
tools/convert.o \
tools/oLschema2ldif.o
@@ -176,11 +177,12 @@ PRIVATE_DEPENDENCIES = \
# End BINARY oLschema2ldif
################################################
+MANPAGES += $(ldbdir)/man/oLschema2ldif.1
+
################################################
# Start BINARY ad2oLschema
[BINARY::ad2oLschema]
INSTALLDIR = BINDIR
-MANPAGE = man/ad2oLschema.1
OBJ_FILES= \
tools/convert.o \
tools/ad2oLschema.o
@@ -189,6 +191,7 @@ PRIVATE_DEPENDENCIES = \
# End BINARY ad2oLschema
################################################
+MANPAGES += $(ldbdir)/man/ad2oLschema.1
mkinclude tools/config.mk
mkinclude ldb_ildap/config.mk
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 2e54920c17..2e13a774b9 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -290,7 +290,7 @@ char *ldb_filter_from_tree(TALLOC_CTX *mem_ctx, struct ldb_parse_tree *tree);
2254 (Section 4). This function also escapes any non-printable
characters.
- \param ctx the memory context to allocate the return string in.
+ \param mem_ctx the memory context to allocate the return string in.
\param val the (potentially) binary data to be encoded
\return the encoded data as a null terminated string
@@ -886,7 +886,7 @@ int ldb_search_default_callback(struct ldb_context *ldb, void *context, struct l
\param attrs the search attributes for the query (pass NULL if none required)
\param controls an array of controls
\param context the callback function context
- \param the callback function to handle the async replies
+ \param callback the callback function to handle the async replies
\return result code (LDB_SUCCESS on success, or a failure code)
*/
@@ -911,7 +911,7 @@ int ldb_build_search_req(struct ldb_request **ret_req,
\param message contains the entry to be added
\param controls an array of controls
\param context the callback function context
- \param the callback function to handle the async replies
+ \param callback the callback function to handle the async replies
\return result code (LDB_SUCCESS on success, or a failure code)
*/
@@ -933,7 +933,7 @@ int ldb_build_add_req(struct ldb_request **ret_req,
\param message contains the entry to be modified
\param controls an array of controls
\param context the callback function context
- \param the callback function to handle the async replies
+ \param callback the callback function to handle the async replies
\return result code (LDB_SUCCESS on success, or a failure code)
*/
@@ -955,7 +955,7 @@ int ldb_build_mod_req(struct ldb_request **ret_req,
\param dn the DN to be deleted
\param controls an array of controls
\param context the callback function context
- \param the callback function to handle the async replies
+ \param callback the callback function to handle the async replies
\return result code (LDB_SUCCESS on success, or a failure code)
*/
@@ -978,7 +978,7 @@ int ldb_build_del_req(struct ldb_request **ret_req,
\param newdn the new DN
\param controls an array of controls
\param context the callback function context
- \param the callback function to handle the async replies
+ \param callback the callback function to handle the async replies
\return result code (LDB_SUCCESS on success, or a failure code)
*/
@@ -997,7 +997,7 @@ int ldb_build_rename_req(struct ldb_request **ret_req,
\param req the request struct where to add the control
\param oid the object identifier of the control as string
- \param ciritical whether the control should be critical or not
+ \param critical whether the control should be critical or not
\param data a talloc pointer to the control specific data
\return result code (LDB_SUCCESS on success, or a failure code)
@@ -1137,7 +1137,7 @@ int ldb_extended_default_callback(struct ldb_context *ldb, void *context, struct
it needs to be NULL or a valid talloc pointer! talloc_get_type() will be used on it
\param controls an array of controls
\param context the callback function context
- \param the callback function to handle the async replies
+ \param callback the callback function to handle the async replies
\return result code (LDB_SUCCESS on success, or a failure code)
*/
@@ -1226,6 +1226,7 @@ int ldb_valid_attr_name(const char *s);
/*
ldif manipulation functions
*/
+
/**
Write an LDIF message
@@ -1418,8 +1419,8 @@ bool ldb_dn_is_null(struct ldb_dn *dn);
This function compares to attribute names. Note that this is a
case-insensitive comparison.
- \param attr1 the first attribute name to compare
- \param attr2 the second attribute name to compare
+ \param a the first attribute name to compare
+ \param b the second attribute name to compare
\return 0 if the attribute names are the same, or only differ in
case; non-zero if there are any differences
@@ -1562,6 +1563,7 @@ int ldb_msg_check_string_attribute(const struct ldb_message *msg,
This function performs basic sanity / integrity checks on an
ldb_message.
+ \param ldb context in which to perform the checks
\param msg the message to check
\return LDB_SUCCESS if the message is OK, or a non-zero error code
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index 336100c4f0..da4c52f778 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -547,6 +547,43 @@ PyObject *PyExc_LdbError;
talloc_free($1);
};
+%typemap(in,numinputs=1) ldb_msg *add_msg {
+ int dict_pos, msg_pos;
+ PyObject *key, *value;
+ ldb_msg_element *msgel;
+
+ if (PyDict_Check($input)) {
+ $1 = ldb_msg_new(NULL);
+ $1->elements = talloc_zero_array($1, struct ldb_message_element, PyDict_Size($input));
+ msg_pos = dict_pos = 0;
+ while (PyDict_Next($input, &dict_pos, &key, &value)) {
+ if (!strcmp(PyString_AsString(key), "dn")) {
+ /* using argp0 (magic SWIG value) here is a hack */
+ if (ldb_dn_from_pyobject($1, value, argp1, &$1->dn) != 0) {
+ SWIG_exception(SWIG_TypeError, "unable to import dn object");
+ }
+ } else {
+ msgel = ldb_msg_element_from_pyobject($1->elements, value, 0, PyString_AsString(key));
+ if (msgel == NULL) {
+ SWIG_exception(SWIG_TypeError, "unable to import element");
+ }
+ memcpy(&$1->elements[msg_pos], msgel, sizeof(*msgel));
+ msg_pos++;
+ }
+ }
+
+ if ($1->dn == NULL) {
+ SWIG_exception(SWIG_TypeError, "no dn set");
+ }
+
+ $1->num_elements = msg_pos;
+ } else {
+ if (SWIG_ConvertPtr($input, (void **)&$1, SWIGTYPE_p_ldb_message, 0) != 0) {
+ SWIG_exception(SWIG_TypeError, "unable to convert ldb message");
+ }
+ }
+}
+
/* Top-level ldb operations */
typedef struct ldb_context {
%extend {
@@ -604,53 +641,6 @@ typedef struct ldb_context {
struct ldb_control **parse_control_strings(TALLOC_CTX *mem_ctx,
const char * const*control_strings);
ldb_error add(ldb_msg *add_msg);
- ldb_error add(PyObject *py_msg)
- {
- ldb_error ret;
- int dict_pos, msg_pos;
- PyObject *key, *value;
- ldb_msg_element *msgel;
- ldb_msg *msg = NULL;
-
- if (PyDict_Check(py_msg)) {
- msg = ldb_msg_new(NULL);
- msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_msg));
- msg_pos = dict_pos = 0;
- while (PyDict_Next(py_msg, &dict_pos, &key, &value)) {
- if (!strcmp(PyString_AsString(key), "dn")) {
- if (ldb_dn_from_pyobject(msg, value, $self, &msg->dn) != 0) {
- return LDB_ERR_OTHER;
- }
- } else {
- msgel = ldb_msg_element_from_pyobject(msg->elements, value, 0, PyString_AsString(key));
- if (msgel == NULL) {
- SWIG_exception(SWIG_TypeError, "unable to import element");
- return LDB_ERR_OTHER;
- }
- memcpy(&msg->elements[msg_pos], msgel, sizeof(*msgel));
- msg_pos++;
- }
- }
-
- if (msg->dn == NULL) {
- SWIG_exception(SWIG_TypeError, "no dn set");
- return LDB_ERR_OTHER;
- }
-
- msg->num_elements = msg_pos;
- } else {
- if (SWIG_ConvertPtr(py_msg, (void **)&msg, SWIGTYPE_p_ldb_message, 0) != 0)
- return LDB_ERR_OTHER;
- }
-
- ret = ldb_add($self, msg);
-
- talloc_free(msg);
- return ret;
-
- fail:
- return LDB_ERR_OTHER;
- }
ldb_error modify(ldb_msg *message);
ldb_dn *get_config_basedn();
ldb_dn *get_root_basedn();
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index 995b584f51..79958a86eb 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -816,8 +816,8 @@ _PUBLIC_ const struct ldb_backend_ops ldb_ldap_backend_ops = {
.connect_fn = ildb_connect
};
-_PUBLIC_ const struct ldb_backend_ops ldb_ildap_backend_ops = {
- .name = "ildap",
+_PUBLIC_ const struct ldb_backend_ops ldb_ldapi_backend_ops = {
+ .name = "ldapi",
.connect_fn = ildb_connect
};
diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c
index 51022e5930..7886778b3a 100644
--- a/source4/lib/ldb/ldb_wrap.c
+++ b/source4/lib/ldb/ldb_wrap.c
@@ -3113,52 +3113,6 @@ SWIGINTERN ldb_error ldb_search_ex(ldb *self,TALLOC_CTX *mem_ctx,ldb_dn *base,en
*OUT = res;
return ret;
}
-SWIGINTERN ldb_error ldb_add__SWIG_1(ldb *self,PyObject *py_msg){
- ldb_error ret;
- int dict_pos, msg_pos;
- PyObject *key, *value;
- ldb_msg_element *msgel;
- ldb_msg *msg = NULL;
-
- if (PyDict_Check(py_msg)) {
- msg = ldb_msg_new(NULL);
- msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_msg));
- msg_pos = dict_pos = 0;
- while (PyDict_Next(py_msg, &dict_pos, &key, &value)) {
- if (!strcmp(PyString_AsString(key), "dn")) {
- if (ldb_dn_from_pyobject(msg, value, self, &msg->dn) != 0) {
- return 80;
- }
- } else {
- msgel = ldb_msg_element_from_pyobject(msg->elements, value, 0, PyString_AsString(key));
- if (msgel == NULL) {
- SWIG_exception(SWIG_TypeError, "unable to import element");
- return 80;
- }
- memcpy(&msg->elements[msg_pos], msgel, sizeof(*msgel));
- msg_pos++;
- }
- }
-
- if (msg->dn == NULL) {
- SWIG_exception(SWIG_TypeError, "no dn set");
- return 80;
- }
-
- msg->num_elements = msg_pos;
- } else {
- if (SWIG_ConvertPtr(py_msg, (void **)&msg, SWIGTYPE_p_ldb_message, 0) != 0)
- return 80;
- }
-
- ret = ldb_add(self, msg);
-
- talloc_free(msg);
- return ret;
-
- fail:
- return 80;
- }
SWIGINTERN PyObject *ldb_schema_format_value(ldb *self,char const *element_name,PyObject *val){
const struct ldb_schema_attribute *a;
struct ldb_val old_val;
@@ -4733,27 +4687,61 @@ fail:
}
-SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
+SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
ldb *arg1 = (ldb *) 0 ;
ldb_msg *arg2 = (ldb_msg *) 0 ;
ldb_error result;
void *argp1 = 0 ;
int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ char * kwnames[] = {
+ (char *) "self",(char *) "add_msg", NULL
+ };
- if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 );
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_add",kwnames,&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_add" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
- res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ldb_message, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_add" "', argument " "2"" of type '" "ldb_msg *""'");
+ {
+ int dict_pos, msg_pos;
+ PyObject *key, *value;
+ ldb_msg_element *msgel;
+
+ if (PyDict_Check(obj1)) {
+ arg2 = ldb_msg_new(NULL);
+ arg2->elements = talloc_zero_array(arg2, struct ldb_message_element, PyDict_Size(obj1));
+ msg_pos = dict_pos = 0;
+ while (PyDict_Next(obj1, &dict_pos, &key, &value)) {
+ if (!strcmp(PyString_AsString(key), "dn")) {
+ /* using argp0 (magic SWIG value) here is a hack */
+ if (ldb_dn_from_pyobject(arg2, value, argp1, &arg2->dn) != 0) {
+ SWIG_exception(SWIG_TypeError, "unable to import dn object");
+ }
+ } else {
+ msgel = ldb_msg_element_from_pyobject(arg2->elements, value, 0, PyString_AsString(key));
+ if (msgel == NULL) {
+ SWIG_exception(SWIG_TypeError, "unable to import element");
+ }
+ memcpy(&arg2->elements[msg_pos], msgel, sizeof(*msgel));
+ msg_pos++;
+ }
+ }
+
+ if (arg2->dn == NULL) {
+ SWIG_exception(SWIG_TypeError, "no dn set");
+ }
+
+ arg2->num_elements = msg_pos;
+ } else {
+ if (SWIG_ConvertPtr(obj1, (void **)&arg2, SWIGTYPE_p_ldb_message, 0) != 0) {
+ SWIG_exception(SWIG_TypeError, "unable to convert ldb message");
+ }
+ }
}
- arg2 = (ldb_msg *)(argp2);
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
@@ -4772,64 +4760,6 @@ fail:
}
-SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
- PyObject *resultobj = 0;
- ldb *arg1 = (ldb *) 0 ;
- PyObject *arg2 = (PyObject *) 0 ;
- ldb_error result;
- void *argp1 = 0 ;
- int res1 = 0 ;
-
- if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_add" "', argument " "1"" of type '" "ldb *""'");
- }
- arg1 = (ldb *)(argp1);
- arg2 = swig_obj[1];
- if (arg1 == NULL)
- SWIG_exception(SWIG_ValueError,
- "ldb context must be non-NULL");
- result = ldb_add__SWIG_1(arg1,arg2);
- if (result != 0) {
- PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", result, ldb_strerror(result)));
- SWIG_fail;
- }
- resultobj = Py_None;
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[3];
-
- if (!(argc = SWIG_Python_UnpackTuple(args,"Ldb_add",0,2,argv))) SWIG_fail;
- --argc;
- if (argc == 2) {
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ldb_message, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- return _wrap_Ldb_add__SWIG_0(self, argc, argv);
- }
-check_1:
-
- if (argc == 2) {
- return _wrap_Ldb_add__SWIG_1(self, argc, argv);
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Ldb_add'.\n Possible C/C++ prototypes are:\n"" add(ldb *,ldb_msg *)\n"" add(ldb *,PyObject *)\n");
- return NULL;
-}
-
-
SWIGINTERN PyObject *_wrap_Ldb_modify(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
ldb *arg1 = (ldb *) 0 ;
@@ -5729,7 +5659,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"Ldb_delete", (PyCFunction) _wrap_Ldb_delete, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Ldb_rename", (PyCFunction) _wrap_Ldb_rename, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Ldb_parse_control_strings", (PyCFunction) _wrap_Ldb_parse_control_strings, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Ldb_add", _wrap_Ldb_add, METH_VARARGS, NULL},
+ { (char *)"Ldb_add", (PyCFunction) _wrap_Ldb_add, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Ldb_modify", (PyCFunction) _wrap_Ldb_modify, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Ldb_get_config_basedn", (PyCFunction)_wrap_Ldb_get_config_basedn, METH_O, NULL},
{ (char *)"Ldb_get_root_basedn", (PyCFunction)_wrap_Ldb_get_root_basedn, METH_O, NULL},
diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c
index c4de8e8da8..65c044c0f4 100644
--- a/source4/lib/ldb/modules/rdn_name.c
+++ b/source4/lib/ldb/modules/rdn_name.c
@@ -119,7 +119,8 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
"RDN mismatch on %s: %s (%s)",
ldb_dn_get_linearized(msg->dn), rdn_name, rdn_val.data);
talloc_free(down_req);
- return LDB_ERR_OPERATIONS_ERROR;
+ /* Match AD's error here */
+ return LDB_ERR_INVALID_DN_SYNTAX;
}
}
diff --git a/source4/lib/ldb/tools/config.mk b/source4/lib/ldb/tools/config.mk
index bf6c5f963c..02ad84ae25 100644
--- a/source4/lib/ldb/tools/config.mk
+++ b/source4/lib/ldb/tools/config.mk
@@ -17,10 +17,11 @@ OBJ_FILES = \
ldbadd.o
PRIVATE_DEPENDENCIES = \
LIBLDB_CMDLINE LIBCLI_RESOLVE
-MANPAGE = ../man/ldbadd.1
# End BINARY ldbadd
################################################
+MANPAGES += $(ldbdir)/man/ldbadd.1
+
################################################
# Start BINARY ldbdel
[BINARY::ldbdel]
@@ -29,10 +30,11 @@ OBJ_FILES= \
ldbdel.o
PRIVATE_DEPENDENCIES = \
LIBLDB_CMDLINE
-MANPAGE = ../man/ldbdel.1
# End BINARY ldbdel
################################################
+MANPAGES += $(ldbdir)/man/ldbdel.1
+
################################################
# Start BINARY ldbmodify
[BINARY::ldbmodify]
@@ -41,10 +43,11 @@ OBJ_FILES= \
ldbmodify.o
PRIVATE_DEPENDENCIES = \
LIBLDB_CMDLINE
-MANPAGE = ../man/ldbmodify.1
# End BINARY ldbmodify
################################################
+MANPAGES += $(ldbdir)/man/ldbmodify.1
+
################################################
# Start BINARY ldbsearch
[BINARY::ldbsearch]
@@ -53,10 +56,11 @@ OBJ_FILES= \
ldbsearch.o
PRIVATE_DEPENDENCIES = \
LIBLDB_CMDLINE
-MANPAGE = ../man/ldbsearch.1
# End BINARY ldbsearch
################################################
+MANPAGES += $(ldbdir)/man/ldbsearch.1
+
################################################
# Start BINARY ldbedit
[BINARY::ldbedit]
@@ -65,10 +69,11 @@ OBJ_FILES= \
ldbedit.o
PRIVATE_DEPENDENCIES = \
LIBLDB_CMDLINE
-MANPAGE = ../man/ldbedit.1
# End BINARY ldbedit
################################################
+MANPAGES += $(ldbdir)/man/ldbedit.1
+
################################################
# Start BINARY ldbrename
[BINARY::ldbrename]
@@ -77,8 +82,9 @@ OBJ_FILES= \
ldbrename.o
PRIVATE_DEPENDENCIES = \
LIBLDB_CMDLINE
-MANPAGE = ../man/ldbrename.1
# End BINARY ldbrename
################################################
+MANPAGES += $(ldbdir)/man/ldbrename.1
+
diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk
index b46f7c3ee7..81b0ef36fd 100644
--- a/source4/lib/nss_wrapper/config.mk
+++ b/source4/lib/nss_wrapper/config.mk
@@ -1,7 +1,8 @@
##############################
# Start SUBSYSTEM NSS_WRAPPER
[SUBSYSTEM::NSS_WRAPPER]
-PUBLIC_HEADERS = nss_wrapper.h
OBJ_FILES = nss_wrapper.o
# End SUBSYSTEM NSS_WRAPPER
##############################
+
+PUBLIC_HEADERS += lib/nss_wrapper/nss_wrapper.h
diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk
index 7a9c8fcff1..b2d7ce202e 100644
--- a/source4/lib/registry/config.mk
+++ b/source4/lib/registry/config.mk
@@ -36,10 +36,11 @@ OBJ_FILES = \
PUBLIC_DEPENDENCIES = \
LIBSAMBA-UTIL CHARSET TDR_REGF LIBLDB \
RPC_NDR_WINREG LDB_WRAP
-PUBLIC_HEADERS = registry.h hive.h patchfile.h
# End MODULE registry_ldb
################################################
+PUBLIC_HEADERS += $(addprefix lib/registry/, registry.h hive.h patchfile.h)
+
[SUBSYSTEM::registry_common]
PUBLIC_DEPENDENCIES = registry
OBJ_FILES = tools/common.o
@@ -52,10 +53,11 @@ INSTALLDIR = BINDIR
OBJ_FILES = tools/regdiff.o
PRIVATE_DEPENDENCIES = \
LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS
-MANPAGE = man/regdiff.1
# End BINARY regdiff
################################################
+MANPAGES += lib/registry/man/regdiff.1
+
################################################
# Start BINARY regpatch
[BINARY::regpatch]
@@ -64,10 +66,11 @@ OBJ_FILES = tools/regpatch.o
PRIVATE_DEPENDENCIES = \
LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS \
registry_common
-MANPAGE = man/regpatch.1
# End BINARY regpatch
################################################
+MANPAGES += lib/registry/man/regpatch.1
+
################################################
# Start BINARY regshell
[BINARY::regshell]
@@ -76,10 +79,11 @@ OBJ_FILES = tools/regshell.o
PRIVATE_DEPENDENCIES = \
LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \
SMBREADLINE registry_common
-MANPAGE = man/regshell.1
# End BINARY regshell
################################################
+MANPAGES += lib/registry/man/regshell.1
+
################################################
# Start BINARY regtree
[BINARY::regtree]
@@ -88,10 +92,11 @@ OBJ_FILES = tools/regtree.o
PRIVATE_DEPENDENCIES = \
LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \
registry_common
-MANPAGE = man/regtree.1
# End BINARY regtree
################################################
+MANPAGES += lib/registry/man/regtree.1
+
[SUBSYSTEM::torture_registry]
PRIVATE_DEPENDENCIES = registry
PRIVATE_PROTO_HEADER = tests/proto.h
diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c
index 5d56a30b3e..ad6a6421ab 100644
--- a/source4/lib/registry/hive.c
+++ b/source4/lib/registry/hive.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "hive.h"
#include "system/filesys.h"
+#include "param/param.h"
/** Open a registry file/host/etc */
_PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
@@ -52,7 +53,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
if (!strncmp(peek, "regf", 4)) {
close(fd);
- return reg_open_regf_file(parent_ctx, location, lp_ctx, root);
+ return reg_open_regf_file(parent_ctx, location, lp_iconv_convenience(lp_ctx), root);
} else if (!strncmp(peek, "TDB file", 8)) {
close(fd);
return reg_open_ldb_file(parent_ctx, location, session_info,
diff --git a/source4/lib/registry/hive.h b/source4/lib/registry/hive.h
index 6d9a69c7c5..87f335663d 100644
--- a/source4/lib/registry/hive.h
+++ b/source4/lib/registry/hive.h
@@ -188,7 +188,7 @@ WERROR hive_key_flush(struct hive_key *key);
WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
const char *location, struct hive_key **key);
WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
- const char *location, struct loadparm_context *lp_ctx,
+ const char *location, struct smb_iconv_convenience *iconv_convenience,
struct hive_key **key);
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
@@ -200,6 +200,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
const char *location, struct hive_key **key);
WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
const char *location,
int major_version,
struct hive_key **key);
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 31b78d8246..a764ca6235 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -36,7 +36,9 @@ struct ldb_key_data
int subkey_count, value_count;
};
-static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
+static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
+ struct ldb_message *msg,
const char **name, uint32_t *type,
DATA_BLOB *data)
{
@@ -57,7 +59,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
{
case REG_SZ:
case REG_EXPAND_SZ:
- data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF8, CH_UTF16,
+ data->length = convert_string_talloc(mem_ctx, iconv_convenience, CH_UTF8, CH_UTF16,
val->data, val->length,
(void **)&data->data);
break;
@@ -281,7 +283,7 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct hive_key *k,
if (idx >= kd->value_count)
return WERR_NO_MORE_ITEMS;
- reg_ldb_unpack_value(mem_ctx, kd->values[idx],
+ reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), kd->values[idx],
name, data_type, data);
return WERR_OK;
@@ -310,7 +312,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k,
if (res->count == 0)
return WERR_BADFILE;
- reg_ldb_unpack_value(mem_ctx, res->msgs[0], NULL, data_type, data);
+ reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), res->msgs[0], NULL, data_type, data);
return WERR_OK;
}
@@ -696,7 +698,9 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
if (max_valbufsize != NULL) {
DATA_BLOB data;
- reg_ldb_unpack_value(mem_ctx, kd->values[i], NULL,
+ reg_ldb_unpack_value(mem_ctx,
+ lp_iconv_convenience(global_loadparm),
+ kd->values[i], NULL,
NULL, &data);
*max_valbufsize = MAX(*max_valbufsize, data.length);
talloc_free(data.data);
diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c
index a4579010cd..687fd4b91b 100644
--- a/source4/lib/registry/patchfile.c
+++ b/source4/lib/registry/patchfile.c
@@ -27,6 +27,7 @@
_PUBLIC_ WERROR reg_preg_diff_load(int fd,
+ struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
@@ -273,6 +274,7 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
* Load diff file
*/
_PUBLIC_ WERROR reg_diff_load(const char *filename,
+ struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data)
{
@@ -305,10 +307,10 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename,
#endif
if (strncmp(hdr, "PReg", 4) == 0) {
/* Must be a GPO Registry.pol file */
- return reg_preg_diff_load(fd, callbacks, callback_data);
+ return reg_preg_diff_load(fd, iconv_convenience, callbacks, callback_data);
} else {
/* Must be a normal .REG file */
- return reg_dotreg_diff_load(fd, lp_iconv_convenience(global_loadparm), callbacks, callback_data);
+ return reg_dotreg_diff_load(fd, iconv_convenience, callbacks, callback_data);
}
}
@@ -442,5 +444,6 @@ _PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx, const char *filenam
callbacks.del_all_values = reg_diff_apply_del_all_values;
callbacks.done = NULL;
- return reg_diff_load(filename, &callbacks, ctx);
+ return reg_diff_load(filename, lp_iconv_convenience(global_loadparm),
+ &callbacks, ctx);
}
diff --git a/source4/lib/registry/patchfile.h b/source4/lib/registry/patchfile.h
index 08a977d9cd..9289390685 100644
--- a/source4/lib/registry/patchfile.h
+++ b/source4/lib/registry/patchfile.h
@@ -43,6 +43,7 @@ WERROR reg_generate_diff(struct registry_context *ctx1,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
+ struct smb_iconv_convenience *iconv_convenience,
struct reg_diff_callbacks **callbacks,
void **callback_data);
WERROR reg_generate_diff_key(struct registry_key *oldkey,
diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c
index 46ea7c0008..6de642ecb8 100644
--- a/source4/lib/registry/patchfile_dotreg.c
+++ b/source4/lib/registry/patchfile_dotreg.c
@@ -101,6 +101,7 @@ static WERROR reg_dotreg_diff_del_all_values(void *callback_data,
* Save registry diff
*/
_PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
+ struct smb_iconv_convenience *iconv_convenience,
struct reg_diff_callbacks **callbacks,
void **callback_data)
{
@@ -109,7 +110,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
data = talloc_zero(ctx, struct dotreg_data);
*callback_data = data;
- data->iconv_convenience = lp_iconv_convenience(global_loadparm);
+ data->iconv_convenience = iconv_convenience;
if (filename) {
data->fd = open(filename, O_CREAT, 0755);
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 9cc9a5dec2..0d39e67450 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -29,14 +29,14 @@ struct preg_data {
int fd;
};
-static WERROR preg_read_utf16(int fd, char *c)
+static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c)
{
uint16_t v;
if (read(fd, &v, 2) < 2) {
return WERR_GENERAL_FAILURE;
}
- push_codepoint(lp_iconv_convenience(global_loadparm), c, v);
+ push_codepoint(ic, c, v);
return WERR_OK;
}
@@ -123,6 +123,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
* Load diff file
*/
_PUBLIC_ WERROR reg_preg_diff_load(int fd,
+ struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data)
{
@@ -162,7 +163,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
while(1) {
uint32_t value_type, length;
- if (!W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr))) {
+ if (!W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr))) {
break;
}
if (*buf_ptr != '[') {
@@ -173,7 +174,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
/* Get the path */
buf_ptr = buf;
- while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+ while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr != ';' && buf_ptr-buf < buf_size) {
buf_ptr++;
}
@@ -181,7 +182,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
/* Get the name */
buf_ptr = buf;
- while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+ while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr != ';' && buf_ptr-buf < buf_size) {
buf_ptr++;
}
@@ -195,7 +196,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
}
/* Read past delimiter */
buf_ptr = buf;
- if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+ if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr == ';') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Error in PReg file.\n"));
ret = WERR_GENERAL_FAILURE;
@@ -209,7 +210,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
}
/* Read past delimiter */
buf_ptr = buf;
- if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+ if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr == ';') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Error in PReg file.\n"));
ret = WERR_GENERAL_FAILURE;
@@ -227,7 +228,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
/* Check if delimiter is in place (whine if it isn't) */
buf_ptr = buf;
- if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+ if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr == ']') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Warning: Missing ']' in PReg file, expected ']', got '%c' 0x%x.\n",
*buf_ptr, *buf_ptr));
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 6a35799a7e..a192f3be4d 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -1908,7 +1908,9 @@ static WERROR regf_save_hbin(struct regf_data *regf)
return WERR_OK;
}
-WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
+WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
+ const char *location,
int minor_version, struct hive_key **key)
{
struct regf_data *regf;
@@ -1919,7 +1921,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
- regf->iconv_convenience = lp_iconv_convenience(global_loadparm);
+ regf->iconv_convenience = iconv_convenience;
W_ERROR_HAVE_NO_MEMORY(regf);
@@ -1995,7 +1997,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
}
WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
- struct loadparm_context *lp_ctx, struct hive_key **key)
+ struct smb_iconv_convenience *iconv_convenience, struct hive_key **key)
{
struct regf_data *regf;
struct regf_hdr *regf_hdr;
@@ -2004,7 +2006,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
- regf->iconv_convenience = lp_iconv_convenience(lp_ctx);
+ regf->iconv_convenience = iconv_convenience;
W_ERROR_HAVE_NO_MEMORY(regf);
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index 915782694f..1e56f125c5 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -25,6 +25,7 @@
#include "torture/torture.h"
#include "librpc/gen_ndr/winreg.h"
#include "system/filesys.h"
+#include "param/param.h"
static bool test_del_nonexistant_key(struct torture_context *tctx,
const void *test_data)
@@ -386,7 +387,8 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data)
rmdir(dirname);
- error = reg_create_regf_file(tctx, dirname, 5, &key);
+ error = reg_create_regf_file(tctx, lp_iconv_convenience(tctx->lp_ctx),
+ dirname, 5, &key);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to create new regf file\n");
return false;
diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c
index 406eaeea3d..c94380efd2 100644
--- a/source4/lib/registry/tools/regdiff.c
+++ b/source4/lib/registry/tools/regdiff.c
@@ -126,7 +126,7 @@ int main(int argc, const char **argv)
poptFreeContext(pc);
- error = reg_dotreg_diff_save(ctx, outputfile, &callbacks,
+ error = reg_dotreg_diff_save(ctx, outputfile, lp_iconv_convenience(cmdline_lp_ctx), &callbacks,
&callback_data);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Problem saving registry diff to '%s': %s\n",
diff --git a/source4/lib/replace/Makefile.in b/source4/lib/replace/Makefile.in
index 30f39ac6cb..c989835a8d 100644
--- a/source4/lib/replace/Makefile.in
+++ b/source4/lib/replace/Makefile.in
@@ -10,6 +10,7 @@ VPATH = @libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
INSTALL = @INSTALL@
+LIBS = @LIBS@
.PHONY: test all showflags install installcheck clean distclean realdistclean
@@ -25,6 +26,7 @@ showflags:
@echo ' CC = $(CC)'
@echo ' CFLAGS = $(CFLAGS)'
@echo ' LDFLAGS= $(LDFLAGS)'
+ @echo ' LIBS = $(LIBS)'
install: all
mkdir -p $(libdir)
@@ -38,10 +40,10 @@ test: all
installcheck: install test
-TEST_OBJS = test/testsuite.o test/os2_delete.o test/strptime.o
+TEST_OBJS = test/testsuite.o test/os2_delete.o test/strptime.o test/getifaddrs.o
testsuite: libreplace.a $(TEST_OBJS)
- $(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS)
+ $(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) $(LIBS)
.c.o:
@echo Compiling $*.c
diff --git a/source4/lib/replace/configure.ac b/source4/lib/replace/configure.ac
index beeb77e152..f5e054f476 100644
--- a/source4/lib/replace/configure.ac
+++ b/source4/lib/replace/configure.ac
@@ -3,6 +3,8 @@ AC_INIT(replace.c)
AC_CONFIG_SRCDIR([replace.c])
AC_CONFIG_HEADER(config.h)
+CFLAGS="$CFLAGS -I$srcdir"
+
AC_LIBREPLACE_ALL_CHECKS
if test "$ac_cv_prog_gcc" = yes; then
diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c
index 053657475d..f6f0ec080c 100644
--- a/source4/lib/replace/getifaddrs.c
+++ b/source4/lib/replace/getifaddrs.c
@@ -44,13 +44,14 @@
void rep_freeifaddrs(struct ifaddrs *ifp)
{
- free(ifp->ifa_name);
- free(ifp->ifa_addr);
- free(ifp->ifa_netmask);
- free(ifp->ifa_dstaddr);
- if (ifp->ifa_next != NULL)
+ if (ifp != NULL) {
+ free(ifp->ifa_name);
+ free(ifp->ifa_addr);
+ free(ifp->ifa_netmask);
+ free(ifp->ifa_dstaddr);
freeifaddrs(ifp->ifa_next);
- free(ifp);
+ free(ifp);
+ }
}
static struct sockaddr *sockaddr_dup(struct sockaddr *sa)
@@ -109,38 +110,33 @@ int rep_getifaddrs(struct ifaddrs **ifap)
/* Loop through interfaces, looking for given IP address */
for (i=n-1; i>=0; i--) {
- if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != 0) {
+ if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) == -1) {
freeifaddrs(*ifap);
+ return -1;
}
curif = calloc(1, sizeof(struct ifaddrs));
- if (lastif == NULL) {
- *ifap = curif;
- } else {
- lastif->ifa_next = curif;
- }
-
curif->ifa_name = strdup(ifr[i].ifr_name);
- curif->ifa_addr = sockaddr_dup(&ifr[i].ifr_addr);
+ curif->ifa_flags = ifr[i].ifr_flags;
curif->ifa_dstaddr = NULL;
curif->ifa_data = NULL;
curif->ifa_next = NULL;
- curif->ifa_netmask = NULL;
- if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) != 0) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif->ifa_flags = ifr[i].ifr_flags;
-
- if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != 0) {
- freeifaddrs(*ifap);
- return -1;
- }
+ curif->ifa_addr = NULL;
+ if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != -1) {
+ curif->ifa_addr = sockaddr_dup(&ifr[i].ifr_addr);
+ }
- curif->ifa_netmask = sockaddr_dup(&ifr[i].ifr_addr);
+ curif->ifa_netmask = NULL;
+ if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != -1) {
+ curif->ifa_netmask = sockaddr_dup(&ifr[i].ifr_addr);
+ }
+ if (lastif == NULL) {
+ *ifap = curif;
+ } else {
+ lastif->ifa_next = curif;
+ }
lastif = curif;
}
@@ -363,32 +359,3 @@ int rep_getifaddrs(struct ifaddrs **ifap)
return -1;
}
#endif
-
-#ifdef AUTOCONF_TEST
-/* this is the autoconf driver to test getifaddrs() */
-
- int main()
-{
- struct ifaddrs *ifs = NULL;
- int ret;
-
- ret = getifaddrs(&ifs);
- if (ret != 0) {
- perror("getifaddrs() failed");
- return 1;
- }
-
- while (ifs) {
- printf("%-10s ", ifs->ifa_name);
- if (ifs->ifa_addr != NULL &&
- ifs->ifa_addr->sa_family == AF_INET) {
- printf("IP=%s ", inet_ntoa(((struct sockaddr_in *)ifs->ifa_addr)->sin_addr));
- if (ifs->ifa_netmask != NULL)
- printf("NETMASK=%s", inet_ntoa(((struct sockaddr_in *)ifs->ifa_netmask)->sin_addr));
- }
- printf("\n");
- ifs = ifs->ifa_next;
- }
- return 0;
-}
-#endif
diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4
index dd2a95cb81..6cca155de3 100644
--- a/source4/lib/replace/getifaddrs.m4
+++ b/source4/lib/replace/getifaddrs.m4
@@ -49,7 +49,11 @@ AC_TRY_RUN([
#define AUTOCONF_TEST 1
#define SOCKET_WRAPPER_NOT_REPLACE
#include "$libreplacedir/replace.c"
-#include "$libreplacedir/getifaddrs.c"],
+#include "$libreplacedir/inet_ntop.c"
+#include "$libreplacedir/snprintf.c"
+#include "$libreplacedir/getifaddrs.c"
+#define getifaddrs_test main
+#include "$libreplacedir/test/getifaddrs.c"],
libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)])
if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then
iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available])
@@ -67,10 +71,15 @@ AC_TRY_RUN([
#undef _XOPEN_SOURCE_EXTENDED
#define SOCKET_WRAPPER_NOT_REPLACE
#include "$libreplacedir/replace.c"
-#include "$libreplacedir/getifaddrs.c"],
+#include "$libreplacedir/inet_ntop.c"
+#include "$libreplacedir/snprintf.c"
+#include "$libreplacedir/getifaddrs.c"
+#define getifaddrs_test main
+#include "$libreplacedir/test/getifaddrs.c"],
libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)])
if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then
iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
+ old_LIBS="$old_LIBS $LIBS"
fi
fi
@@ -83,10 +92,15 @@ AC_TRY_RUN([
#define AUTOCONF_TEST 1
#define SOCKET_WRAPPER_NOT_REPLACE
#include "$libreplacedir/replace.c"
-#include "$libreplacedir/getifaddrs.c"],
+#include "$libreplacedir/inet_ntop.c"
+#include "$libreplacedir/snprintf.c"
+#include "$libreplacedir/getifaddrs.c"
+#define getifaddrs_test main
+#include "$libreplacedir/test/getifaddrs.c"],
libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)])
if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then
iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
+ old_LIBS="$old_LIBS $LIBS"
fi
fi
@@ -98,10 +112,15 @@ AC_TRY_RUN([
#define AUTOCONF_TEST 1
#define SOCKET_WRAPPER_NOT_REPLACE
#include "$libreplacedir/replace.c"
-#include "$libreplacedir/getifaddrs.c"],
+#include "$libreplacedir/inet_ntop.c"
+#include "$libreplacedir/snprintf.c"
+#include "$libreplacedir/getifaddrs.c"
+#define getifaddrs_test main
+#include "$libreplacedir/test/getifaddrs.c"],
libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)])
if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then
iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
+ old_LIBS="$old_LIBS $LIBS"
fi
fi
diff --git a/source4/lib/replace/test/getifaddrs.c b/source4/lib/replace/test/getifaddrs.c
new file mode 100644
index 0000000000..8b00ac2f40
--- /dev/null
+++ b/source4/lib/replace/test/getifaddrs.c
@@ -0,0 +1,100 @@
+/*
+ * Unix SMB/CIFS implementation.
+ *
+ * libreplace getifaddrs test
+ *
+ * Copyright (C) Michael Adam <obnox@samba.org> 2008
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AUTOCONF_TEST
+#include "replace.h"
+#include "system/network.h"
+#endif
+
+#ifdef HAVE_INET_NTOP
+#define rep_inet_ntop inet_ntop
+#endif
+
+static const char *format_sockaddr(struct sockaddr *addr,
+ char *addrstring,
+ socklen_t addrlen)
+{
+ const char *result = NULL;
+
+ if (addr->sa_family == AF_INET) {
+ result = rep_inet_ntop(AF_INET,
+ &((struct sockaddr_in *)addr)->sin_addr,
+ addrstring,
+ addrlen);
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
+ } else if (addr->sa_family == AF_INET6) {
+ result = rep_inet_ntop(AF_INET6,
+ &((struct sockaddr_in6 *)addr)->sin6_addr,
+ addrstring,
+ addrlen);
+#endif
+ }
+ return result;
+}
+
+int getifaddrs_test(void)
+{
+ struct ifaddrs *ifs = NULL;
+ struct ifaddrs *ifs_head = NULL;
+ int ret;
+
+ ret = getifaddrs(&ifs);
+ ifs_head = ifs;
+ if (ret != 0) {
+ fprintf(stderr, "getifaddrs() failed: %s\n", strerror(errno));
+ return 1;
+ }
+
+ while (ifs) {
+ printf("%-10s ", ifs->ifa_name);
+ if (ifs->ifa_addr != NULL) {
+ char addrstring[INET6_ADDRSTRLEN];
+ const char *result;
+
+ result = format_sockaddr(ifs->ifa_addr,
+ addrstring,
+ sizeof(addrstring));
+ if (result != NULL) {
+ printf("IP=%s ", addrstring);
+ }
+
+ if (ifs->ifa_netmask != NULL) {
+ result = format_sockaddr(ifs->ifa_netmask,
+ addrstring,
+ sizeof(addrstring));
+ if (result != NULL) {
+ printf("NETMASK=%s", addrstring);
+ }
+ } else {
+ printf("AF=%d ", ifs->ifa_addr->sa_family);
+ }
+ } else {
+ printf("<no address>");
+ }
+
+ printf("\n");
+ ifs = ifs->ifa_next;
+ }
+
+ freeifaddrs(ifs_head);
+
+ return 0;
+}
diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c
index c9f3301005..b538360365 100644
--- a/source4/lib/replace/test/testsuite.c
+++ b/source4/lib/replace/test/testsuite.c
@@ -856,21 +856,18 @@ static int test_strptime(void)
return libreplace_test_strptime();
}
+extern int getifaddrs_test(void);
+
static int test_getifaddrs(void)
{
- struct ifaddrs *ifa;
- int ret;
printf("test: getifaddrs\n");
- ret = getifaddrs(&ifa);
- if (ret != 0) {
+ if (getifaddrs_test() != 0) {
printf("failure: getifaddrs\n");
return false;
}
- freeifaddrs(ifa);
-
printf("success: getifaddrs\n");
return true;
}
diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk
index 4c5cf94348..cc52a99801 100644
--- a/source4/lib/socket_wrapper/config.mk
+++ b/source4/lib/socket_wrapper/config.mk
@@ -1,8 +1,9 @@
##############################
# Start SUBSYSTEM SOCKET_WRAPPER
[SUBSYSTEM::SOCKET_WRAPPER]
-PUBLIC_HEADERS = socket_wrapper.h
OBJ_FILES = socket_wrapper.o
PRIVATE_DEPENDENCIES = EXT_SOCKET
# End SUBSYSTEM SOCKET_WRAPPER
##############################
+
+PUBLIC_HEADERS += lib/socket_wrapper/socket_wrapper.h
diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk
index af1b590c98..33241ffac7 100644
--- a/source4/lib/talloc/config.mk
+++ b/source4/lib/talloc/config.mk
@@ -1,6 +1,8 @@
[LIBRARY::LIBTALLOC]
OUTPUT_TYPE = STATIC_LIBRARY
OBJ_FILES = talloc.o
-MANPAGE = talloc.3
CFLAGS = -Ilib/talloc
-PUBLIC_HEADERS = talloc.h
+
+
+MANPAGES += $(tallocdir)/talloc.3
+PUBLIC_HEADERS += $(tallocdir)/talloc.h
diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk
index 89d6af9043..c69804fa13 100644
--- a/source4/lib/tdb/config.mk
+++ b/source4/lib/tdb/config.mk
@@ -7,11 +7,12 @@ OBJ_FILES = \
common/open.o common/traverse.o common/freelist.o \
common/error.o common/transaction.o
CFLAGS = -Ilib/tdb/include
-PUBLIC_HEADERS = include/tdb.h
#
# End SUBSYSTEM ldb
################################################
+PUBLIC_HEADERS += $(tdbdir)/include/tdb.h
+
################################################
# Start BINARY tdbtool
[BINARY::tdbtool]
diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk
index b8473e5ba8..eb3cde9bdf 100644
--- a/source4/lib/tdr/config.mk
+++ b/source4/lib/tdr/config.mk
@@ -1,6 +1,7 @@
[SUBSYSTEM::TDR]
CFLAGS = -Ilib/tdr
-PUBLIC_HEADERS = tdr.h
-PUBLIC_PROTO_HEADER = tdr_proto.h
+PRIVATE_PROTO_HEADER = tdr_proto.h
PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL
OBJ_FILES = tdr.o
+
+PUBLIC_HEADERS += lib/tdr/tdr.h
diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk
index f3e6cd7acf..16a0357df8 100644
--- a/source4/lib/util/config.mk
+++ b/source4/lib/util/config.mk
@@ -1,15 +1,6 @@
[SUBSYSTEM::LIBSAMBA-UTIL]
#VERSION = 0.0.1
#SO_VERSION = 0
-PUBLIC_HEADERS = util.h \
- attr.h \
- byteorder.h \
- data_blob.h \
- debug.h \
- mutex.h \
- safe_string.h \
- time.h \
- xfile.h
OBJ_FILES = xfile.o \
debug.o \
fault.o \
@@ -33,11 +24,22 @@ PUBLIC_DEPENDENCIES = \
SOCKET_WRAPPER EXT_NSL \
CHARSET EXECINFO
+PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
+ attr.h \
+ byteorder.h \
+ data_blob.h \
+ debug.h \
+ mutex.h \
+ safe_string.h \
+ time.h \
+ xfile.h)
+
[SUBSYSTEM::ASN1_UTIL]
-PUBLIC_PROTO_HEADER = asn1_proto.h
-PUBLIC_HEADERS = asn1.h
+PRIVATE_PROTO_HEADER = asn1_proto.h
OBJ_FILES = asn1.o
+PUBLIC_HEADERS += lib/util/asn1.h
+
[SUBSYSTEM::UNIX_PRIVS]
PRIVATE_PROTO_HEADER = unix_privs.h
OBJ_FILES = unix_privs.o
@@ -45,7 +47,7 @@ OBJ_FILES = unix_privs.o
################################################
# Start SUBSYSTEM WRAP_XATTR
[SUBSYSTEM::WRAP_XATTR]
-PUBLIC_PROTO_HEADER = wrap_xattr.h
+PRIVATE_PROTO_HEADER = wrap_xattr.h
OBJ_FILES = \
wrap_xattr.o
PUBLIC_DEPENDENCIES = XATTR
@@ -54,13 +56,13 @@ PUBLIC_DEPENDENCIES = XATTR
################################################
[SUBSYSTEM::UTIL_TDB]
-PUBLIC_PROTO_HEADER = util_tdb.h
+PRIVATE_PROTO_HEADER = util_tdb.h
OBJ_FILES = \
util_tdb.o
PUBLIC_DEPENDENCIES = LIBTDB
[SUBSYSTEM::UTIL_LDB]
-PUBLIC_PROTO_HEADER = util_ldb.h
+PRIVATE_PROTO_HEADER = util_ldb.h
OBJ_FILES = \
util_ldb.o
PUBLIC_DEPENDENCIES = LIBLDB