summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/basic.mk2
-rw-r--r--source4/lib/charset/charcnv.c2
-rw-r--r--source4/lib/charset/charset.h68
-rw-r--r--source4/lib/charset/iconv.c8
-rw-r--r--source4/lib/charset/util_unistr.c6
-rw-r--r--source4/lib/events/config.mk2
-rw-r--r--source4/lib/nss_wrapper/config.mk2
-rw-r--r--source4/lib/registry/config.mk2
-rw-r--r--source4/lib/registry/dir.c2
-rw-r--r--source4/lib/registry/hive.c2
-rw-r--r--source4/lib/registry/hive.h209
-rw-r--r--source4/lib/registry/patchfile.c1
-rw-r--r--source4/lib/registry/patchfile.h55
-rw-r--r--source4/lib/registry/patchfile_dotreg.c1
-rw-r--r--source4/lib/registry/patchfile_preg.c1
-rw-r--r--source4/lib/registry/regf.c2
-rw-r--r--source4/lib/registry/registry.h214
-rw-r--r--source4/lib/registry/registry.i1
-rw-r--r--source4/lib/registry/registry_wrap.c1
-rw-r--r--source4/lib/registry/tests/generic.c2
-rw-r--r--source4/lib/registry/tools/regpatch.c1
-rw-r--r--source4/lib/socket_wrapper/config.mk2
-rw-r--r--source4/lib/talloc/config.mk1
-rw-r--r--source4/lib/tdb/config.mk2
-rw-r--r--source4/lib/util/config.mk5
-rw-r--r--source4/lib/util/data_blob.h4
-rw-r--r--source4/lib/util/dprintf.c6
-rw-r--r--source4/lib/util/util_file.c4
-rw-r--r--source4/lib/util/util_ldb.c4
-rw-r--r--source4/lib/util/util_ldb.h27
-rw-r--r--source4/lib/util/wrap_xattr.h12
31 files changed, 344 insertions, 307 deletions
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index d059bdf49b..d6e90928b0 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -26,7 +26,7 @@ OBJ_FILES = gencache/gencache.o
PRIVATE_DEPENDENCIES = TDB_WRAP
-PUBLIC_HEADERS += lib/gencache/gencache.h
+# PUBLIC_HEADERS += lib/gencache/gencache.h
[SUBSYSTEM::LDB_WRAP]
OBJ_FILES = ldb_wrap.o
diff --git a/source4/lib/charset/charcnv.c b/source4/lib/charset/charcnv.c
index 0465be689e..3e384304cf 100644
--- a/source4/lib/charset/charcnv.c
+++ b/source4/lib/charset/charcnv.c
@@ -83,7 +83,7 @@ static int close_iconv(struct smb_iconv_convenience *data)
return 0;
}
-struct smb_iconv_convenience *smb_iconv_convenience_init(TALLOC_CTX *mem_ctx,
+_PUBLIC_ struct smb_iconv_convenience *smb_iconv_convenience_init(TALLOC_CTX *mem_ctx,
const char *dos_charset,
const char *unix_charset,
bool native_iconv)
diff --git a/source4/lib/charset/charset.h b/source4/lib/charset/charset.h
index 1d42a0ad91..baa7df532b 100644
--- a/source4/lib/charset/charset.h
+++ b/source4/lib/charset/charset.h
@@ -18,6 +18,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/* This is a public header file that is installed as part of Samba.
+ * If you remove any functions or change their signature, update
+ * the so version number. */
+
#ifndef __CHARSET_H__
#define __CHARSET_H__
@@ -74,11 +78,71 @@ struct loadparm_context;
struct smb_iconv_convenience;
extern struct smb_iconv_convenience *global_smb_iconv_convenience;
-#include "lib/charset/charset_proto.h"
-
/* replace some string functions with multi-byte
versions */
#define strlower(s) strlower_m(s)
#define strupper(s) strupper_m(s)
+char *strchr_m(const char *s, char c);
+size_t strlen_m_term(const char *s);
+size_t strlen_m(const char *s);
+char *alpha_strcpy(char *dest, const char *src, const char *other_safe_chars, size_t maxlength);
+void string_replace_w(char *s, char oldc, char newc);
+bool strcsequal_w(const char *s1,const char *s2);
+bool strequal_w(const char *s1, const char *s2);
+int strncasecmp_m(const char *s1, const char *s2, size_t n);
+bool next_token(const char **ptr,char *buff, const char *sep, size_t bufsize);
+int strcasecmp_m(const char *s1, const char *s2);
+size_t count_chars_w(const char *s, char c);
+void strupper_m(char *s);
+void strlower_m(char *s);
+char *strupper_talloc(TALLOC_CTX *ctx, const char *src);
+char *strlower_talloc(TALLOC_CTX *ctx, const char *src);
+bool strhasupper(const char *string);
+bool strhaslower(const char *string);
+char *strrchr_m(const char *s, char c);
+char *strchr_m(const char *s, char c);
+
+/* codepoints */
+codepoint_t next_codepoint(struct smb_iconv_convenience *ic,
+ const char *str, size_t *size);
+ssize_t push_codepoint(struct smb_iconv_convenience *ic,
+ char *str, codepoint_t c);
+codepoint_t toupper_w(codepoint_t val);
+codepoint_t tolower_w(codepoint_t val);
+int codepoint_cmpi(codepoint_t c1, codepoint_t c2);
+ssize_t push_string(struct smb_iconv_convenience *ic, void *dest, const char *src, size_t dest_len, int flags);
+ssize_t pull_string(struct smb_iconv_convenience *ic,
+ char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
+ssize_t convert_string(struct smb_iconv_convenience *ic,
+ charset_t from, charset_t to,
+ void const *src, size_t srclen,
+ void *dest, size_t destlen);
+ssize_t convert_string_talloc_descriptor(TALLOC_CTX *ctx, smb_iconv_t descriptor, void const *src, size_t srclen, void **dest);
+ssize_t convert_string_talloc(TALLOC_CTX *ctx,
+ struct smb_iconv_convenience *ic,
+ charset_t from, charset_t to,
+ void const *src, size_t srclen,
+ void **dest);
+ssize_t push_ascii_talloc(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, char **dest, const char *src);
+ssize_t push_ucs2_talloc(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, void **dest, const char *src);
+ssize_t push_utf8_talloc(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, char **dest, const char *src);
+ssize_t pull_ascii_talloc(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, char **dest, const char *src);
+ssize_t pull_ucs2_talloc(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, char **dest, const void *src);
+ssize_t pull_utf8_talloc(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, char **dest, const char *src);
+
+/* iconv */
+smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode);
+int smb_iconv_close(smb_iconv_t cd);
+size_t smb_iconv(smb_iconv_t cd,
+ const char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
+ const char *fromcode, bool native_iconv);
+
+/* iconv convenience */
+struct smb_iconv_convenience *smb_iconv_convenience_init(TALLOC_CTX *mem_ctx,
+ const char *dos_charset,
+ const char *unix_charset,
+ bool native_iconv);
#endif /* __CHARSET_H__ */
diff --git a/source4/lib/charset/iconv.c b/source4/lib/charset/iconv.c
index db212a83c4..4f4bc8fd2d 100644
--- a/source4/lib/charset/iconv.c
+++ b/source4/lib/charset/iconv.c
@@ -113,7 +113,7 @@ static size_t sys_iconv(void *cd,
* It only knows about a very small number of character sets - just
* enough that Samba works on systems that don't have iconv.
**/
-size_t smb_iconv(smb_iconv_t cd,
+_PUBLIC_ size_t smb_iconv(smb_iconv_t cd,
const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
@@ -156,7 +156,7 @@ static bool is_utf16(const char *name)
-smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
+_PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
const char *fromcode, bool native_iconv)
{
smb_iconv_t ret;
@@ -263,7 +263,7 @@ failed:
/*
simple iconv_open() wrapper
*/
-smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
+_PUBLIC_ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
{
return smb_iconv_open_ex(NULL, tocode, fromcode, true);
}
@@ -271,7 +271,7 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
/*
simple iconv_close() wrapper
*/
-int smb_iconv_close(smb_iconv_t cd)
+_PUBLIC_ int smb_iconv_close(smb_iconv_t cd)
{
#ifdef HAVE_NATIVE_ICONV
if (cd->cd_direct) iconv_close((iconv_t)cd->cd_direct);
diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c
index 9b87f49800..c496c5d905 100644
--- a/source4/lib/charset/util_unistr.c
+++ b/source4/lib/charset/util_unistr.c
@@ -67,7 +67,7 @@ static void load_case_tables(void)
/**
Convert a codepoint_t to upper case.
**/
-codepoint_t toupper_w(codepoint_t val)
+_PUBLIC_ codepoint_t toupper_w(codepoint_t val)
{
if (val < 128) {
return toupper(val);
@@ -87,7 +87,7 @@ codepoint_t toupper_w(codepoint_t val)
/**
Convert a codepoint_t to lower case.
**/
-codepoint_t tolower_w(codepoint_t val)
+_PUBLIC_ codepoint_t tolower_w(codepoint_t val)
{
if (val < 128) {
return tolower(val);
@@ -107,7 +107,7 @@ codepoint_t tolower_w(codepoint_t val)
/**
compare two codepoints case insensitively
*/
-int codepoint_cmpi(codepoint_t c1, codepoint_t c2)
+_PUBLIC_ int codepoint_cmpi(codepoint_t c1, codepoint_t c2)
{
if (c1 == c2 ||
toupper_w(c1) == toupper_w(c2)) {
diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk
index 225a23c634..8001699aee 100644
--- a/source4/lib/events/config.mk
+++ b/source4/lib/events/config.mk
@@ -36,7 +36,7 @@ PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL
# End SUBSYSTEM LIBEVENTS
##############################
-PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h)
+# PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h)
[PYTHON::swig_events]
SWIG_FILE = events.i
diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk
index 81b0ef36fd..03c10acc7a 100644
--- a/source4/lib/nss_wrapper/config.mk
+++ b/source4/lib/nss_wrapper/config.mk
@@ -4,5 +4,3 @@
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 70ffce020a..77b4ece552 100644
--- a/source4/lib/registry/config.mk
+++ b/source4/lib/registry/config.mk
@@ -39,7 +39,7 @@ PUBLIC_DEPENDENCIES = \
# End MODULE registry_ldb
################################################
-PUBLIC_HEADERS += $(addprefix lib/registry/, registry.h hive.h patchfile.h)
+PUBLIC_HEADERS += lib/registry/registry.h
[SUBSYSTEM::registry_common]
PUBLIC_DEPENDENCIES = registry
diff --git a/source4/lib/registry/dir.c b/source4/lib/registry/dir.c
index dc3717e886..449ee0f6ee 100644
--- a/source4/lib/registry/dir.c
+++ b/source4/lib/registry/dir.c
@@ -18,7 +18,7 @@
*/
#include "includes.h"
-#include "hive.h"
+#include "registry.h"
#include "system/dir.h"
#include "system/filesys.h"
diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c
index fc2d0fe869..2a9b1a59ce 100644
--- a/source4/lib/registry/hive.c
+++ b/source4/lib/registry/hive.c
@@ -20,7 +20,7 @@
*/
#include "includes.h"
-#include "hive.h"
+#include "registry.h"
#include "system/filesys.h"
#include "param/param.h"
diff --git a/source4/lib/registry/hive.h b/source4/lib/registry/hive.h
deleted file mode 100644
index 2410885718..0000000000
--- a/source4/lib/registry/hive.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Registry hive interface
- Copyright (C) Jelmer Vernooij 2003-2007.
-
- 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, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __REGISTRY_HIVE_H__
-#define __REGISTRY_HIVE_H__
-
-#include <talloc.h>
-#include "libcli/util/werror.h"
-#include "librpc/gen_ndr/security.h"
-#include "libcli/util/ntstatus.h"
-
-/**
- * This file contains the hive API. This API is generally used for
- * reading a specific file that contains just one hive.
- *
- * Good examples are .DAT (NTUSER.DAT) files.
- *
- * This API does not have any notification support (that
- * should be provided by the registry implementation), nor
- * does it understand what predefined keys are.
- */
-
-struct hive_key {
- const struct hive_operations *ops;
-};
-
-struct hive_operations {
- const char *name;
-
- /**
- * Open a specific subkey
- */
- WERROR (*enum_key) (TALLOC_CTX *mem_ctx,
- const struct hive_key *key, uint32_t idx,
- const char **name,
- const char **classname,
- NTTIME *last_mod_time);
-
- /**
- * Open a subkey by name
- */
- WERROR (*get_key_by_name) (TALLOC_CTX *mem_ctx,
- const struct hive_key *key, const char *name,
- struct hive_key **subkey);
-
- /**
- * Add a new key.
- */
- WERROR (*add_key) (TALLOC_CTX *ctx,
- const struct hive_key *parent_key, const char *name,
- const char *classname,
- struct security_descriptor *desc,
- struct hive_key **key);
- /**
- * Remove an existing key.
- */
- WERROR (*del_key) (const struct hive_key *key, const char *name);
-
- /**
- * Force write of a key to disk.
- */
- WERROR (*flush_key) (struct hive_key *key);
-
- /**
- * Retrieve a registry value with a specific index.
- */
- WERROR (*enum_value) (TALLOC_CTX *mem_ctx,
- struct hive_key *key, int idx,
- const char **name, uint32_t *type,
- DATA_BLOB *data);
-
- /**
- * Retrieve a registry value with the specified name
- */
- WERROR (*get_value_by_name) (TALLOC_CTX *mem_ctx,
- struct hive_key *key, const char *name,
- uint32_t *type, DATA_BLOB *data);
-
- /**
- * Set a value on the specified registry key.
- */
- WERROR (*set_value) (struct hive_key *key, const char *name,
- uint32_t type, const DATA_BLOB data);
-
- /**
- * Remove a value.
- */
- WERROR (*delete_value) (struct hive_key *key, const char *name);
-
- /* Security Descriptors */
-
- /**
- * Change the security descriptor on a registry key.
- *
- * This should return WERR_NOT_SUPPORTED if the underlying
- * format does not have a mechanism for storing
- * security descriptors.
- */
- WERROR (*set_sec_desc) (struct hive_key *key,
- const struct security_descriptor *desc);
-
- /**
- * Retrieve the security descriptor on a registry key.
- *
- * This should return WERR_NOT_SUPPORTED if the underlying
- * format does not have a mechanism for storing
- * security descriptors.
- */
- WERROR (*get_sec_desc) (TALLOC_CTX *ctx,
- const struct hive_key *key,
- struct security_descriptor **desc);
-
- /**
- * Retrieve general information about a key.
- */
- WERROR (*get_key_info) (TALLOC_CTX *mem_ctx,
- const struct hive_key *key,
- const char **classname,
- uint32_t *num_subkeys,
- uint32_t *num_values,
- NTTIME *last_change_time,
- uint32_t *max_subkeynamelen,
- uint32_t *max_valnamelen,
- uint32_t *max_valbufsize);
-};
-
-struct cli_credentials;
-struct auth_session_info;
-
-WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
- struct auth_session_info *session_info,
- struct cli_credentials *credentials,
- struct loadparm_context *lp_ctx,
- struct hive_key **root);
-WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key,
- const char **classname, uint32_t *num_subkeys,
- uint32_t *num_values, NTTIME *last_change_time,
- uint32_t *max_subkeynamelen,
- uint32_t *max_valnamelen, uint32_t *max_valbufsize);
-WERROR hive_key_add_name(TALLOC_CTX *ctx, const struct hive_key *parent_key,
- const char *name, const char *classname,
- struct security_descriptor *desc,
- struct hive_key **key);
-WERROR hive_key_del(const struct hive_key *key, const char *name);
-WERROR hive_get_key_by_name(TALLOC_CTX *mem_ctx,
- const struct hive_key *key, const char *name,
- struct hive_key **subkey);
-WERROR hive_enum_key(TALLOC_CTX *mem_ctx,
- const struct hive_key *key, uint32_t idx,
- const char **name,
- const char **classname,
- NTTIME *last_mod_time);
-
-WERROR hive_key_set_value(struct hive_key *key, const char *name,
- uint32_t type, const DATA_BLOB data);
-
-WERROR hive_get_value(TALLOC_CTX *mem_ctx,
- struct hive_key *key, const char *name,
- uint32_t *type, DATA_BLOB *data);
-WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx,
- struct hive_key *key, uint32_t idx,
- const char **name,
- uint32_t *type, DATA_BLOB *data);
-
-WERROR hive_key_del_value(struct hive_key *key, const char *name);
-
-WERROR hive_key_flush(struct hive_key *key);
-
-
-/* Individual backends */
-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 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,
- struct cli_credentials *credentials,
- struct loadparm_context *lp_ctx,
- struct hive_key **k);
-
-
-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);
-
-
-#endif /* __REGISTRY_HIVE_H__ */
diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c
index 687fd4b91b..15e3a158f2 100644
--- a/source4/lib/registry/patchfile.c
+++ b/source4/lib/registry/patchfile.c
@@ -20,7 +20,6 @@
*/
#include "includes.h"
-#include "lib/registry/patchfile.h"
#include "lib/registry/registry.h"
#include "system/filesys.h"
#include "param/param.h"
diff --git a/source4/lib/registry/patchfile.h b/source4/lib/registry/patchfile.h
deleted file mode 100644
index d586aa4c31..0000000000
--- a/source4/lib/registry/patchfile.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Patchfile interface
- Copyright (C) Jelmer Vernooij 2006
- Copyright (C) Wilco Baan Hofman 2006
-
- 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, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _PATCHFILE_H
-#define _PATCHFILE_H
-
-#include "lib/registry/registry.h"
-
-struct reg_diff_callbacks {
- WERROR (*add_key) (void *callback_data, const char *key_name);
- WERROR (*set_value) (void *callback_data, const char *key_name,
- const char *value_name, uint32_t value_type,
- DATA_BLOB value);
- WERROR (*del_value) (void *callback_data, const char *key_name,
- const char *value_name);
- WERROR (*del_key) (void *callback_data, const char *key_name);
- WERROR (*del_all_values) (void *callback_data, const char *key_name);
- WERROR (*done) (void *callback_data);
-};
-
-WERROR reg_diff_apply(struct registry_context *ctx, const char *filename);
-
-WERROR reg_generate_diff(struct registry_context *ctx1,
- struct registry_context *ctx2,
- 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,
- struct registry_key *newkey,
- const char *path,
- const struct reg_diff_callbacks *callbacks,
- void *callback_data);
-
-#endif /* _PATCHFILE_H */
diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c
index 5150c90291..59f4044713 100644
--- a/source4/lib/registry/patchfile_dotreg.c
+++ b/source4/lib/registry/patchfile_dotreg.c
@@ -23,7 +23,6 @@
/* FIXME Newer .REG files, created by Windows XP and above use unicode UTF-16 */
#include "includes.h"
-#include "lib/registry/patchfile.h"
#include "lib/registry/registry.h"
#include "system/filesys.h"
#include "param/param.h"
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 8f02a0b5e3..0fa367bfcb 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -21,7 +21,6 @@
#include "includes.h"
#include "lib/registry/registry.h"
-#include "lib/registry/patchfile.h"
#include "system/filesys.h"
#include "param/param.h"
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index a192f3be4d..46ccca922b 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -18,13 +18,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "includes.h"
-#include "lib/registry/hive.h"
#include "system/filesys.h"
#include "system/time.h"
#include "lib/registry/tdr_regf.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "librpc/gen_ndr/winreg.h"
#include "param/param.h"
+#include "lib/registry/registry.h"
static struct hive_operations reg_backend_regf;
diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h
index 5e0b971a1d..ff03f71eb2 100644
--- a/source4/lib/registry/registry.h
+++ b/source4/lib/registry/registry.h
@@ -24,10 +24,191 @@
struct registry_context;
#include <talloc.h>
+#include "libcli/util/werror.h"
#include "librpc/gen_ndr/security.h"
-#include "lib/registry/hive.h"
#include "libcli/util/ntstatus.h"
+/**
+ * The hive API. This API is generally used for
+ * reading a specific file that contains just one hive.
+ *
+ * Good examples are .DAT (NTUSER.DAT) files.
+ *
+ * This API does not have any notification support (that
+ * should be provided by the registry implementation), nor
+ * does it understand what predefined keys are.
+ */
+
+struct hive_key {
+ const struct hive_operations *ops;
+};
+
+struct hive_operations {
+ const char *name;
+
+ /**
+ * Open a specific subkey
+ */
+ WERROR (*enum_key) (TALLOC_CTX *mem_ctx,
+ const struct hive_key *key, uint32_t idx,
+ const char **name,
+ const char **classname,
+ NTTIME *last_mod_time);
+
+ /**
+ * Open a subkey by name
+ */
+ WERROR (*get_key_by_name) (TALLOC_CTX *mem_ctx,
+ const struct hive_key *key, const char *name,
+ struct hive_key **subkey);
+
+ /**
+ * Add a new key.
+ */
+ WERROR (*add_key) (TALLOC_CTX *ctx,
+ const struct hive_key *parent_key, const char *name,
+ const char *classname,
+ struct security_descriptor *desc,
+ struct hive_key **key);
+ /**
+ * Remove an existing key.
+ */
+ WERROR (*del_key) (const struct hive_key *key, const char *name);
+
+ /**
+ * Force write of a key to disk.
+ */
+ WERROR (*flush_key) (struct hive_key *key);
+
+ /**
+ * Retrieve a registry value with a specific index.
+ */
+ WERROR (*enum_value) (TALLOC_CTX *mem_ctx,
+ struct hive_key *key, int idx,
+ const char **name, uint32_t *type,
+ DATA_BLOB *data);
+
+ /**
+ * Retrieve a registry value with the specified name
+ */
+ WERROR (*get_value_by_name) (TALLOC_CTX *mem_ctx,
+ struct hive_key *key, const char *name,
+ uint32_t *type, DATA_BLOB *data);
+
+ /**
+ * Set a value on the specified registry key.
+ */
+ WERROR (*set_value) (struct hive_key *key, const char *name,
+ uint32_t type, const DATA_BLOB data);
+
+ /**
+ * Remove a value.
+ */
+ WERROR (*delete_value) (struct hive_key *key, const char *name);
+
+ /* Security Descriptors */
+
+ /**
+ * Change the security descriptor on a registry key.
+ *
+ * This should return WERR_NOT_SUPPORTED if the underlying
+ * format does not have a mechanism for storing
+ * security descriptors.
+ */
+ WERROR (*set_sec_desc) (struct hive_key *key,
+ const struct security_descriptor *desc);
+
+ /**
+ * Retrieve the security descriptor on a registry key.
+ *
+ * This should return WERR_NOT_SUPPORTED if the underlying
+ * format does not have a mechanism for storing
+ * security descriptors.
+ */
+ WERROR (*get_sec_desc) (TALLOC_CTX *ctx,
+ const struct hive_key *key,
+ struct security_descriptor **desc);
+
+ /**
+ * Retrieve general information about a key.
+ */
+ WERROR (*get_key_info) (TALLOC_CTX *mem_ctx,
+ const struct hive_key *key,
+ const char **classname,
+ uint32_t *num_subkeys,
+ uint32_t *num_values,
+ NTTIME *last_change_time,
+ uint32_t *max_subkeynamelen,
+ uint32_t *max_valnamelen,
+ uint32_t *max_valbufsize);
+};
+
+struct cli_credentials;
+struct auth_session_info;
+
+WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
+ struct auth_session_info *session_info,
+ struct cli_credentials *credentials,
+ struct loadparm_context *lp_ctx,
+ struct hive_key **root);
+WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key,
+ const char **classname, uint32_t *num_subkeys,
+ uint32_t *num_values, NTTIME *last_change_time,
+ uint32_t *max_subkeynamelen,
+ uint32_t *max_valnamelen, uint32_t *max_valbufsize);
+WERROR hive_key_add_name(TALLOC_CTX *ctx, const struct hive_key *parent_key,
+ const char *name, const char *classname,
+ struct security_descriptor *desc,
+ struct hive_key **key);
+WERROR hive_key_del(const struct hive_key *key, const char *name);
+WERROR hive_get_key_by_name(TALLOC_CTX *mem_ctx,
+ const struct hive_key *key, const char *name,
+ struct hive_key **subkey);
+WERROR hive_enum_key(TALLOC_CTX *mem_ctx,
+ const struct hive_key *key, uint32_t idx,
+ const char **name,
+ const char **classname,
+ NTTIME *last_mod_time);
+
+WERROR hive_key_set_value(struct hive_key *key, const char *name,
+ uint32_t type, const DATA_BLOB data);
+
+WERROR hive_get_value(TALLOC_CTX *mem_ctx,
+ struct hive_key *key, const char *name,
+ uint32_t *type, DATA_BLOB *data);
+WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx,
+ struct hive_key *key, uint32_t idx,
+ const char **name,
+ uint32_t *type, DATA_BLOB *data);
+
+WERROR hive_key_del_value(struct hive_key *key, const char *name);
+
+WERROR hive_key_flush(struct hive_key *key);
+
+
+/* Individual backends */
+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 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,
+ struct cli_credentials *credentials,
+ struct loadparm_context *lp_ctx,
+ struct hive_key **k);
+
+
+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);
+
+
+
/* Handles for the predefined keys */
#define HKEY_CLASSES_ROOT 0x80000000
#define HKEY_CURRENT_USER 0x80000001
@@ -66,8 +247,6 @@ struct registry_key
struct registry_context *context;
};
-#include "lib/registry/patchfile.h"
-
struct registry_value
{
const char *name;
@@ -285,5 +464,34 @@ WERROR reg_get_security(TALLOC_CTX *mem_ctx,
WERROR reg_set_security(struct registry_key *key,
struct security_descriptor *security);
+struct reg_diff_callbacks {
+ WERROR (*add_key) (void *callback_data, const char *key_name);
+ WERROR (*set_value) (void *callback_data, const char *key_name,
+ const char *value_name, uint32_t value_type,
+ DATA_BLOB value);
+ WERROR (*del_value) (void *callback_data, const char *key_name,
+ const char *value_name);
+ WERROR (*del_key) (void *callback_data, const char *key_name);
+ WERROR (*del_all_values) (void *callback_data, const char *key_name);
+ WERROR (*done) (void *callback_data);
+};
+
+WERROR reg_diff_apply(struct registry_context *ctx, const char *filename);
+
+WERROR reg_generate_diff(struct registry_context *ctx1,
+ struct registry_context *ctx2,
+ 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,
+ struct registry_key *newkey,
+ const char *path,
+ const struct reg_diff_callbacks *callbacks,
+ void *callback_data);
+
+
#endif /* _REGISTRY_H */
diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i
index 20ae671c75..8ab402d57d 100644
--- a/source4/lib/registry/registry.i
+++ b/source4/lib/registry/registry.i
@@ -26,7 +26,6 @@
#include "includes.h"
#include "registry.h"
#include "param/param.h"
-#include "hive.h"
typedef struct registry_context reg;
typedef struct hive_key hive_key;
diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c
index 51c255e9f7..da09ecbe08 100644
--- a/source4/lib/registry/registry_wrap.c
+++ b/source4/lib/registry/registry_wrap.c
@@ -2529,7 +2529,6 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
#include "includes.h"
#include "registry.h"
#include "param/param.h"
-#include "hive.h"
typedef struct registry_context reg;
typedef struct hive_key hive_key;
diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c
index 145e599504..6eae26bc46 100644
--- a/source4/lib/registry/tests/generic.c
+++ b/source4/lib/registry/tests/generic.c
@@ -112,7 +112,7 @@ static bool test_reg_val_description_nullname(struct torture_context *ctx)
return true;
}
-_PUBLIC_ struct torture_suite *torture_registry(TALLOC_CTX *mem_ctx)
+struct torture_suite *torture_registry(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite = torture_suite_create(mem_ctx, "REGISTRY");
torture_suite_add_simple_test(suite, "str_regtype",
diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c
index 71837d1807..98443e6456 100644
--- a/source4/lib/registry/tools/regpatch.c
+++ b/source4/lib/registry/tools/regpatch.c
@@ -23,7 +23,6 @@
#include "lib/registry/registry.h"
#include "lib/cmdline/popt_common.h"
#include "lib/registry/tools/common.h"
-#include "lib/registry/patchfile.h"
#include "param/param.h"
int main(int argc, char **argv)
diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk
index 2b9f30a7bb..902692d9be 100644
--- a/source4/lib/socket_wrapper/config.mk
+++ b/source4/lib/socket_wrapper/config.mk
@@ -5,5 +5,3 @@ OBJ_FILES = socket_wrapper.o
PRIVATE_DEPENDENCIES = LIBREPLACE_NETWORK
# 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 33241ffac7..3eab90b9ae 100644
--- a/source4/lib/talloc/config.mk
+++ b/source4/lib/talloc/config.mk
@@ -5,4 +5,3 @@ CFLAGS = -Ilib/talloc
MANPAGES += $(tallocdir)/talloc.3
-PUBLIC_HEADERS += $(tallocdir)/talloc.h
diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk
index c69804fa13..76342dc8fa 100644
--- a/source4/lib/tdb/config.mk
+++ b/source4/lib/tdb/config.mk
@@ -11,8 +11,6 @@ CFLAGS = -Ilib/tdb/include
# End SUBSYSTEM ldb
################################################
-PUBLIC_HEADERS += $(tdbdir)/include/tdb.h
-
################################################
# Start BINARY tdbtool
[BINARY::tdbtool]
diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk
index c6afad1e3f..0bf0692193 100644
--- a/source4/lib/util/config.mk
+++ b/source4/lib/util/config.mk
@@ -33,13 +33,14 @@ PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
mutex.h \
safe_string.h \
time.h \
+ util_ldb.h \
xfile.h)
[SUBSYSTEM::ASN1_UTIL]
PRIVATE_PROTO_HEADER = asn1_proto.h
OBJ_FILES = asn1.o
-PUBLIC_HEADERS += lib/util/asn1.h
+# PUBLIC_HEADERS += lib/util/asn1.h
[SUBSYSTEM::UNIX_PRIVS]
PRIVATE_PROTO_HEADER = unix_privs.h
@@ -48,7 +49,6 @@ OBJ_FILES = unix_privs.o
################################################
# Start SUBSYSTEM WRAP_XATTR
[SUBSYSTEM::WRAP_XATTR]
-PRIVATE_PROTO_HEADER = wrap_xattr.h
OBJ_FILES = \
wrap_xattr.o
PUBLIC_DEPENDENCIES = XATTR
@@ -63,7 +63,6 @@ OBJ_FILES = \
PUBLIC_DEPENDENCIES = LIBTDB
[SUBSYSTEM::UTIL_LDB]
-PRIVATE_PROTO_HEADER = util_ldb.h
OBJ_FILES = \
util_ldb.o
PUBLIC_DEPENDENCIES = LIBLDB
diff --git a/source4/lib/util/data_blob.h b/source4/lib/util/data_blob.h
index 1442438dd7..e9dca67772 100644
--- a/source4/lib/util/data_blob.h
+++ b/source4/lib/util/data_blob.h
@@ -16,6 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/* This is a public header file that is installed as part of Samba.
+ * If you remove any functions or change their signature, update
+ * the so version number. */
+
#ifndef _SAMBA_DATABLOB_H_
#define _SAMBA_DATABLOB_H_
diff --git a/source4/lib/util/dprintf.c b/source4/lib/util/dprintf.c
index 308d81b105..e4f02758eb 100644
--- a/source4/lib/util/dprintf.c
+++ b/source4/lib/util/dprintf.c
@@ -42,7 +42,7 @@ void d_set_iconv(smb_iconv_t cd)
display_cd = cd;
}
-_PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBUTE(2,0)
+_PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap)
{
char *p, *p2;
int ret, clen;
@@ -85,7 +85,7 @@ _PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBU
}
-_PUBLIC_ int d_fprintf(FILE *f, const char *format, ...) _PRINTF_ATTRIBUTE(2,3)
+_PUBLIC_ int d_fprintf(FILE *f, const char *format, ...)
{
int ret;
va_list ap;
@@ -97,7 +97,7 @@ _PUBLIC_ int d_fprintf(FILE *f, const char *format, ...) _PRINTF_ATTRIBUTE(2,3)
return ret;
}
-_PUBLIC_ int d_printf(const char *format, ...) _PRINTF_ATTRIBUTE(1,2)
+_PUBLIC_ int d_printf(const char *format, ...)
{
int ret;
va_list ap;
diff --git a/source4/lib/util/util_file.c b/source4/lib/util/util_file.c
index 836e188ac1..c3e22196c0 100644
--- a/source4/lib/util/util_file.c
+++ b/source4/lib/util/util_file.c
@@ -356,7 +356,7 @@ _PUBLIC_ bool file_save(const char *fname, const void *packet, size_t length)
return true;
}
-_PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap) _PRINTF_ATTRIBUTE(2,0)
+_PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap)
{
char *p;
int len, ret;
@@ -371,7 +371,7 @@ _PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap) _PRINTF_ATTRIBUTE
return ret;
}
-_PUBLIC_ int fdprintf(int fd, const char *format, ...) _PRINTF_ATTRIBUTE(2,3)
+_PUBLIC_ int fdprintf(int fd, const char *format, ...)
{
va_list ap;
int ret;
diff --git a/source4/lib/util/util_ldb.c b/source4/lib/util/util_ldb.c
index f1b42effd8..38f53c2c66 100644
--- a/source4/lib/util/util_ldb.c
+++ b/source4/lib/util/util_ldb.c
@@ -33,7 +33,7 @@ int gendb_search_v(struct ldb_context *ldb,
struct ldb_message ***msgs,
const char * const *attrs,
const char *format,
- va_list ap) _PRINTF_ATTRIBUTE(6,0)
+ va_list ap)
{
enum ldb_scope scope = LDB_SCOPE_SUBTREE;
struct ldb_result *res;
@@ -85,7 +85,7 @@ int gendb_search(struct ldb_context *ldb,
struct ldb_dn *basedn,
struct ldb_message ***res,
const char * const *attrs,
- const char *format, ...) _PRINTF_ATTRIBUTE(6,7)
+ const char *format, ...)
{
va_list ap;
int count;
diff --git a/source4/lib/util/util_ldb.h b/source4/lib/util/util_ldb.h
new file mode 100644
index 0000000000..030ba7ebee
--- /dev/null
+++ b/source4/lib/util/util_ldb.h
@@ -0,0 +1,27 @@
+#ifndef __LIB_UTIL_UTIL_LDB_H__
+#define __LIB_UTIL_UTIL_LDB_H__
+
+/* The following definitions come from lib/util/util_ldb.c */
+
+int gendb_search_v(struct ldb_context *ldb,
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *basedn,
+ struct ldb_message ***msgs,
+ const char * const *attrs,
+ const char *format,
+ va_list ap) PRINTF_ATTRIBUTE(6,0);
+int gendb_search(struct ldb_context *ldb,
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *basedn,
+ struct ldb_message ***res,
+ const char * const *attrs,
+ const char *format, ...) PRINTF_ATTRIBUTE(6,7);
+int gendb_search_dn(struct ldb_context *ldb,
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *dn,
+ struct ldb_message ***res,
+ const char * const *attrs);
+int gendb_add_ldif(struct ldb_context *ldb, const char *ldif_string);
+char *wrap_casefold(void *context, void *mem_ctx, const char *s);
+
+#endif /* __LIB_UTIL_UTIL_LDB_H__ */
diff --git a/source4/lib/util/wrap_xattr.h b/source4/lib/util/wrap_xattr.h
new file mode 100644
index 0000000000..64b28d250c
--- /dev/null
+++ b/source4/lib/util/wrap_xattr.h
@@ -0,0 +1,12 @@
+#ifndef __LIB_UTIL_WRAP_XATTR_H__
+#define __LIB_UTIL_WRAP_XATTR_H__
+
+ssize_t wrap_fgetxattr(int fd, const char *name, void *value, size_t size);
+ssize_t wrap_getxattr(const char *path, const char *name, void *value, size_t size);
+int wrap_fsetxattr(int fd, const char *name, void *value, size_t size, int flags);
+int wrap_setxattr(const char *path, const char *name, void *value, size_t size, int flags);
+int wrap_fremovexattr(int fd, const char *name);
+int wrap_removexattr(const char *path, const char *name);
+
+#endif /* __LIB_UTIL_WRAP_XATTR_H__ */
+