#include "includes.h"
#include "pstring.h"
+#include "param/param.h"
/*
this is a tiny msrpc packet generator. I am only using this to
case 'U':
s = va_arg(ap, char *);
head_size += 8;
- n = push_ucs2_talloc(pointers, global_smb_iconv_convenience, (void **)&pointers[i].data, s);
+ n = push_ucs2_talloc(pointers, lp_iconv_convenience(global_loadparm), (void **)&pointers[i].data, s);
if (n == -1) {
return false;
}
case 'A':
s = va_arg(ap, char *);
head_size += 8;
- n = push_ascii_talloc(pointers, global_smb_iconv_convenience, (char **)&pointers[i].data, s);
+ n = push_ascii_talloc(pointers, lp_iconv_convenience(global_loadparm), (char **)&pointers[i].data, s);
if (n == -1) {
return false;
}
n = va_arg(ap, int);
intargs[i] = n;
s = va_arg(ap, char *);
- n = push_ucs2_talloc(pointers, global_smb_iconv_convenience, (void **)&pointers[i].data, s);
+ n = push_ucs2_talloc(pointers, lp_iconv_convenience(global_loadparm), (void **)&pointers[i].data, s);
if (n == -1) {
return false;
}
}
if (0 < len1) {
- pull_string(global_smb_iconv_convenience, p, blob->data + ptr, p_len,
+ pull_string(lp_iconv_convenience(global_loadparm), p, blob->data + ptr, p_len,
len1, STR_UNICODE|STR_NOALIGN);
(*ps) = talloc_strdup(mem_ctx, p);
if (!(*ps)) {
}
if (0 < len1) {
- pull_string(global_smb_iconv_convenience, p, blob->data + ptr, p_len,
+ pull_string(lp_iconv_convenience(global_loadparm), p, blob->data + ptr, p_len,
len1, STR_ASCII|STR_NOALIGN);
(*ps) = talloc_strdup(mem_ctx, p);
if (!(*ps)) {
goto cleanup;
}
- head_ofs += pull_string(global_smb_iconv_convenience, p,
+ head_ofs += pull_string(lp_iconv_convenience(global_loadparm), p,
blob->data+head_ofs, p_len,
blob->length - head_ofs,
STR_ASCII|STR_TERMINATE);
#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "param/param.h"
WERROR dsdb_load_oid_mappings_drsuapi(struct dsdb_schema *schema, const struct drsuapi_DsReplicaOIDMapping_Ctr *ctr)
{
} \
if (_a && _a->value_ctr.num_values >= 1) { \
ssize_t _ret; \
- _ret = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, \
+ _ret = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, \
_a->value_ctr.values[0].blob->data, \
_a->value_ctr.values[0].blob->length, \
(void **)discard_const(&(p)->elem)); \
#include "system/time.h"
#include "lib/charset/charset.h"
#include "librpc/ndr/libndr.h"
+#include "param/param.h"
static WERROR dsdb_syntax_FOOBAR_drsuapi_to_ldb(const struct dsdb_schema *schema,
const struct dsdb_attribute *attr,
return WERR_FOOBAR;
}
- ret = convert_string_talloc(out->values, global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ ret = convert_string_talloc(out->values, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
in->value_ctr.values[i].blob->data,
in->value_ctr.values[i].blob->length,
(void **)&str);
out->value_ctr.values[i].blob = &blobs[i];
- ret = convert_string_talloc(blobs, global_smb_iconv_convenience, CH_UNIX, CH_UTF16,
+ ret = convert_string_talloc(blobs, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
in->values[i].data,
in->values[i].length,
(void **)&blobs[i].data);
return WERR_FOOBAR;
}
- ret = convert_string_talloc(out->values, global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ ret = convert_string_talloc(out->values, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
in->value_ctr.values[i].blob->data+4,
in->value_ctr.values[i].blob->length-4,
(void **)&str);
out->value_ctr.values[i].blob = &blobs[i];
- ret = convert_string_talloc(blobs, global_smb_iconv_convenience, CH_UNIX, CH_UTF16,
+ ret = convert_string_talloc(blobs, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
in->values[i].data,
in->values[i].length,
(void **)&data);
#include "includes.h"
#include "system/locale.h"
#include "dynconfig.h"
+#include "param/param.h"
/**
* @file
if (s2 == NULL) return 1;
while (*s1 && *s2) {
- c1 = next_codepoint(global_smb_iconv_convenience, s1, &size1);
- c2 = next_codepoint(global_smb_iconv_convenience, s2, &size2);
+ c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1);
+ c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2);
s1 += size1;
s2 += size2;
while (*s1 && *s2 && n) {
n--;
- c1 = next_codepoint(global_smb_iconv_convenience, s1, &size1);
- c2 = next_codepoint(global_smb_iconv_convenience, s2, &size2);
+ c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1);
+ c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2);
s1 += size1;
s2 += size2;
{
while (s && *s) {
size_t size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, s, &size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &size);
if (c == oldc) {
*s = newc;
}
while (*s) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, s, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size);
if (c < 0x10000) {
count += 1;
} else {
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint(global_smb_iconv_convenience, s, &size);
+ codepoint_t c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s, &size);
if (c2 == c) {
return discard_const_p(char, s);
}
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint(global_smb_iconv_convenience, s, &size);
+ codepoint_t c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s, &size);
if (c2 == c) {
ret = discard_const_p(char, s);
}
codepoint_t s;
codepoint_t t;
- s = next_codepoint(global_smb_iconv_convenience, string, &c_size);
+ s = next_codepoint(lp_iconv_convenience(global_loadparm), string, &c_size);
string += c_size;
t = toupper_w(s);
codepoint_t s;
codepoint_t t;
- s = next_codepoint(global_smb_iconv_convenience, string, &c_size);
+ s = next_codepoint(lp_iconv_convenience(global_loadparm), string, &c_size);
string += c_size;
t = tolower_w(s);
while (*src) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, src, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size);
src += c_size;
c = tolower_w(c);
- c_size = push_codepoint(global_smb_iconv_convenience, dest+size, c);
+ c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
while (*src) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, src, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size);
src += c_size;
c = toupper_w(c);
- c_size = push_codepoint(global_smb_iconv_convenience, dest+size, c);
+ c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, s, &c_size);
- c_size2 = push_codepoint(global_smb_iconv_convenience, d, tolower_w(c));
+ 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));
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));
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, s, &c_size);
- c_size2 = push_codepoint(global_smb_iconv_convenience, d, toupper_w(c));
+ 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));
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));
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint(global_smb_iconv_convenience, s, &size);
+ codepoint_t c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s, &size);
if (c2 == c) count++;
s += size;
}
#line 23 "lex.l"
#include "includes.h"
#include "lib/policy/parse_adm.h"
+#include "param/param.h"
void error_message (const char *format, ...);
int yyparse (void);
if (fread(&v, 2, 1, yyin) < 1) \
result = YY_NULL; \
else \
- result = push_codepoint(global_smb_iconv_convenience, buf, v); \
+ result = push_codepoint(lp_iconv_convenience(global_loadparm), buf, v); \
} else { \
int c = getc(yyin); \
result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
{
case REG_SZ:
case REG_EXPAND_SZ:
- data->length = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF8, CH_UTF16,
+ data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF8, CH_UTF16,
val->data, val->length,
(void **)&data->data);
break;
switch (type) {
case REG_SZ:
case REG_EXPAND_SZ:
- val.length = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ val.length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
(void *)data.data,
data.length,
(void **)&val.data);
#include "lib/registry/registry.h"
#include "lib/registry/patchfile.h"
#include "system/filesys.h"
+#include "param/param.h"
struct preg_data {
int fd;
if (read(fd, &v, 2) < 2) {
return WERR_GENERAL_FAILURE;
}
- push_codepoint(global_smb_iconv_convenience, c, v);
+ push_codepoint(lp_iconv_convenience(global_loadparm), c, v);
return WERR_OK;
}
#include "includes.h"
#include "lib/registry/registry.h"
#include "librpc/gen_ndr/winreg.h"
+#include "param/param.h"
/**
* @file
switch (type) {
case REG_EXPAND_SZ:
case REG_SZ:
- convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
data.data, data.length,
(void **)&ret);
return ret;
{
case REG_SZ:
case REG_EXPAND_SZ:
- data->length = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UNIX, CH_UTF16,
+ data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
data_str, strlen(data_str),
(void **)&data->data);
break;
#include "system/filesys.h"
#include "system/network.h"
#include "tdr/tdr.h"
+#include "param/param.h"
#define TDR_BASE_MARSHALL_SIZE 1024
TDR_PULL_NEED_BYTES(tdr, el_size*length);
- ret = convert_string_talloc(ctx, global_smb_iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v));
+ ret = convert_string_talloc(ctx, lp_iconv_convenience(global_loadparm), chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v));
if (ret == -1) {
return NT_STATUS_INVALID_PARAMETER;
required = el_size * length;
TDR_PUSH_NEED_BYTES(tdr, required);
- ret = convert_string(global_smb_iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required);
+ ret = convert_string(lp_iconv_convenience(global_loadparm), CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required);
if (ret == -1) {
return NT_STATUS_INVALID_PARAMETER;
vasprintf(&s, format, ap);
va_end(ap);
- for (i=0;i<tdr->level;i++) {
- DEBUG(0,(" "));
- }
+ for (i=0;i<tdr->level;i++) { DEBUG(0,(" ")); }
DEBUG(0,("%s\n", s));
free(s);
#include "includes.h"
#include "system/locale.h"
+#include "param/param.h"
_PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBUTE(2,0)
{
SAFE_FREE(p);
return -1;
}
- clen = convert_string(global_smb_iconv_convenience, CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen);
+ clen = convert_string(lp_iconv_convenience(global_loadparm), CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen);
if (clen == -1) {
/* the string can't be converted - do the best we can,
filling in non-printing chars with '?' */
*/
#include "includes.h"
+#include "param/param.h"
static int null_match(const char *p)
{
int i;
size_t size, size_n;
- while ((c = next_codepoint(global_smb_iconv_convenience, p, &size))) {
+ while ((c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &size))) {
p += size;
switch (c) {
return null_match(p);
}
for (i=0; n[i]; i += size_n) {
- next_codepoint(global_smb_iconv_convenience, n+i, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n+i, &size_n);
if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) {
return 0;
}
return -1;
}
for (i=0; n[i]; i += size_n) {
- next_codepoint(global_smb_iconv_convenience, n+i, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n+i, &size_n);
if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) return 0;
if (n+i == ldot) {
if (ms_fnmatch_core(p, n+i+size_n, max_n+1, ldot) == 0) return 0;
if (! *n) {
return -1;
}
- next_codepoint(global_smb_iconv_convenience, n, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
n += size_n;
break;
break;
}
if (! *n) return null_match(p);
- next_codepoint(global_smb_iconv_convenience, n, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
n += size_n;
break;
return 0;
}
if (*n != '.') return -1;
- next_codepoint(global_smb_iconv_convenience, n, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
n += size_n;
break;
default:
- c2 = next_codepoint(global_smb_iconv_convenience, n, &size_n);
+ c2 = next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
if (c != c2 && codepoint_cmpi(c, c2) != 0) {
return -1;
}
#include "lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "pstring.h"
+#include "param/param.h"
/*
This implements the X/Open SMB password encryption
int len;
void *wpwd;
- len = push_ucs2_talloc(NULL, global_smb_iconv_convenience, &wpwd, passwd);
+ len = push_ucs2_talloc(NULL, lp_iconv_convenience(global_loadparm), &wpwd, passwd);
if (len < 2) {
/* We don't want to return fixed data, as most callers
* don't check */
ZERO_STRUCT(dospwd);
/* Password must be converted to DOS charset - null terminated, uppercase. */
- push_string(global_smb_iconv_convenience, dospwd, passwd, sizeof(dospwd), STR_ASCII|STR_UPPER|STR_TERMINATE);
+ push_string(lp_iconv_convenience(global_loadparm), dospwd, passwd, sizeof(dospwd), STR_ASCII|STR_UPPER|STR_TERMINATE);
/* Only the fisrt 14 chars are considered, password need not be null terminated. */
E_P16((const uint8_t *)dospwd, p16);
}
}
- user_byte_len = push_ucs2_talloc(mem_ctx, global_smb_iconv_convenience, &user, user_in);
+ user_byte_len = push_ucs2_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), &user, user_in);
if (user_byte_len == (ssize_t)-1) {
DEBUG(0, ("push_uss2_talloc() for user returned -1 (probably talloc() failure)\n"));
talloc_free(mem_ctx);
return false;
}
- domain_byte_len = push_ucs2_talloc(mem_ctx, global_smb_iconv_convenience, &domain, domain_in);
+ domain_byte_len = push_ucs2_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), &domain, domain_in);
if (domain_byte_len == (ssize_t)-1) {
DEBUG(0, ("push_ucs2_talloc() for domain returned -1 (probably talloc() failure)\n"));
talloc_free(mem_ctx);
/* the incoming buffer can be any alignment. */
string_flags |= STR_NOALIGN;
- new_pw_len = push_string(global_smb_iconv_convenience, new_pw,
+ new_pw_len = push_string(lp_iconv_convenience(global_loadparm), new_pw,
password,
sizeof(new_pw), string_flags);
}
/* decode into the return buffer. Buffer length supplied */
- *new_pw_len = pull_string(global_smb_iconv_convenience, new_pwrd, &in_buffer[512 - byte_len], new_pwrd_size,
+ *new_pw_len = pull_string(lp_iconv_convenience(global_loadparm), new_pwrd, &in_buffer[512 - byte_len], new_pwrd_size,
byte_len, string_flags);
#ifdef DEBUG_PASSWORD
#include "includes.h"
#include "libcli/raw/libcliraw.h"
#include "librpc/gen_ndr/ndr_security.h"
+#include "param/param.h"
/* local macros to make the code more readable */
#define FINFO_CHECK_MIN_SIZE(size) if (blob->length < (size)) { \
return NT_STATUS_INFO_LENGTH_MISMATCH;
}
size = convert_string_talloc(io->streams,
- global_smb_iconv_convenience,
+ lp_iconv_convenience(global_loadparm),
CH_UTF16, CH_UNIX,
blob.data+ofs+24, nlen, &vstr);
if (size == -1) {
#include "libcli/raw/libcliraw.h"
#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
+#include "param/param.h"
/* we over allocate the data buffer to prevent too many realloc calls */
#define REQ_OVER_ALLOCATION 0
smbcli_req_grow_allocation(req, len + req->out.data_size);
- len = push_string(global_smb_iconv_convenience, req->out.data + req->out.data_size, str, len, flags);
+ len = push_string(lp_iconv_convenience(global_loadparm), req->out.data + req->out.data_size, str, len, flags);
smbcli_req_grow_data(req, len + req->out.data_size);
return 0;
}
- ret = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest);
+ ret = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, src, src_len2, (void **)dest);
if (ret == -1) {
*dest = NULL;
return 0;
src_len2++;
}
- ret = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_DOS, CH_UNIX, src, src_len2, (void **)dest);
+ ret = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_DOS, CH_UNIX, src, src_len2, (void **)dest);
if (ret == -1) {
*dest = NULL;
src_len2 = utf16_len_n(src, src_len);
- ret = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2);
+ ret = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2);
if (ret == -1) {
*dest = NULL;
return 0;
src_len2++;
}
- ret = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2);
+ ret = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2);
if (ret == -1) {
*dest = NULL;
return 0;
}
- len = push_string(global_smb_iconv_convenience, blob->data + blob->length, str, max_len, flags);
+ len = push_string(lp_iconv_convenience(global_loadparm), blob->data + blob->length, str, max_len, flags);
blob->length += len;
#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
#include "libcli/smb2/smb2_calls.h"
+#include "param/param.h"
/*
initialise a smb2 request
return NT_STATUS_OK;
}
- size = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ size = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
blob.data, blob.length, &vstr);
data_blob_free(&blob);
(*str) = (char *)vstr;
return smb2_push_o16s16_blob(buf, ofs, data_blob(NULL, 0));
}
- size = convert_string_talloc(buf->buffer, global_smb_iconv_convenience, CH_UNIX, CH_UTF16,
+ size = convert_string_talloc(buf->buffer, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
str, strlen(str), (void **)&blob.data);
if (size == -1) {
return NT_STATUS_ILLEGAL_CHARACTER;
#include "librpc/ndr/libndr.h"
#include "lib/util/dlinklist.h"
#include "librpc/gen_ndr/dcerpc.h"
+#include "param/param.h"
#define NDR_BASE_MARSHALL_SIZE 1024
ndr->data = blob->data;
ndr->data_size = blob->length;
- ndr->iconv_convenience = talloc_reference(ndr, global_smb_iconv_convenience);
+ ndr->iconv_convenience = talloc_reference(ndr, lp_iconv_convenience(global_loadparm));
return ndr;
}
if (!ndr->data) {
return NULL;
}
- ndr->iconv_convenience = talloc_reference(ndr, global_smb_iconv_convenience);
+ ndr->iconv_convenience = talloc_reference(ndr, lp_iconv_convenience(global_loadparm));
return ndr;
}
#include "includes.h"
#include "vfs_posix.h"
#include "librpc/gen_ndr/security.h"
+#include "param/param.h"
/*
while (*p2) {
codepoint_t c1, c2;
size_t c_size1, c_size2;
- c1 = next_codepoint(global_smb_iconv_convenience, p1, &c_size1);
- c2 = next_codepoint(global_smb_iconv_convenience, p2, &c_size2);
+ c1 = next_codepoint(lp_iconv_convenience(global_loadparm), p1, &c_size1);
+ c2 = next_codepoint(lp_iconv_convenience(global_loadparm), p2, &c_size2);
if (c2 == '?') {
- d += push_codepoint(global_smb_iconv_convenience, d, c1);
+ d += push_codepoint(lp_iconv_convenience(global_loadparm), d, c1);
} else if (c2 == '*') {
memcpy(d, p1, strlen(p1));
d += strlen(p1);
break;
} else {
- d += push_codepoint(global_smb_iconv_convenience, d, c2);
+ d += push_codepoint(lp_iconv_convenience(global_loadparm), d, c2);
}
p1 += c_size1;
#include "includes.h"
#include "vfs_posix.h"
#include "system/dir.h"
+#include "param/param.h"
-/*
+/**
compare two filename components. This is where the name mangling hook will go
*/
static int component_compare(struct pvfs_state *pvfs, const char *comp, const char *name)
while (*p) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, p, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &c_size);
switch (c) {
case '\\':
if (name->has_wildcard) {
if (s == NULL) return NT_STATUS_NO_MEMORY;
for (num_components=1, p=s; *p; p += c_size) {
- c = next_codepoint(global_smb_iconv_convenience, p, &c_size);
+ c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &c_size);
if (c == '\\') num_components++;
}
components[0] = s;
for (i=0, p=s; *p; p += c_size) {
- c = next_codepoint(global_smb_iconv_convenience, p, &c_size);
+ c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &c_size);
if (c == '\\') {
*p = 0;
components[++i] = p+1;
{
while (*name) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, name, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), name, &c_size);
if (c == INVALID_CODEPOINT) {
return false;
}
#include "includes.h"
#include "vfs_posix.h"
+#include "param/param.h"
/*
return true if a string contains one of the CIFS wildcard characters
while (*key && length--) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, key, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), key, &c_size);
c = toupper_w(c);
value *= fnv1_prime;
value ^= (uint32_t)c;
p = (char *)io->ioctl.out.blob.data;
SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
- push_string(global_smb_iconv_convenience, p+2, lp_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
- push_string(global_smb_iconv_convenience, p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
+ push_string(lp_iconv_convenience(global_loadparm), p+2, lp_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
+ push_string(lp_iconv_convenience(global_loadparm), p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
return NT_STATUS_OK;
}
time_t modtime;
} *file_lists;
unsigned int flags[NUMPARAMETERS];
+ struct smb_iconv_convenience *iconv_convenience;
};
}
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-/* Returned value is allocated in 'lp_talloc' context */
+/**
+ * Return parametric option from a given service. Type is a part of option before ':'
+ * Parametric option has following syntax: 'Type: option = value'
+ * Returned value is allocated in 'lp_talloc' context
+ */
const char *lp_parm_string(struct loadparm_context *lp_ctx,
struct loadparm_service *service, const char *type,
return NULL;
}
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-/* Returned value is allocated in 'lp_talloc' context */
+/**
+ * Return parametric option from a given service. Type is a part of option before ':'
+ * Parametric option has following syntax: 'Type: option = value'
+ * Returned value is allocated in 'lp_talloc' context
+ */
const char **lp_parm_string_list(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
return NULL;
}
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
+/**
+ * Return parametric option from a given service. Type is a part of option before ':'
+ * Parametric option has following syntax: 'Type: option = value'
+ */
int lp_parm_int(struct loadparm_context *lp_ctx,
struct loadparm_service *service, const char *type,
return default_v;
}
-/* Return parametric option from a given service. Type is a part of
+/**
+ * Return parametric option from a given service. Type is a part of
* option before ':'.
* Parametric option has following syntax: 'Type: option = value'.
*/
return default_v;
}
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-
+/**
+ * Return parametric option from a given service.
+ * Type is a part of option before ':'
+ * Parametric option has following syntax: 'Type: option = value'
+ */
unsigned long lp_parm_ulong(struct loadparm_context *lp_ctx,
struct loadparm_service *service, const char *type,
const char *option, unsigned long default_v)
return default_v;
}
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
+/**
+ * Return parametric option from a given service. Type is a part of option before ':'
+ * Parametric option has following syntax: 'Type: option = value'
+ */
bool lp_parm_bool(struct loadparm_context *lp_ctx,
struct loadparm_service *service, const char *type,
}
/**
- Set a string value, deallocating any existing space, and allocing the space
- for the string
-**/
+ * Set a string value, deallocating any existing space, and allocing the space
+ * for the string
+ */
static bool string_set(TALLOC_CTX *mem_ctx, char **dest, const char *src)
{
talloc_free(*dest);
panic_action = lp_ctx->globals->panic_action;
- reload_charcnv();
+ reload_charcnv(lp_ctx);
return bRetval;
}
return maxjobs;
}
+
+struct smb_iconv_convenience *lp_iconv_convenience(struct loadparm_context *lp_ctx)
+{
+ if (lp_ctx == NULL) {
+ return smb_iconv_convenience_init(talloc_autofree_context(),
+ "CP850", "UTF8", "UTF8", true);
+ }
+ return lp_ctx->iconv_convenience;
+}
+
+_PUBLIC_ void reload_charcnv(struct loadparm_context *lp_ctx)
+{
+ talloc_free(lp_ctx->iconv_convenience);
+ lp_ctx->iconv_convenience = smb_iconv_convenience_init_lp(lp_ctx, lp_ctx);
+}
return smbd_tmp_path(mem_ctx, lp_ctx, "messaging");
}
-struct smb_iconv_convenience *global_smb_iconv_convenience = NULL;
-
-struct smb_iconv_convenience *lp_iconv_convenience(struct loadparm_context *lp_ctx)
-{
- return global_smb_iconv_convenience;
-}
-
struct smb_iconv_convenience *smb_iconv_convenience_init_lp(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx)
{
lp_parm_bool(lp_ctx, NULL, "iconv", "native", true));
}
-_PUBLIC_ void reload_charcnv(void)
-{
- talloc_free(global_smb_iconv_convenience);
- global_smb_iconv_convenience = smb_iconv_convenience_init_lp(talloc_autofree_context(), global_loadparm);
-}
+
case REG_EXPAND_SZ: {
char *s;
ssize_t len;
- len = convert_string_talloc(mprMemCtx(), global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ len = convert_string_talloc(mprMemCtx(), lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
blob->data, blob->length, (void **)&s);
if (len == -1) {
ejsSetErrorMsg(eid, "regToVar invalid REG_SZ string");
if (slen == 2 && b.length == 2 && SVAL(b.data, 0) == 0) {
break;
}
- len = convert_string_talloc(mprMemCtx(), global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ len = convert_string_talloc(mprMemCtx(), lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
b.data, slen, (void **)&s);
if (len == -1) {
ejsSetErrorMsg(eid, "regToVar invalid REG_MULTI_SZ string");
#include "librpc/gen_ndr/ndr_misc.h"
#include "ntvfs/ntvfs.h"
#include "libcli/raw/libcliraw.h"
+#include "param/param.h"
#define BLOB_CHECK(cmd) do { \
NTSTATUS _status; \
alignment = 1;
if (dest_len > 0) {
SCVAL(blob->data + offset, 0, 0);
- ret = push_string(global_smb_iconv_convenience, blob->data + offset + 1, str, dest_len-1, flags);
+ ret = push_string(lp_iconv_convenience(global_loadparm), blob->data + offset + 1, str, dest_len-1, flags);
}
} else {
- ret = push_string(global_smb_iconv_convenience, blob->data + offset, str, dest_len, flags);
+ ret = push_string(lp_iconv_convenience(global_loadparm), blob->data + offset, str, dest_len, flags);
}
/* sometimes the string needs to be terminated, but the length
#include "ntvfs/ntvfs.h"
#include "libcli/raw/libcliraw.h"
#include "librpc/gen_ndr/ndr_security.h"
+#include "param/param.h"
/*
hold the state of a nttrans op while in progress. Needed to allow for async backend
ssize_t len;
SIVAL(p, 4, info->nttrans.out.changes[i].action);
- len = push_string(global_smb_iconv_convenience, p + 12, info->nttrans.out.changes[i].name.s,
+ len = push_string(lp_iconv_convenience(global_loadparm), p + 12, info->nttrans.out.changes[i].name.s,
op->trans->out.params.length -
(p+12 - op->trans->out.params.data), STR_UNICODE);
SIVAL(p, 8, len);
#include "smbd/service_stream.h"
#include "lib/stream/packet.h"
#include "ntvfs/ntvfs.h"
+#include "param/param.h"
/* we over allocate the data buffer to prevent too many realloc calls */
dest = req->out.buffer + PTR_DIFF(dest, buf0);
}
- len = push_string(global_smb_iconv_convenience, dest, str, len, flags);
+ len = push_string(lp_iconv_convenience(global_loadparm), dest, str, len, flags);
grow_size = len + PTR_DIFF(dest, req->out.data);
return src_len2 + alignment;
}
- ret = convert_string_talloc(req, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2);
+ ret = convert_string_talloc(req, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2);
if (ret == -1) {
*dest = NULL;
src_len2++;
}
- ret = convert_string_talloc(req, global_smb_iconv_convenience, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2);
+ ret = convert_string_talloc(req, lp_iconv_convenience(global_loadparm), CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2);
if (ret == -1) {
*dest = NULL;
#include "smb_server/service_smb_proto.h"
#include "smb_server/smb2/smb2_server.h"
#include "ntvfs/ntvfs.h"
+#include "param/param.h"
static void smb2srv_create_send(struct ntvfs_request *ntvfs)
{
ssize_t len;
SIVAL(p, 4, io->smb2.out.changes[i].action);
- len = push_string(global_smb_iconv_convenience, p + 12, io->smb2.out.changes[i].name.s,
+ len = push_string(lp_iconv_convenience(global_loadparm), p + 12, io->smb2.out.changes[i].name.s,
blob.length - (p+12 - blob.data), STR_UNICODE);
SIVAL(p, 8, len);
/* this reload_charcnv() has the effect of freeing the iconv context memory,
which makes leak checking easier */
- reload_charcnv();
+ reload_charcnv(global_loadparm);
/* the secrets db should really hang off the connection structure */
secrets_shutdown();
#include "libcli/raw/libcliraw.h"
#include "libcli/libcli.h"
#include "torture/util.h"
+#include "param/param.h"
#define BASEDIR "\\chartest\\"
}
SSVAL(ucs_name, i*2, 0);
- i = convert_string_talloc(ucs_name, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname);
+ i = convert_string_talloc(ucs_name, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname);
if (i == -1) {
torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n");
talloc_free(ucs_name);
#include "libcli/raw/libcliraw.h"
#include "system/filesys.h"
#include "pstring.h"
+#include "param/param.h"
#define VERBOSE 0
#define OP_MIN 0
SSVAL(param, 0, level);
SSVAL(param, 2, 0);
SSVAL(param, 4, 0);
- param_len += push_string(global_smb_iconv_convenience, ¶m[6], fname, sizeof(pstring)-7, STR_TERMINATE|STR_UNICODE);
+ param_len += push_string(lp_iconv_convenience(global_loadparm), ¶m[6], fname, sizeof(pstring)-7, STR_TERMINATE|STR_UNICODE);
status = try_trans2_len(cli, "fname", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
SSVAL(param, 0, level);
SSVAL(param, 2, 0);
SSVAL(param, 4, 0);
- param_len += push_string(global_smb_iconv_convenience, ¶m[6], "\\newfile.dat", sizeof(pstring)-7, STR_TERMINATE|STR_UNICODE);
+ param_len += push_string(lp_iconv_convenience(global_loadparm), ¶m[6], "\\newfile.dat", sizeof(pstring)-7, STR_TERMINATE|STR_UNICODE);
status = try_trans2_len(cli, "newfile", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
smbcli_mkdir(cli->tree, "\\testdir");
param_len = 2;
SSVAL(param, 0, level);
- param_len += push_string(global_smb_iconv_convenience, ¶m[2], "\\testdir", sizeof(pstring)-3, STR_TERMINATE|STR_UNICODE);
+ param_len += push_string(lp_iconv_convenience(global_loadparm), ¶m[2], "\\testdir", sizeof(pstring)-3, STR_TERMINATE|STR_UNICODE);
status = try_trans2_len(cli, "dfs", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
SSVAL(param, 0, level);
SSVAL(param, 2, 0);
SSVAL(param, 4, 0);
- param_len += push_string(global_smb_iconv_convenience, ¶m[6], fname, sizeof(pstring), STR_TERMINATE | STR_UNICODE);
+ param_len += push_string(lp_iconv_convenience(global_loadparm), ¶m[6], fname, sizeof(pstring), STR_TERMINATE | STR_UNICODE);
status = try_nttrans_len(cli, "fname", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
SSVAL(param, 0, level);
SSVAL(param, 2, 0);
SSVAL(param, 4, 0);
- param_len += push_string(global_smb_iconv_convenience, ¶m[6], "\\newfile.dat", sizeof(pstring), STR_TERMINATE | STR_UNICODE);
+ param_len += push_string(lp_iconv_convenience(global_loadparm), ¶m[6], "\\newfile.dat", sizeof(pstring), STR_TERMINATE | STR_UNICODE);
status = try_nttrans_len(cli, "newfile", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
smbcli_mkdir(cli->tree, "\\testdir");
param_len = 2;
SSVAL(param, 0, level);
- param_len += push_string(global_smb_iconv_convenience, ¶m[2], "\\testdir", sizeof(pstring), STR_TERMINATE | STR_UNICODE);
+ param_len += push_string(lp_iconv_convenience(global_loadparm), ¶m[2], "\\testdir", sizeof(pstring), STR_TERMINATE | STR_UNICODE);
status = try_nttrans_len(cli, "dfs", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
#include "libcli/libcli.h"
#include "torture/util.h"
#include "pstring.h"
+#include "param/param.h"
bool torture_utable(struct torture_context *tctx,
struct smbcli_state *cli)
SSVAL(c2, 0, c);
fstrcpy(fname, "\\utable\\x");
p = fname+strlen(fname);
- len = convert_string(global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ len = convert_string(lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
c2, 2,
p, sizeof(fname)-strlen(fname));
p[len] = 0;
p = fname+strlen(fname);
SSVAL(c2, 0, c);
- len = convert_string(global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ len = convert_string(lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
c2, 2,
p, sizeof(fname)-strlen(fname));
p[len] = 0;
seed = time(NULL);
- reload_charcnv();
-
while ((opt = getopt(argc, argv, "n:d:U:s:hm:f:aoW:M:vEl:")) != EOF) {
switch (opt) {
case 'n':
#include "libcli/raw/libcliraw.h"
#include "libcli/libcli.h"
#include "librpc/ndr/libndr.h"
+#include "param/param.h"
#define RAP_GOTO(call) do { \
NTSTATUS _status; \
return NT_STATUS_INVALID_PARAMETER;
*dest = talloc_zero_array(mem_ctx, char, len+1);
- pull_string(global_smb_iconv_convenience, *dest, p, len+1, len, STR_ASCII);
+ pull_string(lp_iconv_convenience(global_loadparm), *dest, p, len+1, len, STR_ASCII);
return NT_STATUS_OK;
}
memcpy(servername, r.out.info.info0.name, 16);
servername[16] = '\0';
- if (pull_ascii_talloc(mem_ctx, global_smb_iconv_convenience,
+ if (pull_ascii_talloc(mem_ctx, lp_iconv_convenience(global_loadparm),
name, servername) < 0) {
return NT_STATUS_NO_MEMORY;
}
ZERO_STRUCT(user_session_key);
if ((push_ucs2_talloc(samlogon_state->mem_ctx,
- global_smb_iconv_convenience,
+ lp_iconv_convenience(global_loadparm),
&unicodepw, samlogon_state->password)) == -1) {
DEBUG(0, ("push_ucs2_allocate failed!\n"));
exit(1);
password = strupper_talloc(samlogon_state->mem_ctx, samlogon_state->password);
if ((convert_string_talloc(samlogon_state->mem_ctx,
- global_smb_iconv_convenience,
+ lp_iconv_convenience(global_loadparm),
CH_UNIX, CH_DOS,
password, strlen(password)+1,
(void**)&dospw)) == -1) {
torture_assert_werr_ok(tctx, epk.out.result, "EnumPrinterKey failed");
- convert_string_talloc(ctx, global_smb_iconv_convenience, CH_UTF16,
+ convert_string_talloc(ctx, lp_iconv_convenience(global_loadparm), CH_UTF16,
CH_UNIX, epk.out.key_buffer, epk.out.needed,
(void**)&ctx->printer_keys);
size_t size;
uint8_t *msg;
- size = push_ucs2_talloc(tctx, global_smb_iconv_convenience,
+ size = push_ucs2_talloc(tctx, lp_iconv_convenience(global_loadparm),
(void **)&msg, message);
r.in.server_name = dcerpc_server_name(p);
for (o = torture_root->children; o; o = o->next) {
if (gen_fnmatch(expr, o->name) == 0) {
*matched = true;
- reload_charcnv();
+ reload_charcnv(torture->lp_ctx);
ret &= torture_run_suite(torture, o);
continue;
}
if (gen_fnmatch(expr, name) == 0) {
*matched = true;
- reload_charcnv();
+ reload_charcnv(torture->lp_ctx);
torture->active_testname = talloc_strdup(torture, prefix);
ret &= torture_run_suite(torture, c);
free(name);
asprintf(&name, "%s-%s", prefix, t->name);
if (gen_fnmatch(expr, name) == 0) {
*matched = true;
- reload_charcnv();
+ reload_charcnv(torture->lp_ctx);
torture->active_testname = talloc_strdup(torture, prefix);
ret &= torture_run_tcase(torture, t);
talloc_free(torture->active_testname);