1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

Remove uses of global_loadparm.

(This used to be commit a16c9a2129)
This commit is contained in:
Jelmer Vernooij
2008-02-25 12:51:55 +01:00
parent 4590432d62
commit 3101cb888d
8 changed files with 20 additions and 14 deletions

View File

@ -27,6 +27,7 @@
_PUBLIC_ WERROR reg_preg_diff_load(int fd, _PUBLIC_ WERROR reg_preg_diff_load(int fd,
struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks, const struct reg_diff_callbacks *callbacks,
void *callback_data); void *callback_data);
@ -306,7 +307,7 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename,
#endif #endif
if (strncmp(hdr, "PReg", 4) == 0) { if (strncmp(hdr, "PReg", 4) == 0) {
/* Must be a GPO Registry.pol file */ /* Must be a GPO Registry.pol file */
return reg_preg_diff_load(fd, callbacks, callback_data); return reg_preg_diff_load(fd, iconv_convenience, callbacks, callback_data);
} else { } else {
/* Must be a normal .REG file */ /* Must be a normal .REG file */
return reg_dotreg_diff_load(fd, iconv_convenience, callbacks, callback_data); return reg_dotreg_diff_load(fd, iconv_convenience, callbacks, callback_data);

View File

@ -43,6 +43,7 @@ WERROR reg_generate_diff(struct registry_context *ctx1,
const struct reg_diff_callbacks *callbacks, const struct reg_diff_callbacks *callbacks,
void *callback_data); void *callback_data);
WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
struct smb_iconv_convenience *iconv_convenience,
struct reg_diff_callbacks **callbacks, struct reg_diff_callbacks **callbacks,
void **callback_data); void **callback_data);
WERROR reg_generate_diff_key(struct registry_key *oldkey, WERROR reg_generate_diff_key(struct registry_key *oldkey,

View File

@ -101,6 +101,7 @@ static WERROR reg_dotreg_diff_del_all_values(void *callback_data,
* Save registry diff * Save registry diff
*/ */
_PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
struct smb_iconv_convenience *iconv_convenience,
struct reg_diff_callbacks **callbacks, struct reg_diff_callbacks **callbacks,
void **callback_data) void **callback_data)
{ {
@ -109,7 +110,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
data = talloc_zero(ctx, struct dotreg_data); data = talloc_zero(ctx, struct dotreg_data);
*callback_data = data; *callback_data = data;
data->iconv_convenience = lp_iconv_convenience(global_loadparm); data->iconv_convenience = iconv_convenience;
if (filename) { if (filename) {
data->fd = open(filename, O_CREAT, 0755); data->fd = open(filename, O_CREAT, 0755);

View File

@ -29,14 +29,14 @@ struct preg_data {
int fd; int fd;
}; };
static WERROR preg_read_utf16(int fd, char *c) static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c)
{ {
uint16_t v; uint16_t v;
if (read(fd, &v, 2) < 2) { if (read(fd, &v, 2) < 2) {
return WERR_GENERAL_FAILURE; return WERR_GENERAL_FAILURE;
} }
push_codepoint(lp_iconv_convenience(global_loadparm), c, v); push_codepoint(ic, c, v);
return WERR_OK; return WERR_OK;
} }
@ -123,6 +123,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
* Load diff file * Load diff file
*/ */
_PUBLIC_ WERROR reg_preg_diff_load(int fd, _PUBLIC_ WERROR reg_preg_diff_load(int fd,
struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks, const struct reg_diff_callbacks *callbacks,
void *callback_data) void *callback_data)
{ {
@ -162,7 +163,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
while(1) { while(1) {
uint32_t value_type, length; uint32_t value_type, length;
if (!W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr))) { if (!W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr))) {
break; break;
} }
if (*buf_ptr != '[') { if (*buf_ptr != '[') {
@ -173,7 +174,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
/* Get the path */ /* Get the path */
buf_ptr = buf; buf_ptr = buf;
while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr != ';' && buf_ptr-buf < buf_size) { *buf_ptr != ';' && buf_ptr-buf < buf_size) {
buf_ptr++; buf_ptr++;
} }
@ -181,7 +182,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
/* Get the name */ /* Get the name */
buf_ptr = buf; buf_ptr = buf;
while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr != ';' && buf_ptr-buf < buf_size) { *buf_ptr != ';' && buf_ptr-buf < buf_size) {
buf_ptr++; buf_ptr++;
} }
@ -195,7 +196,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
} }
/* Read past delimiter */ /* Read past delimiter */
buf_ptr = buf; buf_ptr = buf;
if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr == ';') && buf_ptr-buf < buf_size) { *buf_ptr == ';') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Error in PReg file.\n")); DEBUG(0, ("Error in PReg file.\n"));
ret = WERR_GENERAL_FAILURE; ret = WERR_GENERAL_FAILURE;
@ -209,7 +210,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
} }
/* Read past delimiter */ /* Read past delimiter */
buf_ptr = buf; buf_ptr = buf;
if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr == ';') && buf_ptr-buf < buf_size) { *buf_ptr == ';') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Error in PReg file.\n")); DEBUG(0, ("Error in PReg file.\n"));
ret = WERR_GENERAL_FAILURE; ret = WERR_GENERAL_FAILURE;
@ -227,7 +228,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
/* Check if delimiter is in place (whine if it isn't) */ /* Check if delimiter is in place (whine if it isn't) */
buf_ptr = buf; buf_ptr = buf;
if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
*buf_ptr == ']') && buf_ptr-buf < buf_size) { *buf_ptr == ']') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Warning: Missing ']' in PReg file, expected ']', got '%c' 0x%x.\n", DEBUG(0, ("Warning: Missing ']' in PReg file, expected ']', got '%c' 0x%x.\n",
*buf_ptr, *buf_ptr)); *buf_ptr, *buf_ptr));

View File

@ -126,7 +126,7 @@ int main(int argc, const char **argv)
poptFreeContext(pc); poptFreeContext(pc);
error = reg_dotreg_diff_save(ctx, outputfile, &callbacks, error = reg_dotreg_diff_save(ctx, outputfile, lp_iconv_convenience(cmdline_lp_ctx), &callbacks,
&callback_data); &callback_data);
if (!W_ERROR_IS_OK(error)) { if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Problem saving registry diff to '%s': %s\n", fprintf(stderr, "Problem saving registry diff to '%s': %s\n",

View File

@ -33,6 +33,7 @@ struct sock_connect_state {
const char *host_name; const char *host_name;
int num_ports; int num_ports;
uint16_t *ports; uint16_t *ports;
const char *socket_options;
struct smbcli_socket *result; struct smbcli_socket *result;
}; };
@ -80,6 +81,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
for (i=0;ports[i];i++) { for (i=0;ports[i];i++) {
state->ports[i] = atoi(ports[i]); state->ports[i] = atoi(ports[i]);
} }
state->socket_options = lp_socket_options(global_loadparm);
ctx = socket_connect_multi_send(state, host_addr, ctx = socket_connect_multi_send(state, host_addr,
state->num_ports, state->ports, state->num_ports, state->ports,
@ -108,7 +110,7 @@ static void smbcli_sock_connect_recv_conn(struct composite_context *ctx)
if (!composite_is_ok(state->ctx)) return; if (!composite_is_ok(state->ctx)) return;
state->ctx->status = state->ctx->status =
socket_set_option(sock, lp_socket_options(global_loadparm), NULL); socket_set_option(sock, state->socket_options, NULL);
if (!composite_is_ok(state->ctx)) return; if (!composite_is_ok(state->ctx)) return;

View File

@ -445,7 +445,7 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
io.in.credentials = creds; io.in.credentials = creds;
io.in.fallback_to_anonymous = false; io.in.fallback_to_anonymous = false;
io.in.workgroup = lp_workgroup(mprLpCtx()); io.in.workgroup = lp_workgroup(mprLpCtx());
lp_smbcli_options(global_loadparm, &io.in.options); lp_smbcli_options(mprLpCtx(), &io.in.options);
result = smb_composite_connect(&io, mem_ctx, result = smb_composite_connect(&io, mem_ctx,
lp_resolve_context(mprLpCtx()), lp_resolve_context(mprLpCtx()),

View File

@ -143,7 +143,7 @@ static void pam_auth_crap_recv_logon(struct composite_context *ctx)
if (!composite_is_ok(state->ctx)) return; if (!composite_is_ok(state->ctx)) return;
ndr_err = ndr_push_struct_blob( ndr_err = ndr_push_struct_blob(
&tmp_blob, state, lp_iconv_convenience(global_loadparm), &tmp_blob, state, lp_iconv_convenience(state->lp_ctx),
state->req->out.validation.sam3, state->req->out.validation.sam3,
(ndr_push_flags_fn_t)ndr_push_netr_SamInfo3); (ndr_push_flags_fn_t)ndr_push_netr_SamInfo3);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {