summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-03-25 08:37:00 +1100
committerAndrew Tridgell <tridge@samba.org>2011-03-25 04:37:06 +0100
commitb5616adc8adbcee61bb670378f9c066225d9dcf3 (patch)
tree29cf788ade306c9ec3eb95493a6db71a7936f898
parent7824111d07ae12b34e03da1e72884d421a9f9f33 (diff)
downloadsamba-b5616adc8adbcee61bb670378f9c066225d9dcf3.tar.gz
samba-b5616adc8adbcee61bb670378f9c066225d9dcf3.tar.bz2
samba-b5616adc8adbcee61bb670378f9c066225d9dcf3.zip
lib/util/charset rename iconv_convenience to iconv_handle
This better reflects what this structure is Andrew Bartlett
-rw-r--r--lib/util/charset/charcnv.c8
-rw-r--r--lib/util/charset/charset.h26
-rw-r--r--lib/util/charset/codepoints.c48
-rw-r--r--lib/util/charset/tests/iconv.c4
-rw-r--r--lib/util/charset/util_str.c32
-rw-r--r--lib/util/charset/util_unistr.c40
-rw-r--r--libgpo/gpo_fetch.c2
-rw-r--r--source3/lib/charcnv.c14
-rw-r--r--source4/kdc/kpasswdd.c4
-rw-r--r--source4/libnet/libnet_samdump.c2
-rw-r--r--source4/param/loadparm.c16
-rw-r--r--source4/param/param.h6
-rw-r--r--source4/param/util.c6
-rw-r--r--source4/rpc_server/samr/samr_password.c6
-rw-r--r--source4/torture/basic/charset.c2
15 files changed, 108 insertions, 108 deletions
diff --git a/lib/util/charset/charcnv.c b/lib/util/charset/charcnv.c
index 88f464c2c2..887cc9d989 100644
--- a/lib/util/charset/charcnv.c
+++ b/lib/util/charset/charcnv.c
@@ -124,7 +124,7 @@ convert:
* @returns the number of bytes occupied in the destination
* on error, returns -1, and sets errno
**/
-_PUBLIC_ ssize_t convert_string_error(struct smb_iconv_convenience *ic,
+_PUBLIC_ ssize_t convert_string_error(struct smb_iconv_handle *ic,
charset_t from, charset_t to,
void const *src, size_t srclen,
void *dest, size_t destlen, size_t *converted_size)
@@ -167,7 +167,7 @@ _PUBLIC_ ssize_t convert_string_error(struct smb_iconv_convenience *ic,
* @param destlen maximal length allowed for string
* @returns the number of bytes occupied in the destination
**/
-_PUBLIC_ bool convert_string_convenience(struct smb_iconv_convenience *ic,
+_PUBLIC_ bool convert_string_handle(struct smb_iconv_handle *ic,
charset_t from, charset_t to,
void const *src, size_t srclen,
void *dest, size_t destlen, size_t *converted_size)
@@ -214,8 +214,8 @@ _PUBLIC_ bool convert_string_convenience(struct smb_iconv_convenience *ic,
* @returns Size in bytes of the converted string; or -1 in case of error.
**/
-_PUBLIC_ bool convert_string_talloc_convenience(TALLOC_CTX *ctx,
- struct smb_iconv_convenience *ic,
+_PUBLIC_ bool convert_string_talloc_handle(TALLOC_CTX *ctx,
+ struct smb_iconv_handle *ic,
charset_t from, charset_t to,
void const *src, size_t srclen,
void *dst, size_t *converted_size)
diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h
index 141fbea7be..30ebcd5595 100644
--- a/lib/util/charset/charset.h
+++ b/lib/util/charset/charset.h
@@ -103,7 +103,7 @@ typedef struct smb_iconv_s {
#define STR_LEN_NOTERM 256 /* the length field is the unterminated length */
struct loadparm_context;
-struct smb_iconv_convenience;
+struct smb_iconv_handle;
/* replace some string functions with multi-byte
versions */
@@ -159,11 +159,11 @@ ssize_t iconv_talloc(TALLOC_CTX *mem_ctx,
void const *src, size_t srclen,
void *dest);
-extern struct smb_iconv_convenience *global_iconv_convenience;
-struct smb_iconv_convenience *get_iconv_convenience(void);
-smb_iconv_t get_conv_handle(struct smb_iconv_convenience *ic,
+extern struct smb_iconv_handle *global_iconv_handle;
+struct smb_iconv_handle *get_iconv_handle(void);
+smb_iconv_t get_conv_handle(struct smb_iconv_handle *ic,
charset_t from, charset_t to);
-const char *charset_name(struct smb_iconv_convenience *ic, charset_t ch);
+const char *charset_name(struct smb_iconv_handle *ic, charset_t ch);
codepoint_t next_codepoint_ext(const char *str, charset_t src_charset,
size_t *size);
@@ -171,12 +171,12 @@ codepoint_t next_codepoint(const char *str, size_t *size);
ssize_t push_codepoint(char *str, codepoint_t c);
/* codepoints */
-codepoint_t next_codepoint_convenience_ext(struct smb_iconv_convenience *ic,
+codepoint_t next_codepoint_handle_ext(struct smb_iconv_handle *ic,
const char *str, charset_t src_charset,
size_t *size);
-codepoint_t next_codepoint_convenience(struct smb_iconv_convenience *ic,
+codepoint_t next_codepoint_handle(struct smb_iconv_handle *ic,
const char *str, size_t *size);
-ssize_t push_codepoint_convenience(struct smb_iconv_convenience *ic,
+ssize_t push_codepoint_handle(struct smb_iconv_handle *ic,
char *str, codepoint_t c);
codepoint_t toupper_m(codepoint_t val);
@@ -186,19 +186,19 @@ bool isupper_m(codepoint_t val);
int codepoint_cmpi(codepoint_t c1, codepoint_t c2);
/* Iconv convenience functions */
-struct smb_iconv_convenience *smb_iconv_convenience_reinit(TALLOC_CTX *mem_ctx,
+struct smb_iconv_handle *smb_iconv_handle_reinit(TALLOC_CTX *mem_ctx,
const char *dos_charset,
const char *unix_charset,
const char *display_charset,
bool native_iconv,
- struct smb_iconv_convenience *old_ic);
+ struct smb_iconv_handle *old_ic);
-bool convert_string_convenience(struct smb_iconv_convenience *ic,
+bool convert_string_handle(struct smb_iconv_handle *ic,
charset_t from, charset_t to,
void const *src, size_t srclen,
void *dest, size_t destlen, size_t *converted_size);
-bool convert_string_talloc_convenience(TALLOC_CTX *ctx,
- struct smb_iconv_convenience *ic,
+bool convert_string_talloc_handle(TALLOC_CTX *ctx,
+ struct smb_iconv_handle *ic,
charset_t from, charset_t to,
void const *src, size_t srclen,
void *dest, size_t *converted_size);
diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c
index 5ee95a8af5..62a80a35d4 100644
--- a/lib/util/charset/codepoints.c
+++ b/lib/util/charset/codepoints.c
@@ -153,7 +153,7 @@ _PUBLIC_ int codepoint_cmpi(codepoint_t c1, codepoint_t c2)
}
-struct smb_iconv_convenience {
+struct smb_iconv_handle {
TALLOC_CTX *child_ctx;
const char *unix_charset;
const char *dos_charset;
@@ -162,20 +162,20 @@ struct smb_iconv_convenience {
smb_iconv_t conv_handles[NUM_CHARSETS][NUM_CHARSETS];
};
-struct smb_iconv_convenience *global_iconv_convenience = NULL;
+struct smb_iconv_handle *global_iconv_handle = NULL;
-struct smb_iconv_convenience *get_iconv_convenience(void)
+struct smb_iconv_handle *get_iconv_handle(void)
{
- if (global_iconv_convenience == NULL)
- global_iconv_convenience = smb_iconv_convenience_reinit(talloc_autofree_context(),
+ if (global_iconv_handle == NULL)
+ global_iconv_handle = smb_iconv_handle_reinit(talloc_autofree_context(),
"ASCII", "UTF-8", "ASCII", true, NULL);
- return global_iconv_convenience;
+ return global_iconv_handle;
}
/**
* Return the name of a charset to give to iconv().
**/
-const char *charset_name(struct smb_iconv_convenience *ic, charset_t ch)
+const char *charset_name(struct smb_iconv_handle *ic, charset_t ch)
{
switch (ch) {
case CH_UTF16: return "UTF-16LE";
@@ -193,7 +193,7 @@ const char *charset_name(struct smb_iconv_convenience *ic, charset_t ch)
/**
re-initialize iconv conversion descriptors
**/
-static int close_iconv_convenience(struct smb_iconv_convenience *data)
+static int close_iconv_handle(struct smb_iconv_handle *data)
{
unsigned c1, c2;
for (c1=0;c1<NUM_CHARSETS;c1++) {
@@ -242,31 +242,31 @@ static const char *map_locale(const char *charset)
}
/*
- the old_ic is passed in here as the smb_iconv_convenience structure
+ the old_ic is passed in here as the smb_iconv_handle structure
is used as a global pointer in some places (eg. python modules). We
don't want to invalidate those global pointers, but we do want to
update them with the right charset information when loadparm
runs. To do that we need to re-use the structure pointer, but
re-fill the elements in the structure with the updated values
*/
-_PUBLIC_ struct smb_iconv_convenience *smb_iconv_convenience_reinit(TALLOC_CTX *mem_ctx,
+_PUBLIC_ struct smb_iconv_handle *smb_iconv_handle_reinit(TALLOC_CTX *mem_ctx,
const char *dos_charset,
const char *unix_charset,
const char *display_charset,
bool native_iconv,
- struct smb_iconv_convenience *old_ic)
+ struct smb_iconv_handle *old_ic)
{
- struct smb_iconv_convenience *ret;
+ struct smb_iconv_handle *ret;
display_charset = map_locale(display_charset);
if (old_ic != NULL) {
ret = old_ic;
- close_iconv_convenience(ret);
+ close_iconv_handle(ret);
talloc_free(ret->child_ctx);
ZERO_STRUCTP(ret);
} else {
- ret = talloc_zero(mem_ctx, struct smb_iconv_convenience);
+ ret = talloc_zero(mem_ctx, struct smb_iconv_handle);
}
if (ret == NULL) {
return NULL;
@@ -279,7 +279,7 @@ _PUBLIC_ struct smb_iconv_convenience *smb_iconv_convenience_reinit(TALLOC_CTX *
return NULL;
}
- talloc_set_destructor(ret, close_iconv_convenience);
+ talloc_set_destructor(ret, close_iconv_handle);
ret->dos_charset = talloc_strdup(ret->child_ctx, dos_charset);
ret->unix_charset = talloc_strdup(ret->child_ctx, unix_charset);
@@ -292,7 +292,7 @@ _PUBLIC_ struct smb_iconv_convenience *smb_iconv_convenience_reinit(TALLOC_CTX *
/*
on-demand initialisation of conversion handles
*/
-smb_iconv_t get_conv_handle(struct smb_iconv_convenience *ic,
+smb_iconv_t get_conv_handle(struct smb_iconv_handle *ic,
charset_t from, charset_t to)
{
const char *n1, *n2;
@@ -344,8 +344,8 @@ smb_iconv_t get_conv_handle(struct smb_iconv_convenience *ic,
*
* Return INVALID_CODEPOINT if the next character cannot be converted.
*/
-_PUBLIC_ codepoint_t next_codepoint_convenience_ext(
- struct smb_iconv_convenience *ic,
+_PUBLIC_ codepoint_t next_codepoint_handle_ext(
+ struct smb_iconv_handle *ic,
const char *str, charset_t src_charset,
size_t *bytes_consumed)
{
@@ -421,10 +421,10 @@ _PUBLIC_ codepoint_t next_codepoint_convenience_ext(
return INVALID_CODEPOINT if the next character cannot be converted
*/
-_PUBLIC_ codepoint_t next_codepoint_convenience(struct smb_iconv_convenience *ic,
+_PUBLIC_ codepoint_t next_codepoint_handle(struct smb_iconv_handle *ic,
const char *str, size_t *size)
{
- return next_codepoint_convenience_ext(ic, str, CH_UNIX, size);
+ return next_codepoint_handle_ext(ic, str, CH_UNIX, size);
}
/*
@@ -437,7 +437,7 @@ _PUBLIC_ codepoint_t next_codepoint_convenience(struct smb_iconv_convenience *ic
return the number of bytes occupied by the CH_UNIX character, or
-1 on failure
*/
-_PUBLIC_ ssize_t push_codepoint_convenience(struct smb_iconv_convenience *ic,
+_PUBLIC_ ssize_t push_codepoint_handle(struct smb_iconv_handle *ic,
char *str, codepoint_t c)
{
smb_iconv_t descriptor;
@@ -489,16 +489,16 @@ _PUBLIC_ ssize_t push_codepoint_convenience(struct smb_iconv_convenience *ic,
_PUBLIC_ codepoint_t next_codepoint_ext(const char *str, charset_t src_charset,
size_t *size)
{
- return next_codepoint_convenience_ext(get_iconv_convenience(), str,
+ return next_codepoint_handle_ext(get_iconv_handle(), str,
src_charset, size);
}
_PUBLIC_ codepoint_t next_codepoint(const char *str, size_t *size)
{
- return next_codepoint_convenience(get_iconv_convenience(), str, size);
+ return next_codepoint_handle(get_iconv_handle(), str, size);
}
_PUBLIC_ ssize_t push_codepoint(char *str, codepoint_t c)
{
- return push_codepoint_convenience(get_iconv_convenience(), str, c);
+ return push_codepoint_handle(get_iconv_handle(), str, c);
}
diff --git a/lib/util/charset/tests/iconv.c b/lib/util/charset/tests/iconv.c
index 9b48771b16..c27c263cfc 100644
--- a/lib/util/charset/tests/iconv.c
+++ b/lib/util/charset/tests/iconv.c
@@ -289,7 +289,7 @@ static bool test_codepoint(struct torture_context *tctx, unsigned int codepoint)
size_t size, size2;
codepoint_t c;
- size = push_codepoint_convenience(lpcfg_iconv_convenience(tctx->lp_ctx), (char *)buf, codepoint);
+ size = push_codepoint_handle(lpcfg_iconv_handle(tctx->lp_ctx), (char *)buf, codepoint);
torture_assert(tctx, size != -1 || (codepoint >= 0xd800 && codepoint <= 0x10000),
"Invalid Codepoint range");
@@ -300,7 +300,7 @@ static bool test_codepoint(struct torture_context *tctx, unsigned int codepoint)
buf[size+2] = random();
buf[size+3] = random();
- c = next_codepoint_convenience(lpcfg_iconv_convenience(tctx->lp_ctx), (char *)buf, &size2);
+ c = next_codepoint_handle(lpcfg_iconv_handle(tctx->lp_ctx), (char *)buf, &size2);
torture_assert(tctx, c == codepoint,
talloc_asprintf(tctx,
diff --git a/lib/util/charset/util_str.c b/lib/util/charset/util_str.c
index 597b031675..30961d068a 100644
--- a/lib/util/charset/util_str.c
+++ b/lib/util/charset/util_str.c
@@ -34,7 +34,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 = get_iconv_convenience();
+ struct smb_iconv_handle *iconv_handle = get_iconv_handle();
/* handle null ptr comparisons to simplify the use in qsort */
if (s1 == s2) return 0;
@@ -42,8 +42,8 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2)
if (s2 == NULL) return 1;
while (*s1 && *s2) {
- c1 = next_codepoint_convenience(iconv_convenience, s1, &size1);
- c2 = next_codepoint_convenience(iconv_convenience, s2, &size2);
+ c1 = next_codepoint_handle(iconv_handle, s1, &size1);
+ c2 = next_codepoint_handle(iconv_handle, s2, &size2);
s1 += size1;
s2 += size2;
@@ -73,7 +73,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 = get_iconv_convenience();
+ struct smb_iconv_handle *iconv_handle = get_iconv_handle();
/* handle null ptr comparisons to simplify the use in qsort */
if (s1 == s2) return 0;
@@ -83,8 +83,8 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n)
while (*s1 && *s2 && n) {
n--;
- c1 = next_codepoint_convenience(iconv_convenience, s1, &size1);
- c2 = next_codepoint_convenience(iconv_convenience, s2, &size2);
+ c1 = next_codepoint_handle(iconv_handle, s1, &size1);
+ c2 = next_codepoint_handle(iconv_handle, s2, &size2);
s1 += size1;
s2 += size2;
@@ -143,7 +143,7 @@ _PUBLIC_ bool strcsequal(const char *s1,const char *s2)
_PUBLIC_ size_t strlen_m_ext(const char *s, charset_t src_charset, charset_t dst_charset)
{
size_t count = 0;
- struct smb_iconv_convenience *ic = get_iconv_convenience();
+ struct smb_iconv_handle *ic = get_iconv_handle();
if (!s) {
return 0;
@@ -160,7 +160,7 @@ _PUBLIC_ size_t strlen_m_ext(const char *s, charset_t src_charset, charset_t dst
while (*s) {
size_t c_size;
- codepoint_t c = next_codepoint_convenience_ext(ic, s, src_charset, &c_size);
+ codepoint_t c = next_codepoint_handle_ext(ic, s, src_charset, &c_size);
s += c_size;
switch (dst_charset) {
@@ -262,7 +262,7 @@ _PUBLIC_ size_t strlen_m_term_null(const char *s)
_PUBLIC_ char *strchr_m(const char *src, char c)
{
const char *s;
- struct smb_iconv_convenience *ic = get_iconv_convenience();
+ struct smb_iconv_handle *ic = get_iconv_handle();
if (src == NULL) {
return NULL;
}
@@ -292,7 +292,7 @@ _PUBLIC_ char *strchr_m(const char *src, char c)
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint_convenience(ic, s, &size);
+ codepoint_t c2 = next_codepoint_handle(ic, s, &size);
if (c2 == c) {
return discard_const_p(char, s);
}
@@ -307,7 +307,7 @@ _PUBLIC_ char *strchr_m(const char *src, char c)
*/
_PUBLIC_ char *strrchr_m(const char *s, char c)
{
- struct smb_iconv_convenience *ic = get_iconv_convenience();
+ struct smb_iconv_handle *ic = get_iconv_handle();
char *ret = NULL;
if (s == NULL) {
@@ -356,7 +356,7 @@ _PUBLIC_ char *strrchr_m(const char *s, char c)
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint_convenience(ic, s, &size);
+ codepoint_t c2 = next_codepoint_handle(ic, s, &size);
if (c2 == c) {
ret = discard_const_p(char, s);
}
@@ -371,13 +371,13 @@ _PUBLIC_ char *strrchr_m(const char *s, char c)
*/
_PUBLIC_ bool strhaslower(const char *string)
{
- struct smb_iconv_convenience *ic = get_iconv_convenience();
+ struct smb_iconv_handle *ic = get_iconv_handle();
while (*string) {
size_t c_size;
codepoint_t s;
codepoint_t t;
- s = next_codepoint_convenience(ic, string, &c_size);
+ s = next_codepoint_handle(ic, string, &c_size);
string += c_size;
t = toupper_m(s);
@@ -395,13 +395,13 @@ _PUBLIC_ bool strhaslower(const char *string)
*/
_PUBLIC_ bool strhasupper(const char *string)
{
- struct smb_iconv_convenience *ic = get_iconv_convenience();
+ struct smb_iconv_handle *ic = get_iconv_handle();
while (*string) {
size_t c_size;
codepoint_t s;
codepoint_t t;
- s = next_codepoint_convenience(ic, string, &c_size);
+ s = next_codepoint_handle(ic, string, &c_size);
string += c_size;
t = tolower_m(s);
diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c
index c59620ed32..f761613ba8 100644
--- a/lib/util/charset/util_unistr.c
+++ b/lib/util/charset/util_unistr.c
@@ -74,10 +74,10 @@ _PUBLIC_ bool next_token(const char **ptr,char *buff, const char *sep, size_t bu
**/
_PUBLIC_ void string_replace_m(char *s, char oldc, char newc)
{
- struct smb_iconv_convenience *ic = get_iconv_convenience();
+ struct smb_iconv_handle *ic = get_iconv_handle();
while (s && *s) {
size_t size;
- codepoint_t c = next_codepoint_convenience(ic, s, &size);
+ codepoint_t c = next_codepoint_handle(ic, s, &size);
if (c == oldc) {
*s = newc;
}
@@ -138,7 +138,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
{
size_t size=0;
char *dest;
- struct smb_iconv_convenience *iconv_convenience = get_iconv_convenience();
+ struct smb_iconv_handle *iconv_handle = get_iconv_handle();
if(src == NULL) {
return NULL;
@@ -153,12 +153,12 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
while (*src) {
size_t c_size;
- codepoint_t c = next_codepoint_convenience(iconv_convenience, src, &c_size);
+ codepoint_t c = next_codepoint_handle(iconv_handle, src, &c_size);
src += c_size;
c = tolower_m(c);
- c_size = push_codepoint_convenience(iconv_convenience, dest+size, c);
+ c_size = push_codepoint_handle(iconv_handle, dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
@@ -184,7 +184,7 @@ _PUBLIC_ char *strupper_talloc_n(TALLOC_CTX *ctx, const char *src, size_t n)
{
size_t size=0;
char *dest;
- struct smb_iconv_convenience *iconv_convenience = get_iconv_convenience();
+ struct smb_iconv_handle *iconv_handle = get_iconv_handle();
if (!src) {
return NULL;
@@ -199,12 +199,12 @@ _PUBLIC_ char *strupper_talloc_n(TALLOC_CTX *ctx, const char *src, size_t n)
while (n-- && *src) {
size_t c_size;
- codepoint_t c = next_codepoint_convenience(iconv_convenience, src, &c_size);
+ codepoint_t c = next_codepoint_handle(iconv_handle, src, &c_size);
src += c_size;
c = toupper_m(c);
- c_size = push_codepoint_convenience(iconv_convenience, dest+size, c);
+ c_size = push_codepoint_handle(iconv_handle, dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
@@ -244,7 +244,7 @@ _PUBLIC_ char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *src)
_PUBLIC_ void strlower_m(char *s)
{
char *d;
- struct smb_iconv_convenience *iconv_convenience;
+ struct smb_iconv_handle *iconv_handle;
/* this is quite a common operation, so we want it to be
fast. We optimise for the ascii case, knowing that all our
@@ -258,14 +258,14 @@ _PUBLIC_ void strlower_m(char *s)
if (!*s)
return;
- iconv_convenience = get_iconv_convenience();
+ iconv_handle = get_iconv_handle();
d = s;
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint_convenience(iconv_convenience, s, &c_size);
- c_size2 = push_codepoint_convenience(iconv_convenience, d, tolower_m(c));
+ codepoint_t c = next_codepoint_handle(iconv_handle, s, &c_size);
+ c_size2 = push_codepoint_handle(iconv_handle, d, tolower_m(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_m(c), (int)c_size, (int)c_size2));
@@ -283,7 +283,7 @@ _PUBLIC_ void strlower_m(char *s)
_PUBLIC_ void strupper_m(char *s)
{
char *d;
- struct smb_iconv_convenience *iconv_convenience;
+ struct smb_iconv_handle *iconv_handle;
/* this is quite a common operation, so we want it to be
fast. We optimise for the ascii case, knowing that all our
@@ -297,14 +297,14 @@ _PUBLIC_ void strupper_m(char *s)
if (!*s)
return;
- iconv_convenience = get_iconv_convenience();
+ iconv_handle = get_iconv_handle();
d = s;
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint_convenience(iconv_convenience, s, &c_size);
- c_size2 = push_codepoint_convenience(iconv_convenience, d, toupper_m(c));
+ codepoint_t c = next_codepoint_handle(iconv_handle, s, &c_size);
+ c_size2 = push_codepoint_handle(iconv_handle, d, toupper_m(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_m(c), (int)c_size, (int)c_size2));
@@ -322,12 +322,12 @@ _PUBLIC_ void strupper_m(char *s)
**/
_PUBLIC_ size_t count_chars_m(const char *s, char c)
{
- struct smb_iconv_convenience *ic = get_iconv_convenience();
+ struct smb_iconv_handle *ic = get_iconv_handle();
size_t count = 0;
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint_convenience(ic, s, &size);
+ codepoint_t c2 = next_codepoint_handle(ic, s, &size);
if (c2 == c) count++;
s += size;
}
@@ -669,7 +669,7 @@ _PUBLIC_ size_t convert_string(charset_t from, charset_t to,
void *dest, size_t destlen)
{
size_t ret;
- if (!convert_string_convenience(get_iconv_convenience(), from, to,
+ if (!convert_string_handle(get_iconv_handle(), from, to,
src, srclen,
dest, destlen, &ret))
return -1;
@@ -692,7 +692,7 @@ _PUBLIC_ bool convert_string_talloc(TALLOC_CTX *ctx,
void const *src, size_t srclen,
void *dest, size_t *converted_size)
{
- return convert_string_talloc_convenience(ctx, get_iconv_convenience(),
+ return convert_string_talloc_handle(ctx, get_iconv_handle(),
from, to, src, srclen, dest,
converted_size);
}
diff --git a/libgpo/gpo_fetch.c b/libgpo/gpo_fetch.c
index 00f9b5cc8a..40f8c5870d 100644
--- a/libgpo/gpo_fetch.c
+++ b/libgpo/gpo_fetch.c
@@ -175,7 +175,7 @@ static NTSTATUS gpo_connect_server(ADS_STRUCT *ads, struct loadparm_context *lp_
tevent_context_init(ads),
&options,
&session_options,
- lp_iconv_convenience(lp_ctx),
+ lp_iconv_handle(lp_ctx),
lp_gensec_settings(ads, lp_ctx));
if (!NT_STATUS_IS_OK(result)) {
DEBUG(10,("failed to connect: %s\n",
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 0c34317a3b..b334cfae81 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -61,7 +61,7 @@ void lazy_initialize_conv(void)
**/
void gfree_charcnv(void)
{
- TALLOC_FREE(global_iconv_convenience);
+ TALLOC_FREE(global_iconv_handle);
initialized = false;
}
@@ -74,9 +74,9 @@ void gfree_charcnv(void)
**/
void init_iconv(void)
{
- global_iconv_convenience = smb_iconv_convenience_reinit(NULL, lp_dos_charset(),
+ global_iconv_handle = smb_iconv_handle_reinit(NULL, lp_dos_charset(),
lp_unix_charset(), lp_display_charset(),
- true, global_iconv_convenience);
+ true, global_iconv_handle);
}
/**
@@ -102,10 +102,10 @@ static size_t convert_string_internal(charset_t from, charset_t to,
const char* inbuf = (const char*)src;
char* outbuf = (char*)dest;
smb_iconv_t descriptor;
- struct smb_iconv_convenience *ic;
+ struct smb_iconv_handle *ic;
lazy_initialize_conv();
- ic = get_iconv_convenience();
+ ic = get_iconv_handle();
descriptor = get_conv_handle(ic, from, to);
if (srclen == (size_t)-1) {
@@ -372,7 +372,7 @@ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
char *outbuf = NULL, *ob = NULL;
smb_iconv_t descriptor;
void **dest = (void **)dst;
- struct smb_iconv_convenience *ic;
+ struct smb_iconv_handle *ic;
*dest = NULL;
@@ -397,7 +397,7 @@ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
}
lazy_initialize_conv();
- ic = get_iconv_convenience();
+ ic = get_iconv_handle();
descriptor = get_conv_handle(ic, from, to);
if (descriptor == (smb_iconv_t)-1 || descriptor == (smb_iconv_t)0) {
diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c
index 8ac92cd478..5d288f69a7 100644
--- a/source4/kdc/kpasswdd.c
+++ b/source4/kdc/kpasswdd.c
@@ -238,7 +238,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc,
case KRB5_KPASSWD_VERS_CHANGEPW:
{
DATA_BLOB password;
- if (!convert_string_talloc_convenience(mem_ctx, lpcfg_iconv_convenience(kdc->task->lp_ctx),
+ if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(kdc->task->lp_ctx),
CH_UTF8, CH_UTF16,
(const char *)input->data,
input->length,
@@ -278,7 +278,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc,
reply);
}
- if (!convert_string_talloc_convenience(mem_ctx, lpcfg_iconv_convenience(kdc->task->lp_ctx),
+ if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(kdc->task->lp_ctx),
CH_UTF8, CH_UTF16,
(const char *)chpw.newpasswd.data,
chpw.newpasswd.length,
diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c
index 85473f3862..90ec8d6f42 100644
--- a/source4/libnet/libnet_samdump.c
+++ b/source4/libnet/libnet_samdump.c
@@ -185,7 +185,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
if (strcasecmp_m(s->name, secret_name) != 0) {
continue;
}
- if (!convert_string_talloc_convenience(mem_ctx, lpcfg_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX,
+ if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(ctx->lp_ctx), CH_UTF16, CH_UNIX,
s->secret.data, s->secret.length,
(void **)&secret_string, NULL)) {
r->out.error_string = talloc_asprintf(mem_ctx,
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 49d2e1cf74..f69dfd18c5 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -519,7 +519,7 @@ struct loadparm_context {
struct loadparm_global *globals;
struct loadparm_service **services;
struct loadparm_service *sDefault;
- struct smb_iconv_convenience *iconv_convenience;
+ struct smb_iconv_handle *iconv_handle;
int iNumServices;
struct loadparm_service *currentService;
bool bInGlobalSection;
@@ -2782,22 +2782,22 @@ int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service
return maxjobs;
}
-struct smb_iconv_convenience *lpcfg_iconv_convenience(struct loadparm_context *lp_ctx)
+struct smb_iconv_handle *lpcfg_iconv_handle(struct loadparm_context *lp_ctx)
{
if (lp_ctx == NULL) {
- return get_iconv_convenience();
+ return get_iconv_handle();
}
- return lp_ctx->iconv_convenience;
+ return lp_ctx->iconv_handle;
}
_PUBLIC_ void reload_charcnv(struct loadparm_context *lp_ctx)
{
- struct smb_iconv_convenience *old_ic = lp_ctx->iconv_convenience;
+ struct smb_iconv_handle *old_ic = lp_ctx->iconv_handle;
if (old_ic == NULL) {
- old_ic = global_iconv_convenience;
+ old_ic = global_iconv_handle;
}
- lp_ctx->iconv_convenience = smb_iconv_convenience_reinit_lp(lp_ctx, lp_ctx, old_ic);
- global_iconv_convenience = lp_ctx->iconv_convenience;
+ lp_ctx->iconv_handle = smb_iconv_handle_reinit_lp(lp_ctx, lp_ctx, old_ic);
+ global_iconv_handle = lp_ctx->iconv_handle;
}
void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
diff --git a/source4/param/param.h b/source4/param/param.h
index 19ec6322d3..b8fb369bdb 100644
--- a/source4/param/param.h
+++ b/source4/param/param.h
@@ -222,7 +222,7 @@ const char *lpcfg_printername(struct loadparm_service *service, struct loadparm_
* Return the max print jobs per queue.
*/
int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault);
-struct smb_iconv_convenience *lpcfg_iconv_convenience(struct loadparm_context *lp_ctx);
+struct smb_iconv_handle *lpcfg_iconv_handle(struct loadparm_context *lp_ctx);
void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
struct smbcli_options *options);
void lpcfg_smbcli_session_options(struct loadparm_context *lp_ctx,
@@ -334,9 +334,9 @@ bool run_init_functions(init_module_fn *fns);
init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *subsystem);
const char *lpcfg_messaging_path(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx);
-struct smb_iconv_convenience *smb_iconv_convenience_reinit_lp(TALLOC_CTX *mem_ctx,
+struct smb_iconv_handle *smb_iconv_handle_reinit_lp(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
- struct smb_iconv_convenience *old_ic);
+ struct smb_iconv_handle *old_ic);
const char *lpcfg_sam_name(struct loadparm_context *lp_ctx);
diff --git a/source4/param/util.c b/source4/param/util.c
index c6dca6076e..3413f25e49 100644
--- a/source4/param/util.c
+++ b/source4/param/util.c
@@ -298,11 +298,11 @@ const char *lpcfg_messaging_path(TALLOC_CTX *mem_ctx,
return smbd_tmp_path(mem_ctx, lp_ctx, "msg");
}
-struct smb_iconv_convenience *smb_iconv_convenience_reinit_lp(TALLOC_CTX *mem_ctx,
+struct smb_iconv_handle *smb_iconv_handle_reinit_lp(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
- struct smb_iconv_convenience *old_ic)
+ struct smb_iconv_handle *old_ic)
{
- return smb_iconv_convenience_reinit(mem_ctx, lpcfg_dos_charset(lp_ctx),
+ return smb_iconv_handle_reinit(mem_ctx, lpcfg_dos_charset(lp_ctx),
lpcfg_unix_charset(lp_ctx),
lpcfg_display_charset(lp_ctx),
lpcfg_parm_bool(lp_ctx, NULL, "iconv", "native", true),
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index 45cc498e48..873c0d8561 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -234,7 +234,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
return NT_STATUS_WRONG_PASSWORD;
}
- if (!convert_string_talloc_convenience(mem_ctx, lpcfg_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx),
+ if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(dce_call->conn->dce_ctx->lp_ctx),
CH_DOS, CH_UNIX,
(const char *)new_password.data,
new_password.length,
@@ -243,7 +243,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
return NT_STATUS_WRONG_PASSWORD;
}
- if (!convert_string_talloc_convenience(mem_ctx, lpcfg_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx),
+ if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(dce_call->conn->dce_ctx->lp_ctx),
CH_DOS, CH_UTF16,
(const char *)new_password.data,
new_password.length,
@@ -397,7 +397,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
* this) */
if (lm_pwd && r->in.lm_verifier != NULL) {
char *new_pass;
- if (!convert_string_talloc_convenience(mem_ctx, lpcfg_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx),
+ if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(dce_call->conn->dce_ctx->lp_ctx),
CH_UTF16, CH_UNIX,
(const char *)new_password.data,
new_password.length,
diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c
index 301efabf4f..e4974892c3 100644
--- a/source4/torture/basic/charset.c
+++ b/source4/torture/basic/charset.c
@@ -55,7 +55,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx,
}
SSVAL(ucs_name, i*2, 0);
- if (!convert_string_talloc_convenience(ucs_name, lpcfg_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, &i)) {
+ if (!convert_string_talloc_handle(ucs_name, lpcfg_iconv_handle(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, &i)) {
torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n");
talloc_free(ucs_name);
return NT_STATUS_NO_MEMORY;