summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-11-20 22:00:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:46:32 -0500
commit1b415f7b8e8d02f6b7978de730a16e258ec5d07d (patch)
treed70cf005de28cb9e03c8a1667fd4f742f4b8ffcd /source4/libnet
parent9aef045b2719e85fa2ede826b0b4fa2e592eab02 (diff)
downloadsamba-1b415f7b8e8d02f6b7978de730a16e258ec5d07d.tar.gz
samba-1b415f7b8e8d02f6b7978de730a16e258ec5d07d.tar.bz2
samba-1b415f7b8e8d02f6b7978de730a16e258ec5d07d.zip
r11815: A bit more comments and spaces for better readability.
rafal (This used to be commit 1e831aead17b399289b8161e521e1afd5873c556)
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/libnet.c1
-rw-r--r--source4/libnet/libnet_rpc.c11
2 files changed, 11 insertions, 1 deletions
diff --git a/source4/libnet/libnet.c b/source4/libnet/libnet.c
index ba995854b2..4b2551b872 100644
--- a/source4/libnet/libnet.c
+++ b/source4/libnet/libnet.c
@@ -45,6 +45,7 @@ struct libnet_context *libnet_context_init(struct event_context *ev)
}
ctx->event_ctx = ev;
+ /* name resolution methods */
ctx->name_res_methods = str_list_copy(ctx, nr_methods);
return ctx;
diff --git a/source4/libnet/libnet_rpc.c b/source4/libnet/libnet_rpc.c
index 9917b17255..e926fc3778 100644
--- a/source4/libnet/libnet_rpc.c
+++ b/source4/libnet/libnet_rpc.c
@@ -36,17 +36,22 @@ static NTSTATUS libnet_RpcConnectSrv(struct libnet_context *ctx, TALLOC_CTX *mem
{
NTSTATUS status;
const char *binding = NULL;
+
+ /* prepare binding string */
switch (r->level) {
+ case LIBNET_RPC_CONNECT_PDC:
case LIBNET_RPC_CONNECT_SERVER:
binding = talloc_asprintf(mem_ctx, "ncacn_np:%s", r->in.domain_name);
break;
+
case LIBNET_RPC_CONNECT_BINDING:
binding = r->in.binding;
break;
}
+ /* connect to remote dcerpc pipe */
status = dcerpc_pipe_connect(mem_ctx, &r->out.dcerpc_pipe,
- binding, r->in.dcerpc_iface_uuid,r->in.dcerpc_iface_version,
+ binding, r->in.dcerpc_iface_uuid, r->in.dcerpc_iface_version,
ctx->cred, ctx->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
@@ -82,6 +87,7 @@ static NTSTATUS libnet_RpcConnectPdc(struct libnet_context *ctx, TALLOC_CTX *mem
f.in.methods = NULL;
f.out.address = NULL;
+ /* find the domain pdc first */
status = libnet_LookupPdc(ctx, mem_ctx, &f);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx, "libnet_LookupPdc failed: %s",
@@ -89,6 +95,7 @@ static NTSTATUS libnet_RpcConnectPdc(struct libnet_context *ctx, TALLOC_CTX *mem
return status;
}
+ /* ok, pdc has been found so do attempt to rpc connect */
r2.level = LIBNET_RPC_CONNECT_SERVER;
r2.in.domain_name = talloc_strdup(mem_ctx, f.out.address[0]);
r2.in.dcerpc_iface_name = r->in.dcerpc_iface_name;
@@ -120,8 +127,10 @@ NTSTATUS libnet_RpcConnect(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru
switch (r->level) {
case LIBNET_RPC_CONNECT_SERVER:
return libnet_RpcConnectSrv(ctx, mem_ctx, r);
+
case LIBNET_RPC_CONNECT_BINDING:
return libnet_RpcConnectSrv(ctx, mem_ctx, r);
+
case LIBNET_RPC_CONNECT_PDC:
return libnet_RpcConnectPdc(ctx, mem_ctx, r);
}