From 7261a9b9f76d19e6a2179a48e903e2fee4ee64a1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 2 May 2011 16:36:48 +1000 Subject: s4-libcli Remove resolve_name() as it conflicts with Samba3. This was just a wrapper around resolve_name_ex(), so just call that instead. Andrew Bartlett --- source4/libnet/libnet_site.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/libnet') diff --git a/source4/libnet/libnet_site.c b/source4/libnet/libnet_site.c index 9bfca74a36..f49108b28a 100644 --- a/source4/libnet/libnet_site.c +++ b/source4/libnet/libnet_site.c @@ -168,7 +168,9 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx, } make_nbt_name_client(&name, libnet_r->out.samr_binding->host); - status = resolve_name(lpcfg_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx); + status = resolve_name_ex(lpcfg_resolve_context(ctx->lp_ctx), + 0, 0, + &name, r, &dest_addr, ctx->event_ctx); if (!NT_STATUS_IS_OK(status)) { libnet_r->out.error_string = NULL; talloc_free(tmp_ctx); -- cgit From c6cc22adc059aeb6de50305b8a40d513d8f05bbc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 16 May 2011 22:55:29 +1000 Subject: s4-libnet: Remove libnet_Join and create libnet_Join_member libnet_Join conflicts with a function in the source3 netapi of the same name, and the ability to join as a DC via this particular method is unused. Andrew Bartlett --- source4/libnet/libnet_join.c | 36 +++++------------------------------- source4/libnet/libnet_join.h | 3 +-- source4/libnet/py_net.c | 16 ++++++++-------- 3 files changed, 14 insertions(+), 41 deletions(-) (limited to 'source4/libnet') diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 6e76df43e3..a1124fdd62 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -889,9 +889,9 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru return status; } -static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, - TALLOC_CTX *mem_ctx, - struct libnet_Join *r) +NTSTATUS libnet_Join_member(struct libnet_context *ctx, + TALLOC_CTX *mem_ctx, + struct libnet_Join_member *r) { NTSTATUS status; TALLOC_CTX *tmp_mem; @@ -916,15 +916,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, return NT_STATUS_NO_MEMORY; } - if (r->in.join_type == SEC_CHAN_BDC) { - acct_type = ACB_SVRTRUST; - } else if (r->in.join_type == SEC_CHAN_WKSTA) { - acct_type = ACB_WSTRUST; - } else { - r->out.error_string = NULL; - talloc_free(tmp_mem); - return NT_STATUS_INVALID_PARAMETER; - } + acct_type = ACB_WSTRUST; if (r->in.netbios_name != NULL) { netbios_name = r->in.netbios_name; @@ -972,7 +964,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, set_secrets->domain_name = r2->out.domain_name; set_secrets->realm = r2->out.realm; set_secrets->netbios_name = netbios_name; - set_secrets->secure_channel_type = r->in.join_type; + set_secrets->secure_channel_type = SEC_CHAN_WKSTA; set_secrets->machine_password = r2->out.join_password; set_secrets->key_version_number = r2->out.kvno; set_secrets->domain_sid = r2->out.domain_sid; @@ -996,21 +988,3 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, return NT_STATUS_OK; } -NTSTATUS libnet_Join(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_Join *r) -{ - switch (r->in.join_type) { - case SEC_CHAN_WKSTA: - return libnet_Join_primary_domain(ctx, mem_ctx, r); - case SEC_CHAN_BDC: - return libnet_Join_primary_domain(ctx, mem_ctx, r); - case SEC_CHAN_DOMAIN: - case SEC_CHAN_DNS_DOMAIN: - case SEC_CHAN_NULL: - break; - } - - r->out.error_string = talloc_asprintf(mem_ctx, - "Invalid join type specified (%08X) attempting to join domain %s", - r->in.join_type, r->in.domain_name); - return NT_STATUS_INVALID_PARAMETER; -} diff --git a/source4/libnet/libnet_join.h b/source4/libnet/libnet_join.h index 79884130d8..6acf374b38 100644 --- a/source4/libnet/libnet_join.h +++ b/source4/libnet/libnet_join.h @@ -63,11 +63,10 @@ struct libnet_JoinDomain { } out; }; -struct libnet_Join { +struct libnet_Join_member { struct { const char *domain_name; const char *netbios_name; - enum netr_SchannelType join_type; enum libnet_Join_level level; } in; diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c index b7f7d9eaaf..ffcd60da27 100644 --- a/source4/libnet/py_net.c +++ b/source4/libnet/py_net.c @@ -41,17 +41,17 @@ typedef struct { struct tevent_context *ev; } py_net_Object; -static PyObject *py_net_join(py_net_Object *self, PyObject *args, PyObject *kwargs) +static PyObject *py_net_join_member(py_net_Object *self, PyObject *args, PyObject *kwargs) { - struct libnet_Join r; + struct libnet_Join_member r; NTSTATUS status; PyObject *result; TALLOC_CTX *mem_ctx; - const char *kwnames[] = { "domain_name", "netbios_name", "join_type", "level", NULL }; + const char *kwnames[] = { "domain_name", "netbios_name", "level", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssii:Join", discard_const_p(char *, kwnames), + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssi:Join", discard_const_p(char *, kwnames), &r.in.domain_name, &r.in.netbios_name, - &r.in.join_type, &r.in.level)) + &r.in.level)) return NULL; mem_ctx = talloc_new(self->mem_ctx); @@ -60,7 +60,7 @@ static PyObject *py_net_join(py_net_Object *self, PyObject *args, PyObject *kwar return NULL; } - status = libnet_Join(self->libnet_ctx, mem_ctx, &r); + status = libnet_Join_member(self->libnet_ctx, mem_ctx, &r); if (NT_STATUS_IS_ERR(status)) { PyErr_SetString(PyExc_RuntimeError, r.out.error_string?r.out.error_string:nt_errstr(status)); talloc_free(mem_ctx); @@ -76,7 +76,7 @@ static PyObject *py_net_join(py_net_Object *self, PyObject *args, PyObject *kwar return result; } -static const char py_net_join_doc[] = "join(domain_name, netbios_name, join_type, level) -> (join_password, domain_sid, domain_name)\n\n" \ +static const char py_net_join_member_doc[] = "join_member(domain_name, netbios_name, level) -> (join_password, domain_sid, domain_name)\n\n" \ "Join the domain with the specified name."; static PyObject *py_net_set_password(py_net_Object *self, PyObject *args, PyObject *kwargs) @@ -526,7 +526,7 @@ static const char py_net_finddc_doc[] = "finddc(domain, server_type)\n" "find a DC with the specified server_type bits. Return the DNS name"; static PyMethodDef net_obj_methods[] = { - {"join", (PyCFunction)py_net_join, METH_VARARGS|METH_KEYWORDS, py_net_join_doc}, + {"join_member", (PyCFunction)py_net_join_member, METH_VARARGS|METH_KEYWORDS, py_net_join_member_doc}, {"set_password", (PyCFunction)py_net_set_password, METH_VARARGS|METH_KEYWORDS, py_net_set_password_doc}, {"export_keytab", (PyCFunction)py_net_export_keytab, METH_VARARGS|METH_KEYWORDS, py_net_export_keytab_doc}, {"time", (PyCFunction)py_net_time, METH_VARARGS|METH_KEYWORDS, py_net_time_doc}, -- cgit From 907cdb5de7f16a2540299aeba211bf2a5ae6fafe Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 6 Jun 2011 14:58:28 +1000 Subject: s4-modules Remove lp_ctx from init functions that no longer need it Now that we don't allow the smb.conf to change the modules dir, many functions that simply load modules or initialise a subsytem that may load modules no longer need an lp_ctx. Andrew Bartlett --- source4/libnet/libnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet') diff --git a/source4/libnet/libnet.c b/source4/libnet/libnet.c index 53ebb9e34a..32df85d527 100644 --- a/source4/libnet/libnet.c +++ b/source4/libnet/libnet.c @@ -43,7 +43,7 @@ struct libnet_context *libnet_context_init(struct tevent_context *ev, ctx->lp_ctx = lp_ctx; /* make sure dcerpc is initialized */ - dcerpc_init(lp_ctx); + dcerpc_init(); /* name resolution methods */ ctx->resolve_ctx = lpcfg_resolve_context(lp_ctx); -- cgit From 40ea52a267c7362e206ac83ff6d1fc586b05e2f4 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 8 Jun 2011 18:58:45 +0200 Subject: s4:libnet/libnet_rpc.c - quiet an enum warning Other enum types have been checked before. Reviewed-by: Tridge --- source4/libnet/libnet_rpc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/libnet') diff --git a/source4/libnet/libnet_rpc.c b/source4/libnet/libnet_rpc.c index e0781c3816..8aacfc398a 100644 --- a/source4/libnet/libnet_rpc.c +++ b/source4/libnet/libnet_rpc.c @@ -109,6 +109,10 @@ static struct composite_context* libnet_RpcConnectSrv_send(struct libnet_context case LIBNET_RPC_CONNECT_SERVER: case LIBNET_RPC_CONNECT_SERVER_ADDRESS: b->flags = r->in.dcerpc_flags; + break; + default: + /* other types have already been checked before */ + break; } if (DEBUGLEVEL >= 10) { -- cgit From a1f04e8abc761ef1ba211420ff1dbda50fcf527d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 20 Jun 2011 14:55:32 +1000 Subject: libcli/util Rename common map_nt_error_from_unix to avoid duplicate symbol The two error tables need to be combined, but for now seperate the names. (As the common parts of the tree now use the _common function, errmap_unix.c must be included in the s3 autoconf build). Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Mon Jun 20 08:12:03 CEST 2011 on sn-devel-104 --- source4/libnet/libnet_become_dc.c | 2 +- source4/libnet/libnet_site.c | 2 +- source4/libnet/libnet_unbecome_dc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libnet') diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index a68f4c5ea0..4d845ca1f0 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -769,7 +769,7 @@ static void becomeDC_send_cldap(struct libnet_BecomeDC_state *s) lpcfg_cldap_port(s->libnet->lp_ctx), &dest_address); if (ret != 0) { - c->status = map_nt_error_from_unix(errno); + c->status = map_nt_error_from_unix_common(errno); if (!composite_is_ok(c)) return; } diff --git a/source4/libnet/libnet_site.c b/source4/libnet/libnet_site.c index f49108b28a..a74dd59a22 100644 --- a/source4/libnet/libnet_site.c +++ b/source4/libnet/libnet_site.c @@ -64,7 +64,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_context *lctx, struct li &dest_address); if (ret != 0) { r->out.error_string = NULL; - status = map_nt_error_from_unix(errno); + status = map_nt_error_from_unix_common(errno); return status; } diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c index 4bffc5079e..85d47a91f9 100644 --- a/source4/libnet/libnet_unbecome_dc.c +++ b/source4/libnet/libnet_unbecome_dc.c @@ -277,7 +277,7 @@ static void unbecomeDC_send_cldap(struct libnet_UnbecomeDC_state *s) lpcfg_cldap_port(s->libnet->lp_ctx), &dest_address); if (ret != 0) { - c->status = map_nt_error_from_unix(errno); + c->status = map_nt_error_from_unix_common(errno); if (!composite_is_ok(c)) return; } -- cgit