diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-29 12:45:46 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-29 12:45:46 +0100 |
commit | c8011b5d09390318ea6aa5639a142797128e5dab (patch) | |
tree | fb14b7ecce720dbc4fbba831a8fab045b9ac5f5c /source4/libcli | |
parent | bc1a369a0ed254ede591b65756d75568c45549ea (diff) | |
parent | de4a2214efb3fcc1aa04664371983dbc768eaf79 (diff) | |
download | samba-c8011b5d09390318ea6aa5639a142797128e5dab.tar.gz samba-c8011b5d09390318ea6aa5639a142797128e5dab.tar.bz2 samba-c8011b5d09390318ea6aa5639a142797128e5dab.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
Conflicts:
source/scripting/python/config.mk
(This used to be commit 0ac0ea660ab63eca764149f1d2828d0238a57289)
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/cldap/cldap.c | 8 | ||||
-rw-r--r-- | source4/libcli/cldap/cldap.h | 4 | ||||
-rw-r--r-- | source4/libcli/dgram/dgramsocket.c | 5 | ||||
-rw-r--r-- | source4/libcli/dgram/libdgram.h | 3 | ||||
-rw-r--r-- | source4/libcli/finddcs.c | 13 | ||||
-rw-r--r-- | source4/libcli/nbt/libnbt.h | 1 | ||||
-rw-r--r-- | source4/libcli/nbt/nbtsocket.c | 10 | ||||
-rw-r--r-- | source4/libcli/raw/clisession.c | 4 | ||||
-rw-r--r-- | source4/libcli/raw/clisocket.c | 4 | ||||
-rw-r--r-- | source4/libcli/raw/libcliraw.h | 6 | ||||
-rw-r--r-- | source4/libcli/resolve/bcast.c | 10 | ||||
-rw-r--r-- | source4/libcli/resolve/nbtlist.c | 8 | ||||
-rw-r--r-- | source4/libcli/resolve/wins.c | 10 | ||||
-rw-r--r-- | source4/libcli/smb_composite/fetchfile.c | 2 | ||||
-rw-r--r-- | source4/libcli/smb_composite/sesssetup.c | 12 | ||||
-rw-r--r-- | source4/libcli/smb_composite/smb_composite.h | 1 | ||||
-rw-r--r-- | source4/libcli/swig/libcli_nbt.i | 3 | ||||
-rw-r--r-- | source4/libcli/swig/libcli_nbt_wrap.c | 34 | ||||
-rw-r--r-- | source4/libcli/wrepl/winsrepl.c | 23 | ||||
-rw-r--r-- | source4/libcli/wrepl/winsrepl.h | 2 |
20 files changed, 115 insertions, 48 deletions
diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index 7c8d40e608..d10eeb8ffd 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -241,7 +241,8 @@ static void cldap_socket_handler(struct event_context *ev, struct fd_event *fde, then operations will use that event context */ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx, - struct event_context *event_ctx) + struct event_context *event_ctx, + struct smb_iconv_convenience *iconv_convenience) { struct cldap_socket *cldap; NTSTATUS status; @@ -270,6 +271,7 @@ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx, cldap->send_queue = NULL; cldap->incoming.handler = NULL; + cldap->iconv_convenience = iconv_convenience; return cldap; @@ -618,7 +620,7 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req, data = search.out.response->attributes[0].values; ndr_err = ndr_pull_union_blob_all(data, mem_ctx, - lp_iconv_convenience(global_loadparm), + req->cldap->iconv_convenience, &io->out.netlogon, io->in.version & 0xF, (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon); @@ -714,7 +716,7 @@ NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap, DATA_BLOB blob; ndr_err = ndr_push_union_blob(&blob, tmp_ctx, - lp_iconv_convenience(global_loadparm), + cldap->iconv_convenience, netlogon, version & 0xF, (ndr_push_flags_fn_t)ndr_push_nbt_cldap_netlogon); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/libcli/cldap/cldap.h b/source4/libcli/cldap/cldap.h index 7a222e0652..eb0191d0f4 100644 --- a/source4/libcli/cldap/cldap.h +++ b/source4/libcli/cldap/cldap.h @@ -73,6 +73,7 @@ struct cldap_request { struct cldap_socket { struct socket_context *sock; struct event_context *event_ctx; + struct smb_iconv_convenience *iconv_convenience; /* the fd event */ struct fd_event *fde; @@ -111,7 +112,8 @@ struct cldap_search { }; struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx, - struct event_context *event_ctx); + struct event_context *event_ctx, + struct smb_iconv_convenience *iconv_convenience); NTSTATUS cldap_set_incoming_handler(struct cldap_socket *cldap, void (*handler)(struct cldap_socket *, struct ldap_message *, struct socket_address *), diff --git a/source4/libcli/dgram/dgramsocket.c b/source4/libcli/dgram/dgramsocket.c index 7d6f5627c5..130d8ae870 100644 --- a/source4/libcli/dgram/dgramsocket.c +++ b/source4/libcli/dgram/dgramsocket.c @@ -158,7 +158,8 @@ static void dgm_socket_handler(struct event_context *ev, struct fd_event *fde, then operations will use that event context */ struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx, - struct event_context *event_ctx) + struct event_context *event_ctx, + struct smb_iconv_convenience *iconv_convenience) { struct nbt_dgram_socket *dgmsock; NTSTATUS status; @@ -187,7 +188,7 @@ struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx, dgmsock->send_queue = NULL; dgmsock->incoming.handler = NULL; dgmsock->mailslot_handlers = NULL; - dgmsock->iconv_convenience = lp_iconv_convenience(global_loadparm); + dgmsock->iconv_convenience = iconv_convenience; return dgmsock; diff --git a/source4/libcli/dgram/libdgram.h b/source4/libcli/dgram/libdgram.h index 4645840971..707cca8cc5 100644 --- a/source4/libcli/dgram/libdgram.h +++ b/source4/libcli/dgram/libdgram.h @@ -93,7 +93,8 @@ NTSTATUS dgram_set_incoming_handler(struct nbt_dgram_socket *dgmsock, struct socket_address *), void *private); struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx, - struct event_context *event_ctx); + struct event_context *event_ctx, + struct smb_iconv_convenience *); const char *dgram_mailslot_name(struct nbt_dgram_packet *packet); struct dgram_mailslot_handler *dgram_mailslot_find(struct nbt_dgram_socket *dgmsock, diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c index 606809751e..56f931ce19 100644 --- a/source4/libcli/finddcs.c +++ b/source4/libcli/finddcs.c @@ -28,6 +28,7 @@ #include "libcli/libcli.h" #include "libcli/resolve/resolve.h" #include "libcli/finddcs.h" +#include "param/param.h" struct finddcs_state { struct composite_context *ctx; @@ -40,6 +41,8 @@ struct finddcs_state { struct nbtd_getdcname r; struct nbt_name_status node_status; + struct smb_iconv_convenience *iconv_convenience; + int num_dcs; struct nbt_dc_name *dcs; uint16_t nbt_port; @@ -66,6 +69,7 @@ struct composite_context *finddcs_send(TALLOC_CTX *mem_ctx, const char *domain_name, int name_type, struct dom_sid *domain_sid, + struct smb_iconv_convenience *iconv_convenience, struct resolve_context *resolve_ctx, struct event_context *event_ctx, struct messaging_context *msg_ctx) @@ -86,6 +90,7 @@ struct composite_context *finddcs_send(TALLOC_CTX *mem_ctx, state->nbt_port = nbt_port; state->my_netbios_name = talloc_strdup(state, my_netbios_name); state->domain_name = talloc_strdup(state, domain_name); + state->iconv_convenience = iconv_convenience; if (composite_nomem(state->domain_name, c)) return c; if (domain_sid) { @@ -195,7 +200,8 @@ static void fallback_node_status(struct finddcs_state *state) state->node_status.in.timeout = 1; state->node_status.in.retries = 2; - nbtsock = nbt_name_socket_init(state, state->ctx->event_ctx); + nbtsock = nbt_name_socket_init(state, state->ctx->event_ctx, + state->iconv_convenience); if (composite_nomem(nbtsock, state->ctx)) return; name_req = nbt_name_status_send(nbtsock, &state->node_status); @@ -253,6 +259,7 @@ NTSTATUS finddcs(TALLOC_CTX *mem_ctx, uint16_t nbt_port, const char *domain_name, int name_type, struct dom_sid *domain_sid, + struct smb_iconv_convenience *iconv_convenience, struct resolve_context *resolve_ctx, struct event_context *event_ctx, struct messaging_context *msg_ctx, @@ -262,7 +269,9 @@ NTSTATUS finddcs(TALLOC_CTX *mem_ctx, my_netbios_name, nbt_port, domain_name, name_type, - domain_sid, resolve_ctx, + domain_sid, + iconv_convenience, + resolve_ctx, event_ctx, msg_ctx); return finddcs_recv(c, mem_ctx, num_dcs, dcs); } diff --git a/source4/libcli/nbt/libnbt.h b/source4/libcli/nbt/libnbt.h index c95d99db54..bc85d87b89 100644 --- a/source4/libcli/nbt/libnbt.h +++ b/source4/libcli/nbt/libnbt.h @@ -94,6 +94,7 @@ struct nbt_name_request { struct nbt_name_socket { struct socket_context *sock; struct event_context *event_ctx; + struct smb_iconv_convenience *iconv_convenience; /* a queue of requests pending to be sent */ struct nbt_name_request *send_queue; diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c index 8bfe746294..95a1643efc 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -190,7 +190,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock) } /* parse the request */ - ndr_err = ndr_pull_struct_blob(&blob, packet, lp_iconv_convenience(global_loadparm), packet, + ndr_err = ndr_pull_struct_blob(&blob, packet, nbtsock->iconv_convenience, packet, (ndr_pull_flags_fn_t)ndr_pull_nbt_name_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { status = ndr_map_error2ntstatus(ndr_err); @@ -309,7 +309,8 @@ static void nbt_name_socket_handler(struct event_context *ev, struct fd_event *f then operations will use that event context */ _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, - struct event_context *event_ctx) + struct event_context *event_ctx, + struct smb_iconv_convenience *iconv_convenience) { struct nbt_name_socket *nbtsock; NTSTATUS status; @@ -338,6 +339,7 @@ _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, nbtsock->num_pending = 0; nbtsock->incoming.handler = NULL; nbtsock->unexpected.handler = NULL; + nbtsock->iconv_convenience = iconv_convenience; nbtsock->fde = event_add_fd(nbtsock->event_ctx, nbtsock, socket_get_fd(nbtsock->sock), 0, @@ -395,7 +397,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock, talloc_set_destructor(req, nbt_name_request_destructor); ndr_err = ndr_push_struct_blob(&req->encoded, req, - lp_iconv_convenience(global_loadparm), + req->nbtsock->iconv_convenience, request, (ndr_push_flags_fn_t)ndr_push_nbt_name_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed; @@ -444,7 +446,7 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock, } ndr_err = ndr_push_struct_blob(&req->encoded, req, - lp_iconv_convenience(global_loadparm), + req->nbtsock->iconv_convenience, request, (ndr_push_flags_fn_t)ndr_push_nbt_name_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c index 55cb3ef305..5a33d9cffc 100644 --- a/source4/libcli/raw/clisession.c +++ b/source4/libcli/raw/clisession.c @@ -22,6 +22,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" #include "system/filesys.h" +#include "param/param.h" #define SETUP_REQUEST_SESSION(cmd, wct, buflen) do { \ req = smbcli_request_setup_session(session, cmd, wct, buflen); \ @@ -51,6 +52,9 @@ struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport, } session->pid = (uint16_t)getpid(); session->vuid = UID_FIELD_INVALID; + session->options.lanman_auth = lp_client_lanman_auth(global_loadparm); + session->options.ntlmv2_auth = lp_client_ntlmv2_auth(global_loadparm); + session->options.plaintext_auth = lp_client_plaintext_auth(global_loadparm); capabilities = transport->negotiate.capabilities; diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 8fcb8bb48c..eaa02e1047 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -33,6 +33,7 @@ struct sock_connect_state { const char *host_name; int num_ports; uint16_t *ports; + const char *socket_options; 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++) { state->ports[i] = atoi(ports[i]); } + state->socket_options = lp_socket_options(global_loadparm); ctx = socket_connect_multi_send(state, host_addr, 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; 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; diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h index 7111649fc1..0578a9eab1 100644 --- a/source4/libcli/raw/libcliraw.h +++ b/source4/libcli/raw/libcliraw.h @@ -186,6 +186,12 @@ struct smbcli_session { /* the spnego context if we use extented security */ struct gensec_security *gensec; + + struct smbcli_session_options { + uint_t lanman_auth:1; + uint_t ntlmv2_auth:1; + uint_t plaintext_auth:1; + } options; }; /* diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c index c8d4ab2df3..2e2eb05397 100644 --- a/source4/libcli/resolve/bcast.c +++ b/source4/libcli/resolve/bcast.c @@ -29,6 +29,7 @@ struct resolve_bcast_data { struct interface *ifaces; uint16_t nbt_port; + int nbt_timeout; }; /** @@ -62,7 +63,7 @@ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx, } address_list[count] = NULL; - c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, data->ifaces, data->nbt_port, true, false); + c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, data->ifaces, data->nbt_port, data->nbt_timeout, true, false); talloc_free(address_list); return c; @@ -84,22 +85,25 @@ NTSTATUS resolve_name_bcast(struct nbt_name *name, TALLOC_CTX *mem_ctx, struct interface *ifaces, uint16_t nbt_port, + int nbt_timeout, const char **reply_addr) { struct resolve_bcast_data *data = talloc(mem_ctx, struct resolve_bcast_data); struct composite_context *c; data->ifaces = talloc_reference(data, ifaces); data->nbt_port = nbt_port; + data->nbt_timeout = nbt_timeout; c = resolve_name_bcast_send(mem_ctx, NULL, data, name); return resolve_name_bcast_recv(c, mem_ctx, reply_addr); } -bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interface *ifaces, uint16_t nbt_port) +bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interface *ifaces, uint16_t nbt_port, int nbt_timeout) { struct resolve_bcast_data *data = talloc(ctx, struct resolve_bcast_data); data->ifaces = ifaces; data->nbt_port = nbt_port; + data->nbt_timeout = nbt_timeout; return resolve_context_add_method(ctx, resolve_name_bcast_send, resolve_name_bcast_recv, data); } @@ -107,5 +111,5 @@ bool resolve_context_add_bcast_method_lp(struct resolve_context *ctx, struct loa { struct interface *ifaces; load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces); - return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx)); + return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1)); } diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index e1452c09d2..887bdd7ecf 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -102,6 +102,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port, + int nbt_timeout, bool broadcast, bool wins_lookup) { @@ -140,7 +141,8 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, return c; } - state->nbtsock = nbt_name_socket_init(state, event_ctx); + state->nbtsock = nbt_name_socket_init(state, event_ctx, + lp_iconv_convenience(global_loadparm)); if (composite_nomem(state->nbtsock, c)) return c; /* count the address_list size */ @@ -161,7 +163,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, state->io_queries[i].in.broadcast = broadcast; state->io_queries[i].in.wins_lookup = wins_lookup; - state->io_queries[i].in.timeout = lp_parm_int(global_loadparm, NULL, "nbt", "timeout", 1); + state->io_queries[i].in.timeout = nbt_timeout; state->io_queries[i].in.retries = 2; state->queries[i] = nbt_name_query_send(state->nbtsock, &state->io_queries[i]); @@ -201,12 +203,14 @@ NTSTATUS resolve_name_nbtlist(struct nbt_name *name, const char **address_list, struct interface *ifaces, uint16_t nbt_port, + int nbt_timeout, bool broadcast, bool wins_lookup, const char **reply_addr) { struct composite_context *c = resolve_name_nbtlist_send(mem_ctx, NULL, name, address_list, ifaces, nbt_port, + nbt_timeout, broadcast, wins_lookup); return resolve_name_nbtlist_recv(c, mem_ctx, reply_addr); } diff --git a/source4/libcli/resolve/wins.c b/source4/libcli/resolve/wins.c index 78624ad81a..3ec180f332 100644 --- a/source4/libcli/resolve/wins.c +++ b/source4/libcli/resolve/wins.c @@ -29,6 +29,7 @@ struct resolve_wins_data { const char **address_list; struct interface *ifaces; uint16_t nbt_port; + int nbt_timeout; }; /** @@ -42,7 +43,7 @@ struct composite_context *resolve_name_wins_send( { struct resolve_wins_data *wins_data = talloc_get_type(userdata, struct resolve_wins_data); if (wins_data->address_list == NULL) return NULL; - return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, wins_data->address_list, wins_data->ifaces, wins_data->nbt_port, false, true); + return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, wins_data->address_list, wins_data->ifaces, wins_data->nbt_port, wins_data->nbt_timeout, false, true); } /* @@ -62,6 +63,7 @@ NTSTATUS resolve_name_wins(struct nbt_name *name, const char **address_list, struct interface *ifaces, uint16_t nbt_port, + int nbt_timeout, const char **reply_addr) { struct composite_context *c; @@ -69,16 +71,18 @@ NTSTATUS resolve_name_wins(struct nbt_name *name, wins_data->address_list = address_list; wins_data->ifaces = ifaces; wins_data->nbt_port = nbt_port; + wins_data->nbt_timeout = nbt_timeout; c = resolve_name_wins_send(mem_ctx, NULL, wins_data, name); return resolve_name_wins_recv(c, mem_ctx, reply_addr); } -bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port) +bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port, int nbt_timeout) { struct resolve_wins_data *wins_data = talloc(ctx, struct resolve_wins_data); wins_data->address_list = str_list_copy(wins_data, address_list); wins_data->ifaces = talloc_reference(wins_data, ifaces); wins_data->nbt_port = nbt_port; + wins_data->nbt_timeout = nbt_timeout; return resolve_context_add_method(ctx, resolve_name_wins_send, resolve_name_wins_recv, wins_data); } @@ -87,5 +91,5 @@ bool resolve_context_add_wins_method_lp(struct resolve_context *ctx, struct load { struct interface *ifaces; load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces); - return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx)); + return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1)); } diff --git a/source4/libcli/smb_composite/fetchfile.c b/source4/libcli/smb_composite/fetchfile.c index e4312794c9..d8d7481270 100644 --- a/source4/libcli/smb_composite/fetchfile.c +++ b/source4/libcli/smb_composite/fetchfile.c @@ -150,7 +150,7 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc state->connect->in.options = io->in.options; state->creq = smb_composite_connect_send(state->connect, state, - lp_resolve_context(global_loadparm), event_ctx); + io->in.resolve_ctx, event_ctx); if (state->creq == NULL) goto failed; state->creq->async.private_data = c; diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c index f5a976958d..75a2a579a2 100644 --- a/source4/libcli/smb_composite/sesssetup.c +++ b/source4/libcli/smb_composite/sesssetup.c @@ -226,11 +226,11 @@ static NTSTATUS session_setup_nt1(struct composite_context *c, DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, lp_iconv_convenience(global_loadparm), session->transport->socket->hostname, lp_workgroup(global_loadparm)); DATA_BLOB session_key; int flags = CLI_CRED_NTLM_AUTH; - if (lp_client_lanman_auth(global_loadparm)) { + if (session->options.lanman_auth) { flags |= CLI_CRED_LANMAN_AUTH; } - if (lp_client_ntlmv2_auth(global_loadparm)) { + if (session->options.ntlmv2_auth) { flags |= CLI_CRED_NTLMv2_AUTH; } @@ -263,7 +263,7 @@ static NTSTATUS session_setup_nt1(struct composite_context *c, set_user_session_key(session, &session_key); data_blob_free(&session_key); - } else if (lp_client_plaintext_auth(global_loadparm)) { + } else if (session->options.plaintext_auth) { state->setup.nt1.in.password1 = data_blob_talloc(state, password, strlen(password)); state->setup.nt1.in.password2 = data_blob(NULL, 0); } else { @@ -293,11 +293,11 @@ static NTSTATUS session_setup_old(struct composite_context *c, DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, lp_iconv_convenience(global_loadparm), session->transport->socket->hostname, lp_workgroup(global_loadparm)); DATA_BLOB session_key; int flags = 0; - if (lp_client_lanman_auth(global_loadparm)) { + if (session->options.lanman_auth) { flags |= CLI_CRED_LANMAN_AUTH; } - if (lp_client_ntlmv2_auth(global_loadparm)) { + if (session->options.ntlmv2_auth) { flags |= CLI_CRED_NTLMv2_AUTH; } @@ -324,7 +324,7 @@ static NTSTATUS session_setup_old(struct composite_context *c, set_user_session_key(session, &session_key); data_blob_free(&session_key); - } else if (lp_client_plaintext_auth(global_loadparm)) { + } else if (session->options.plaintext_auth) { state->setup.old.in.password = data_blob_talloc(state, password, strlen(password)); } else { /* could match windows client and return 'cannot logon from this workstation', but it just confuses everybody */ diff --git a/source4/libcli/smb_composite/smb_composite.h b/source4/libcli/smb_composite/smb_composite.h index 964ffb0936..e7e131869c 100644 --- a/source4/libcli/smb_composite/smb_composite.h +++ b/source4/libcli/smb_composite/smb_composite.h @@ -56,6 +56,7 @@ struct smb_composite_fetchfile { const char *workgroup; const char *filename; struct smbcli_options options; + struct resolve_context *resolve_ctx; } in; struct { uint8_t *data; diff --git a/source4/libcli/swig/libcli_nbt.i b/source4/libcli/swig/libcli_nbt.i index 827230b113..e4e366873f 100644 --- a/source4/libcli/swig/libcli_nbt.i +++ b/source4/libcli/swig/libcli_nbt.i @@ -46,7 +46,8 @@ /* Function prototypes */ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, - struct event_context *event_ctx); + struct event_context *event_ctx, + struct smb_iconv_convenience *iconv_convenience); enum nbt_name_type { NBT_NAME_CLIENT=0x00, diff --git a/source4/libcli/swig/libcli_nbt_wrap.c b/source4/libcli/swig/libcli_nbt_wrap.c index 6c1b501359..f67e6dd0e3 100644 --- a/source4/libcli/swig/libcli_nbt_wrap.c +++ b/source4/libcli/swig/libcli_nbt_wrap.c @@ -2469,12 +2469,13 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_p_char swig_types[10] #define SWIGTYPE_p_short swig_types[11] #define SWIGTYPE_p_signed_char swig_types[12] -#define SWIGTYPE_p_unsigned_char swig_types[13] -#define SWIGTYPE_p_unsigned_int swig_types[14] -#define SWIGTYPE_p_unsigned_long_long swig_types[15] -#define SWIGTYPE_p_unsigned_short swig_types[16] -static swig_type_info *swig_types[18]; -static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0}; +#define SWIGTYPE_p_smb_iconv_convenience swig_types[13] +#define SWIGTYPE_p_unsigned_char swig_types[14] +#define SWIGTYPE_p_unsigned_int swig_types[15] +#define SWIGTYPE_p_unsigned_long_long swig_types[16] +#define SWIGTYPE_p_unsigned_short swig_types[17] +static swig_type_info *swig_types[19]; +static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -2918,17 +2919,21 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self), PyObject *resultobj = 0; TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ; struct event_context *arg2 = (struct event_context *) 0 ; + struct smb_iconv_convenience *arg3 = (struct smb_iconv_convenience *) 0 ; struct nbt_name_socket *result = 0 ; void *argp2 = 0 ; int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; char * kwnames[] = { - (char *) "event_ctx", NULL + (char *) "event_ctx",(char *) "iconv_convenience", NULL }; arg2 = event_context_init(NULL); arg1 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:nbt_name_socket_init",kwnames,&obj0)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:nbt_name_socket_init",kwnames,&obj0,&obj1)) SWIG_fail; if (obj0) { res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_event_context, 0 | 0 ); if (!SWIG_IsOK(res2)) { @@ -2936,7 +2941,14 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self), } arg2 = (struct event_context *)(argp2); } - result = (struct nbt_name_socket *)nbt_name_socket_init(arg1,arg2); + if (obj1) { + res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_smb_iconv_convenience, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "nbt_name_socket_init" "', argument " "3"" of type '" "struct smb_iconv_convenience *""'"); + } + arg3 = (struct smb_iconv_convenience *)(argp3); + } + result = (struct nbt_name_socket *)nbt_name_socket_init(arg1,arg2,arg3); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_socket, 0 | 0 ); return resultobj; fail: @@ -4135,6 +4147,7 @@ static swig_type_info _swigt__p_nbt_name_socket = {"_p_nbt_name_socket", "struct static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_smb_iconv_convenience = {"_p_smb_iconv_convenience", "struct smb_iconv_convenience *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0}; @@ -4154,6 +4167,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_p_char, &_swigt__p_short, &_swigt__p_signed_char, + &_swigt__p_smb_iconv_convenience, &_swigt__p_unsigned_char, &_swigt__p_unsigned_int, &_swigt__p_unsigned_long_long, @@ -4173,6 +4187,7 @@ static swig_cast_info _swigc__p_nbt_name_socket[] = { {&_swigt__p_nbt_name_sock static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_smb_iconv_convenience[] = { {&_swigt__p_smb_iconv_convenience, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}}; @@ -4192,6 +4207,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_p_char, _swigc__p_short, _swigc__p_signed_char, + _swigc__p_smb_iconv_convenience, _swigc__p_unsigned_char, _swigc__p_unsigned_int, _swigc__p_unsigned_long_long, diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index d027e88396..3e7793c0c7 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -102,7 +102,7 @@ static NTSTATUS wrepl_finish_recv(void *private, DATA_BLOB packet_blob_in) blob.length = packet_blob_in.length - 4; /* we have a full request - parse it */ - ndr_err = ndr_pull_struct_blob(&blob, req->packet, lp_iconv_convenience(global_loadparm), req->packet, + ndr_err = ndr_pull_struct_blob(&blob, req->packet, wrepl_socket->iconv_convenience, req->packet, (ndr_pull_flags_fn_t)ndr_pull_wrepl_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); @@ -163,7 +163,8 @@ static int wrepl_socket_destructor(struct wrepl_socket *sock) operations will use that event context */ struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx, - struct event_context *event_ctx) + struct event_context *event_ctx, + struct smb_iconv_convenience *iconv_convenience) { struct wrepl_socket *wrepl_socket; NTSTATUS status; @@ -178,6 +179,8 @@ struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx, } if (!wrepl_socket->event.ctx) goto failed; + wrepl_socket->iconv_convenience = iconv_convenience; + status = socket_create("ip", SOCKET_TYPE_STREAM, &wrepl_socket->sock, 0); if (!NT_STATUS_IS_OK(status)) goto failed; @@ -308,6 +311,14 @@ static void wrepl_connect_handler(struct composite_context *creq) composite_done(result); } +const char *wrepl_best_ip(struct loadparm_context *lp_ctx, const char *peer_ip) +{ + struct interface *ifaces; + load_interfaces(lp_ctx, lp_interfaces(lp_ctx), &ifaces); + return iface_best_ip(ifaces, peer_ip); +} + + /* connect a wrepl_socket to a WINS server */ @@ -331,12 +342,6 @@ struct composite_context *wrepl_connect_send(struct wrepl_socket *wrepl_socket, state->result = result; state->wrepl_socket = wrepl_socket; - if (!our_ip) { - struct interface *ifaces; - load_interfaces(state, lp_interfaces(global_loadparm), &ifaces); - our_ip = iface_best_ip(ifaces, peer_ip); - } - us = socket_address_from_strings(state, wrepl_socket->sock->backend_name, our_ip, 0); if (composite_nomem(us, result)) return result; @@ -493,7 +498,7 @@ struct wrepl_request *wrepl_request_send(struct wrepl_socket *wrepl_socket, } wrap.packet = *packet; - ndr_err = ndr_push_struct_blob(&blob, req, lp_iconv_convenience(global_loadparm), &wrap, + ndr_err = ndr_push_struct_blob(&blob, req, wrepl_socket->iconv_convenience, &wrap, (ndr_push_flags_fn_t)ndr_push_wrepl_wrap); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/libcli/wrepl/winsrepl.h b/source4/libcli/wrepl/winsrepl.h index 52b0bee69e..f33e63119d 100644 --- a/source4/libcli/wrepl/winsrepl.h +++ b/source4/libcli/wrepl/winsrepl.h @@ -49,6 +49,8 @@ struct wrepl_socket { /* remember if we need to free the wrepl_socket at the end of wrepl_socket_dead() */ bool free_skipped; + + struct smb_iconv_convenience *iconv_convenience; }; struct wrepl_send_ctrl { |