summaryrefslogtreecommitdiff
path: root/source4/rpc_server/drsuapi
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-10-13 15:06:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:51 -0500
commitb5fde9d2df707638f0244af925fa4e85be395eef (patch)
treead13a727391fe6007c114bc8743a1d6498592501 /source4/rpc_server/drsuapi
parent707661a87ebf92362df9c3adfe87a94b8e60ec35 (diff)
downloadsamba-b5fde9d2df707638f0244af925fa4e85be395eef.tar.gz
samba-b5fde9d2df707638f0244af925fa4e85be395eef.tar.bz2
samba-b5fde9d2df707638f0244af925fa4e85be395eef.zip
r2954: add server cracknames code:
- we currently only do it for our REALM metze (This used to be commit e2df8c4285d3430085594a3a3b5534c514acd1f9)
Diffstat (limited to 'source4/rpc_server/drsuapi')
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
index 9d1e5968a2..06fa1bba95 100644
--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
@@ -195,7 +195,47 @@ static NTSTATUS DRSUAPI_GET_NT4_CHANGELOG(struct dcesrv_call_state *dce_call, TA
static NTSTATUS drsuapi_DsCrackNames(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct drsuapi_DsCrackNames *r)
{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+ struct dcesrv_handle *h;
+
+ r->out.level = r->in.level;
+ ZERO_STRUCT(r->out.out);
+
+ DCESRV_PULL_HANDLE(h, r->in.bind_handle, DRSUAPI_BIND_HANDLE);
+
+ switch (r->in.level) {
+ case 1: {
+ int i;
+
+ r->out.out.info1 = talloc_p(mem_ctx, struct drsuapi_DsCrackNamesOutInfo1);
+ NTSTATUS_TALLOC_CHECK(r->out.out.info1);
+
+ r->out.out.info1->names = talloc_array_p(mem_ctx,
+ struct drsuapi_DsCrackNamesOutInfo1Names,
+ r->in.in.info1.count);
+ NTSTATUS_TALLOC_CHECK(r->out.out.info1->names);
+
+ r->out.out.info1->count = r->in.in.info1.count;
+
+ for (i=0; i < r->out.out.info1->count; i++) {
+ const char *name;
+ r->out.out.info1->names[i].unknown1 = 2;
+ r->out.out.info1->names[i].name1 = NULL;
+ r->out.out.info1->names[i].name2 = NULL;
+
+ /* TODO: fill crack the right names! */
+ name = talloc_asprintf(mem_ctx, "%s/", lp_realm());
+ if (strcmp(name, r->in.in.info1.names[i].str) != 0) {
+ continue;
+ }
+ r->out.out.info1->names[i].unknown1 = 0;
+ r->out.out.info1->names[i].name1 = talloc_asprintf(mem_ctx, "%s", lp_realm());
+ r->out.out.info1->names[i].name2 = talloc_asprintf(mem_ctx, "%s\\", lp_workgroup());
+ }
+ return NT_STATUS_OK;
+ }
+ }
+
+ return NT_STATUS_INVALID_LEVEL;
}