summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-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/registry/tests/generic.c2
-rw-r--r--source4/lib/talloc/config.mk1
-rw-r--r--source4/lib/util/config.mk3
-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.h26
-rw-r--r--source4/lib/util/wrap_xattr.h12
12 files changed, 121 insertions, 21 deletions
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/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/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/util/config.mk b/source4/lib/util/config.mk
index c6afad1e3f..483e835e00 100644
--- a/source4/lib/util/config.mk
+++ b/source4/lib/util/config.mk
@@ -33,6 +33,7 @@ PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
mutex.h \
safe_string.h \
time.h \
+ util_ldb.h \
xfile.h)
[SUBSYSTEM::ASN1_UTIL]
@@ -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/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..864ce7e8c6
--- /dev/null
+++ b/source4/lib/util/util_ldb.h
@@ -0,0 +1,26 @@
+#ifndef __LIB_UTIL_UTIL_LDB_H__
+#define __LIB_UTIL_UTIL_LDB_H__
+
+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__ */
+