diff options
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 23 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.py | 59 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_connect.c | 9 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_secondary.c | 3 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_sock.c | 7 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 7 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_wrap.c | 26 |
8 files changed, 81 insertions, 55 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 74dc2562ed..f5eae1b09a 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -164,13 +164,13 @@ void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v) } -/* +/** setup for a ndr pull, also setting up any flags from the binding string */ static struct ndr_pull *ndr_pull_init_flags(struct dcerpc_connection *c, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { - struct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx); + struct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm)); if (ndr == NULL) return ndr; @@ -350,7 +350,7 @@ static NTSTATUS ncacn_push_request_sign(struct dcerpc_connection *c, return ncacn_push_auth(blob, mem_ctx, pkt, c->security_state.auth_info); } - ndr = ndr_push_init_ctx(mem_ctx); + ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -1194,7 +1194,7 @@ static NTSTATUS dcerpc_ndr_validate_in(struct dcerpc_connection *c, return ndr_map_error2ntstatus(ndr_err); } - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1252,7 +1252,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c, } memcpy(st, struct_ptr, struct_size); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1283,7 +1283,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c, return ndr_map_error2ntstatus(ndr_err); } - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1354,7 +1354,7 @@ struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, call = &table->calls[opnum]; /* setup for a ndr_push_* call */ - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); if (!push) { return NULL; } @@ -1521,10 +1521,13 @@ NTSTATUS dcerpc_ndr_request(struct dcerpc_pipe *p, */ const char *dcerpc_server_name(struct dcerpc_pipe *p) { - if (!p->conn->transport.peer_name) { - return ""; + if (!p->conn->transport.target_hostname) { + if (!p->conn->transport.peer_name) { + return ""; + } + return p->conn->transport.peer_name(p->conn); } - return p->conn->transport.peer_name(p->conn); + return p->conn->transport.target_hostname(p->conn); } diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index ff827e50f2..9936ebe001 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -177,7 +177,7 @@ struct dcerpc_pipe_connect { const char *pipe_name; const struct ndr_interface_table *interface; struct cli_credentials *creds; - const char **name_resolve_order; + struct resolve_context *resolve_ctx; }; diff --git a/source4/librpc/rpc/dcerpc.py b/source4/librpc/rpc/dcerpc.py index b2edb17f33..da3664d80e 100644 --- a/source4/librpc/rpc/dcerpc.py +++ b/source4/librpc/rpc/dcerpc.py @@ -2,7 +2,6 @@ # Version 1.3.33 # # Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. import _dcerpc import new @@ -48,36 +47,40 @@ except AttributeError: del types -class Credentials(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, Credentials, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, Credentials, name) +def _swig_setattr_nondynamic_method(set): + def set_attr(self,name,value): + if (name == "thisown"): return self.this.own(value) + if hasattr(self,name) or (name == "this"): + set(self,name,value) + else: + raise AttributeError("You cannot add attributes to %s" % self) + return set_attr + + +class Credentials(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): - this = _dcerpc.new_Credentials(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _dcerpc.Credentials_swiginit(self,_dcerpc.new_Credentials(*args, **kwargs)) __swig_destroy__ = _dcerpc.delete_Credentials - __del__ = lambda self : None; - def get_username(*args, **kwargs): return _dcerpc.Credentials_get_username(*args, **kwargs) - def set_username(*args, **kwargs): return _dcerpc.Credentials_set_username(*args, **kwargs) - def get_password(*args, **kwargs): return _dcerpc.Credentials_get_password(*args, **kwargs) - def set_password(*args, **kwargs): return _dcerpc.Credentials_set_password(*args, **kwargs) - def get_domain(*args, **kwargs): return _dcerpc.Credentials_get_domain(*args, **kwargs) - def set_domain(*args, **kwargs): return _dcerpc.Credentials_set_domain(*args, **kwargs) - def get_realm(*args, **kwargs): return _dcerpc.Credentials_get_realm(*args, **kwargs) - def set_realm(*args, **kwargs): return _dcerpc.Credentials_set_realm(*args, **kwargs) - def parse_string(*args, **kwargs): return _dcerpc.Credentials_parse_string(*args, **kwargs) - def get_bind_dn(*args, **kwargs): return _dcerpc.Credentials_get_bind_dn(*args, **kwargs) - def set_bind_dn(*args, **kwargs): return _dcerpc.Credentials_set_bind_dn(*args, **kwargs) - def get_workstation(*args, **kwargs): return _dcerpc.Credentials_get_workstation(*args, **kwargs) - def set_workstation(*args, **kwargs): return _dcerpc.Credentials_set_workstation(*args, **kwargs) - def guess(*args, **kwargs): return _dcerpc.Credentials_guess(*args, **kwargs) - def is_anonymous(*args, **kwargs): return _dcerpc.Credentials_is_anonymous(*args, **kwargs) - def get_nt_hash(*args, **kwargs): return _dcerpc.Credentials_get_nt_hash(*args, **kwargs) - def authentication_requested(*args, **kwargs): return _dcerpc.Credentials_authentication_requested(*args, **kwargs) - def wrong_password(*args, **kwargs): return _dcerpc.Credentials_wrong_password(*args, **kwargs) +Credentials.get_username = new_instancemethod(_dcerpc.Credentials_get_username,None,Credentials) +Credentials.set_username = new_instancemethod(_dcerpc.Credentials_set_username,None,Credentials) +Credentials.get_password = new_instancemethod(_dcerpc.Credentials_get_password,None,Credentials) +Credentials.set_password = new_instancemethod(_dcerpc.Credentials_set_password,None,Credentials) +Credentials.get_domain = new_instancemethod(_dcerpc.Credentials_get_domain,None,Credentials) +Credentials.set_domain = new_instancemethod(_dcerpc.Credentials_set_domain,None,Credentials) +Credentials.get_realm = new_instancemethod(_dcerpc.Credentials_get_realm,None,Credentials) +Credentials.set_realm = new_instancemethod(_dcerpc.Credentials_set_realm,None,Credentials) +Credentials.parse_string = new_instancemethod(_dcerpc.Credentials_parse_string,None,Credentials) +Credentials.get_bind_dn = new_instancemethod(_dcerpc.Credentials_get_bind_dn,None,Credentials) +Credentials.set_bind_dn = new_instancemethod(_dcerpc.Credentials_set_bind_dn,None,Credentials) +Credentials.get_workstation = new_instancemethod(_dcerpc.Credentials_get_workstation,None,Credentials) +Credentials.set_workstation = new_instancemethod(_dcerpc.Credentials_set_workstation,None,Credentials) +Credentials.guess = new_instancemethod(_dcerpc.Credentials_guess,None,Credentials) +Credentials.is_anonymous = new_instancemethod(_dcerpc.Credentials_is_anonymous,None,Credentials) +Credentials.get_nt_hash = new_instancemethod(_dcerpc.Credentials_get_nt_hash,None,Credentials) +Credentials.authentication_requested = new_instancemethod(_dcerpc.Credentials_authentication_requested,None,Credentials) +Credentials.wrong_password = new_instancemethod(_dcerpc.Credentials_wrong_password,None,Credentials) Credentials_swigregister = _dcerpc.Credentials_swigregister Credentials_swigregister(Credentials) diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index e6244fe229..8fd783fb83 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -32,6 +32,7 @@ #include "librpc/rpc/dcerpc.h" #include "auth/credentials/credentials.h" #include "param/param.h" +#include "libcli/resolve/resolve.h" struct pipe_np_smb_state { @@ -110,7 +111,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT /* prepare smb connection parameters: we're connecting to IPC$ share on remote rpc server */ conn->in.dest_host = s->io.binding->host; - conn->in.port = 0; + conn->in.dest_ports = lp_smb_ports(global_loadparm); if (s->io.binding->target_hostname == NULL) conn->in.called_name = "*SMBSERVER"; /* FIXME: This is invalid */ else @@ -236,7 +237,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send( /* send smb2 connect request */ conn_req = smb2_connect_send(mem_ctx, s->io.binding->host, "IPC$", - s->io.name_resolve_order, + s->io.resolve_ctx, s->io.creds, c->event_ctx); composite_continue(c, conn_req, continue_smb2_connect, c); @@ -308,7 +309,7 @@ static struct composite_context* dcerpc_pipe_connect_ncacn_ip_tcp_send(TALLOC_CT /* send pipe open request on tcp/ip */ pipe_req = dcerpc_pipe_open_tcp_send(s->io.pipe->conn, s->host, s->target_hostname, - s->port, io->name_resolve_order); + s->port, io->resolve_ctx); composite_continue(c, pipe_req, continue_pipe_open_ncacn_ip_tcp, c); return c; } @@ -521,7 +522,7 @@ static void continue_connect(struct composite_context *c, struct pipe_connect_st pc.binding = s->binding; pc.interface = s->table; pc.creds = s->credentials; - pc.name_resolve_order = lp_name_resolve_order(global_loadparm); + pc.resolve_ctx = lp_resolve_context(global_loadparm); /* connect dcerpc pipe depending on required transport */ switch (s->binding->transport) { diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c index 0aa38d55ed..5e8dd955d3 100644 --- a/source4/librpc/rpc/dcerpc_secondary.c +++ b/source4/librpc/rpc/dcerpc_secondary.c @@ -29,6 +29,7 @@ #include "librpc/rpc/dcerpc.h" #include "auth/credentials/credentials.h" #include "param/param.h" +#include "libcli/resolve/resolve.h" struct sec_conn_state { @@ -93,7 +94,7 @@ struct composite_context* dcerpc_secondary_connection_send(struct dcerpc_pipe *p s->binding->host, s->binding->target_hostname, atoi(s->binding->endpoint), - lp_name_resolve_order(global_loadparm)); + lp_resolve_context(global_loadparm)); composite_continue(c, pipe_tcp_req, continue_open_tcp, c); return c; diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c index 327b1bf419..2e5a8388a1 100644 --- a/source4/librpc/rpc/dcerpc_sock.c +++ b/source4/librpc/rpc/dcerpc_sock.c @@ -332,7 +332,8 @@ static struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ct talloc_steal(s->sock, s->socket_ctx); - conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0, lp_name_resolve_order(global_loadparm), + conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0, + lp_resolve_context(global_loadparm), c->event_ctx); composite_continue(c, conn_req, continue_socket_connect, c); return c; @@ -454,7 +455,7 @@ struct composite_context* dcerpc_pipe_open_tcp_send(struct dcerpc_connection *co const char *server, const char *target_hostname, uint32_t port, - const char **name_resolve_order) + struct resolve_context *resolve_ctx) { struct composite_context *c; struct pipe_tcp_state *s; @@ -480,7 +481,7 @@ struct composite_context* dcerpc_pipe_open_tcp_send(struct dcerpc_connection *co s->conn = conn; make_nbt_name_server(&name, server); - resolve_req = resolve_name_send(&name, c->event_ctx, name_resolve_order); + resolve_req = resolve_name_send(resolve_ctx, &name, c->event_ctx); composite_continue(c, resolve_req, continue_ip_resolve_name, c); return c; } diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 32cee4308e..ecc6f19e8c 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -56,7 +56,7 @@ NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct ndr_push *ndr; enum ndr_err_code ndr_err; - ndr = ndr_push_init_ctx(mem_ctx); + ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -439,7 +439,7 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax) { TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data"); - struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx); + struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL); enum ndr_err_code ndr_err; uint16_t if_version=0; @@ -466,7 +466,7 @@ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_synta static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax) { - struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx); + struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL); ndr->flags |= LIBNDR_FLAG_NOALIGN; @@ -939,7 +939,6 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx, /* anonymous credentials for rpc connection used to get endpoint mapping */ anon_creds = cli_credentials_init(mem_ctx); cli_credentials_set_event_context(anon_creds, ev); - cli_credentials_set_conf(anon_creds, global_loadparm); cli_credentials_set_anonymous(anon_creds); /* diff --git a/source4/librpc/rpc/dcerpc_wrap.c b/source4/librpc/rpc/dcerpc_wrap.c index c9eb72fb9e..c60fef9e9d 100644 --- a/source4/librpc/rpc/dcerpc_wrap.c +++ b/source4/librpc/rpc/dcerpc_wrap.c @@ -9,7 +9,7 @@ * ----------------------------------------------------------------------------- */ #define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIG_PYTHON_NO_BUILD_NONE /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -2476,6 +2476,19 @@ static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; # error "This python version requires swig to be run with the '-classic' option" # endif #endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodern' option" +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodernargs' option" +#endif +#ifndef METH_O +# error "This python version requires swig to be run with the '-nofastunpack' option" +#endif +#ifdef SWIG_TypeQuery +# undef SWIG_TypeQuery +#endif +#define SWIG_TypeQuery SWIG_Python_TypeQuery /*----------------------------------------------- @(target):= _dcerpc.so @@ -2775,7 +2788,7 @@ SWIGINTERN PyObject *_wrap_new_Credentials(PyObject *SWIGUNUSEDPARM(self), PyObj PyObject *resultobj = 0; cli_credentials *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_Credentials")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_Credentials",0,0,0)) SWIG_fail; result = (cli_credentials *)new_cli_credentials(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_cli_credentials, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3535,11 +3548,15 @@ fail: SWIGINTERN PyObject *Credentials_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_cli_credentials, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *Credentials_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ; @@ -3665,7 +3682,7 @@ fail: static PyMethodDef SwigMethods[] = { - { (char *)"new_Credentials", _wrap_new_Credentials, METH_VARARGS, NULL}, + { (char *)"new_Credentials", (PyCFunction)_wrap_new_Credentials, METH_NOARGS, NULL}, { (char *)"delete_Credentials", (PyCFunction) _wrap_delete_Credentials, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_get_username", (PyCFunction) _wrap_Credentials_get_username, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_set_username", (PyCFunction) _wrap_Credentials_set_username, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -3686,6 +3703,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Credentials_authentication_requested", (PyCFunction) _wrap_Credentials_authentication_requested, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_wrong_password", (PyCFunction) _wrap_Credentials_wrong_password, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_swigregister", Credentials_swigregister, METH_VARARGS, NULL}, + { (char *)"Credentials_swiginit", Credentials_swiginit, METH_VARARGS, NULL}, { (char *)"pipe_connect", (PyCFunction) _wrap_pipe_connect, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"dcerpc_server_name", (PyCFunction) _wrap_dcerpc_server_name, METH_VARARGS | METH_KEYWORDS, NULL}, { NULL, NULL, 0, NULL } |