diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-03-20 01:30:36 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-03-20 01:30:36 +0100 |
commit | 5fe2b28f45289dc5578cdd536600f0d30a14d820 (patch) | |
tree | 4bdf36d0d4d8bdddcb3d618b4b01839370ed57c3 /lib/util | |
parent | ec9aeeab00584f4d3dfe9afb83dc1a77b8463b81 (diff) | |
parent | 3a4638db0351368d3b148bf547546f28fa0b1479 (diff) | |
download | samba-5fe2b28f45289dc5578cdd536600f0d30a14d820.tar.gz samba-5fe2b28f45289dc5578cdd536600f0d30a14d820.tar.bz2 samba-5fe2b28f45289dc5578cdd536600f0d30a14d820.zip |
Merge branch 'master' of git://git.samba.org/samba into minschema
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/charset/charcnv.c | 6 | ||||
-rw-r--r-- | lib/util/charset/charset.h | 6 | ||||
-rw-r--r-- | lib/util/charset/iconv.c | 29 | ||||
-rw-r--r-- | lib/util/charset/util_unistr.c | 2 | ||||
-rw-r--r-- | lib/util/config.mk | 9 | ||||
-rw-r--r-- | lib/util/fault.m4 | 1 | ||||
-rw-r--r-- | lib/util/util.c | 15 | ||||
-rw-r--r-- | lib/util/util.h | 7 |
8 files changed, 46 insertions, 29 deletions
diff --git a/lib/util/charset/charcnv.c b/lib/util/charset/charcnv.c index 258730ec82..94d47a9f7f 100644 --- a/lib/util/charset/charcnv.c +++ b/lib/util/charset/charcnv.c @@ -169,9 +169,10 @@ static smb_iconv_t get_conv_handle(struct smb_iconv_convenience *ic, _PUBLIC_ ssize_t iconv_talloc(TALLOC_CTX *ctx, smb_iconv_t cd, void const *src, size_t srclen, - void **dest) + void *dst) { size_t i_len, o_len, destlen; + void **dest = (void **)dst; size_t retval; const char *inbuf = (const char *)src; char *outbuf, *ob; @@ -314,9 +315,10 @@ _PUBLIC_ bool convert_string_talloc_convenience(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, charset_t from, charset_t to, void const *src, size_t srclen, - void **dest, size_t *converted_size, + void *dst, size_t *converted_size, bool allow_badcharcnv) { + void **dest = (void **)dst; smb_iconv_t descriptor; ssize_t ret; diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h index 655bae7bcd..37c5acafaf 100644 --- a/lib/util/charset/charset.h +++ b/lib/util/charset/charset.h @@ -136,7 +136,7 @@ ssize_t pull_string(char *dest, const void *src, size_t dest_len, size_t src_len bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, void const *src, size_t srclen, - void **dest, size_t *converted_size, + void *dest, size_t *converted_size, bool allow_badcharcnv); size_t convert_string(charset_t from, charset_t to, @@ -146,7 +146,7 @@ size_t convert_string(charset_t from, charset_t to, ssize_t iconv_talloc(TALLOC_CTX *mem_ctx, smb_iconv_t cd, void const *src, size_t srclen, - void **dest); + void *dest); extern struct smb_iconv_convenience *global_iconv_convenience; @@ -176,7 +176,7 @@ bool convert_string_talloc_convenience(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, charset_t from, charset_t to, void const *src, size_t srclen, - void **dest, size_t *converted_size, bool allow_badcharcnv); + void *dest, size_t *converted_size, bool allow_badcharcnv); /* iconv */ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode); int smb_iconv_close(smb_iconv_t cd); diff --git a/lib/util/charset/iconv.c b/lib/util/charset/iconv.c index 98284ce9bd..9825e4be01 100644 --- a/lib/util/charset/iconv.c +++ b/lib/util/charset/iconv.c @@ -50,6 +50,7 @@ static size_t ascii_pull (void *,const char **, size_t *, char **, size_t *); static size_t ascii_push (void *,const char **, size_t *, char **, size_t *); +static size_t latin1_push (void *,const char **, size_t *, char **, size_t *); static size_t utf8_pull (void *,const char **, size_t *, char **, size_t *); static size_t utf8_push (void *,const char **, size_t *, char **, size_t *); static size_t utf16_munged_pull(void *,const char **, size_t *, char **, size_t *); @@ -73,6 +74,8 @@ static const struct charset_functions builtin_functions[] = { {"UTF16_MUNGED", utf16_munged_pull, iconv_copy}, {"ASCII", ascii_pull, ascii_push}, + {"646", ascii_pull, ascii_push}, + {"ISO-8859-1", ascii_pull, latin1_push}, {"UCS2-HEX", ucs2hex_pull, ucs2hex_push} }; @@ -341,6 +344,32 @@ static size_t ascii_push(void *cd, const char **inbuf, size_t *inbytesleft, return ir_count; } +static size_t latin1_push(void *cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + int ir_count=0; + + while (*inbytesleft >= 2 && *outbytesleft >= 1) { + (*outbuf)[0] = (*inbuf)[0]; + if ((*inbuf)[1]) ir_count++; + (*inbytesleft) -= 2; + (*outbytesleft) -= 1; + (*inbuf) += 2; + (*outbuf) += 1; + } + + if (*inbytesleft == 1) { + errno = EINVAL; + return -1; + } + + if (*inbytesleft > 1) { + errno = E2BIG; + return -1; + } + + return ir_count; +} static size_t ucs2hex_pull(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c index ec88e784d0..ea2bfeab9f 100644 --- a/lib/util/charset/util_unistr.c +++ b/lib/util/charset/util_unistr.c @@ -978,7 +978,7 @@ _PUBLIC_ size_t convert_string(charset_t from, charset_t to, _PUBLIC_ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, void const *src, size_t srclen, - void **dest, size_t *converted_size, + void *dest, size_t *converted_size, bool allow_badcharcnv) { return convert_string_talloc_convenience(ctx, get_iconv_convenience(), diff --git a/lib/util/config.mk b/lib/util/config.mk index 14bdb2a277..7835fed911 100644 --- a/lib/util/config.mk +++ b/lib/util/config.mk @@ -5,7 +5,7 @@ PUBLIC_DEPENDENCIES = \ CHARSET EXECINFO LIBSAMBA-UTIL_OBJ_FILES = $(addprefix $(libutilsrcdir)/, \ - xfile.o \ + xfile.o \ debug.o \ fault.o \ signal.o \ @@ -68,6 +68,13 @@ PUBLIC_DEPENDENCIES = LIBTDB UTIL_TDB_OBJ_FILES = $(libutilsrcdir)/util_tdb.o +[SUBSYSTEM::UTIL_TEVENT] +PUBLIC_DEPENDENCIES = LIBTEVENT + +UTIL_TEVENT_OBJ_FILES = $(addprefix $(libutilsrcdir)/, \ + tevent_unix.o \ + tevent_ntstatus.o) + [SUBSYSTEM::UTIL_LDB] PUBLIC_DEPENDENCIES = LIBLDB diff --git a/lib/util/fault.m4 b/lib/util/fault.m4 index da077af31d..bac553a158 100644 --- a/lib/util/fault.m4 +++ b/lib/util/fault.m4 @@ -8,6 +8,7 @@ if test x"$ac_cv_header_execinfo_h" = x"yes" -a x"$ac_cv_func_ext_backtrace" = x EXECINFO_CFLAGS="$CFLAGS" EXECINFO_CPPFLAGS="$CPPFLAGS" EXECINFO_LDFLAGS="$LDFLAGS" + LIB_REMOVE_USR_LIB(EXECINFO_LDFLAGS) else SMB_ENABLE(EXECINFO,NO) fi diff --git a/lib/util/util.c b/lib/util/util.c index 1f31f55e8b..0148bdb00d 100644 --- a/lib/util/util.c +++ b/lib/util/util.c @@ -541,21 +541,6 @@ void *malloc_array(size_t el_size, unsigned int count) return realloc_array(NULL, el_size, count, false); } -_PUBLIC_ void *talloc_check_name_abort(const void *ptr, const char *name) -{ - void *result; - - result = talloc_check_name(ptr, name); - if (result != NULL) - return result; - - DEBUG(0, ("Talloc type mismatch, expected %s, got %s\n", - name, talloc_get_name(ptr))); - smb_panic("talloc type mismatch"); - /* Keep the compiler happy */ - return NULL; -} - /** Trim the specified elements off the front and back of a string. **/ diff --git a/lib/util/util.h b/lib/util/util.h index 1f6e3b193b..defef127d9 100644 --- a/lib/util/util.h +++ b/lib/util/util.h @@ -767,13 +767,6 @@ bool pm_process( const char *fileName, bool (*pfunc)(const char *, const char *, void *), void *userdata); -/** - * Add-on to talloc_get_type - */ -_PUBLIC_ void *talloc_check_name_abort(const void *ptr, const char *name); -#define talloc_get_type_abort(ptr, type) \ - (type *)talloc_check_name_abort(ptr, #type) - bool unmap_file(void *start, size_t size); void print_asc(int level, const uint8_t *buf,int len); |