diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-12-02 10:34:06 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-12-02 10:34:06 +0000 |
commit | 10ad200350e304f1ca7b4080a04f4fe4eeb80763 (patch) | |
tree | 80ea62a6b3ba7a2407165796ed35f79d8dbb9844 | |
parent | 8af907950f87a10b0620390cfa676a74908e54dd (diff) | |
download | samba-10ad200350e304f1ca7b4080a04f4fe4eeb80763.tar.gz samba-10ad200350e304f1ca7b4080a04f4fe4eeb80763.tar.bz2 samba-10ad200350e304f1ca7b4080a04f4fe4eeb80763.zip |
added netr_LogonControl() and netr_GetAnyDCName()
(This used to be commit 17b2be4e859bd7f625214d7e7de9758b5ab5fb90)
-rw-r--r-- | source4/librpc/idl/netlogon.idl | 77 | ||||
-rw-r--r-- | source4/torture/rpc/netlogon.c | 75 |
2 files changed, 109 insertions, 43 deletions
diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl index 2c18edac30..6281821d88 100644 --- a/source4/librpc/idl/netlogon.idl +++ b/source4/librpc/idl/netlogon.idl @@ -577,7 +577,7 @@ interface netlogon NTSTATUS netr_DatabaseDeltas( - [in] unistr logonserver, + [in] unistr logon_server, [in] unistr computername, [in] netr_Authenticator credential, [in,out] netr_Authenticator return_authenticator, @@ -592,7 +592,7 @@ interface netlogon /* Function 0x08 */ NTSTATUS netr_DatabaseSync( - [in] unistr logonserver, + [in] unistr logon_server, [in] unistr computername, [in] netr_Authenticator credential, [in,out] netr_Authenticator return_authenticator, @@ -619,7 +619,7 @@ interface netlogon } netr_AccountBuffer; NTSTATUS netr_AccountDeltas( - [in] unistr *logonserver, + [in] unistr *logon_server, [in] unistr computername, [in] netr_Authenticator credential, [in,out] netr_Authenticator return_authenticator, @@ -638,7 +638,7 @@ interface netlogon /* Function 0x0A */ NTSTATUS netr_AccountSync( - [in] unistr *logonserver, + [in] unistr *logon_server, [in] unistr computername, [in] netr_Authenticator credential, [in,out] netr_Authenticator return_authenticator, @@ -662,56 +662,57 @@ interface netlogon [out] unistr *dcname ); -#if 0 + + + /*****************/ + /* Function 0x0C */ typedef struct { uint32 flags; uint32 pdc_connection_status; - } NETLOGON_INFO_1; + } netr_NETLOGON_INFO_1; typedef struct { uint32 flags; uint32 pdc_connection_status; unistr trusted_dc_name; uint32 tc_connection_status; - } NETLOGON_INFO_2; + } netr_NETLOGON_INFO_2; typedef struct { uint32 flags; uint32 logon_attempts; - uint32 reserved; - uint32 reserved; - uint32 reserved; - uint32 reserved; - uint32 reserved; - } NETLOGON_INFO_3; - - typedef [switch_type(long)] union { - [case(1)] NETLOGON_INFO_1 *i1; - [case(2)] NETLOGON_INFO_2 *i2; - [case(3)] NETLOGON_INFO_3 *i3; - } CONTROL_QUERY_INFORMATION; - - - /*****************/ - /* Function 0x0C */ + uint32 unknown1; + uint32 unknown2; + uint32 unknown3; + uint32 unknown4; + uint32 unknown5; + } netr_NETLOGON_INFO_3; - NTSTATUS netr_LogonControl( - [in][string] wchar_t *logonserver, - [in] uint32 function_code, - [in] uint32 level, - [out][ref] CONTROL_QUERY_INFORMATION + typedef union { + [case(1)] netr_NETLOGON_INFO_1 *info1; + [case(2)] netr_NETLOGON_INFO_2 *info2; + [case(3)] netr_NETLOGON_INFO_3 *info3; + } netr_CONTROL_QUERY_INFORMATION; + + WERROR netr_LogonControl( + [in] unistr *logon_server, + [in] uint32 function_code, + [in] uint32 level, + [out,switch_is(level)] netr_CONTROL_QUERY_INFORMATION info ); /*****************/ /* Function 0x0D */ - NTSTATUS netr_GetAnyDCName( - [in] unistr *logon_server, - [in] unistr *domainname, - [out]unistr *dcname, - }; + WERROR netr_GetAnyDCName( + [in] unistr *logon_server, + [in] unistr *domainname, + [out] unistr *dcname + ); + +#if 0 typedef [switch_type(long)] union { [case(5)] unistr *unknown; @@ -725,7 +726,7 @@ interface netlogon /* Function 0x0E */ NTSTATUS netr_LogonControl2( - [in][string] wchar_t *logonserver, + [in][string] wchar_t *logon_server, [in] uint32 function_code, [in] uint32 level, [in][ref] CONTROL_DATA_INFORMATION *data, @@ -737,7 +738,7 @@ interface netlogon /* Function 0x0F */ NTSTATUS netr_ServerAuthenticate2( - [in][string] wchar_t *logonserver, + [in][string] wchar_t *logon_server, [in] unistr username, [in] uint16 secure_channel_type, [in] unistr computername, @@ -751,7 +752,7 @@ interface netlogon /* Function 0x10 */ NTSTATUS netr_DatabaseSync2( - [in][string][ref] wchar_t *logonserver, # REF!!! + [in][string][ref] wchar_t *logon_server, # REF!!! [in][string][ref] wchar_t *computername, [in][ref] AUTHENTICATOR credential, [in][out][ref] AUTHENTICATOR return_authenticator, @@ -767,7 +768,7 @@ interface netlogon /* Function 0x11 */ NTSTATUS netr_DatabaseRedo( - [in][string][ref] wchar_t *logonserver, # REF!!! + [in][string][ref] wchar_t *logon_server, # REF!!! [in][string][ref] wchar_t *computername, [in][ref] netr_Authenticator credential, [in][out][ref] netr_Authenticator return_authenticator, @@ -781,7 +782,7 @@ interface netlogon /* Function 0x12 */ NTSTATUS netr_LogonControl2Ex( - [in][string] wchar_t *logonserver, + [in][string] wchar_t *logon_server, [in] uint32 function_code, [in] uint32 level, [in][ref] CONTROL_DATA_INFORMATION *data, diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index a38990bdc1..008d03109e 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -259,7 +259,7 @@ static BOOL test_DatabaseSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } - r.in.logonserver = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); r.in.computername = lp_netbios_name(); r.in.preferredmaximumlength = (uint32)-1; ZERO_STRUCT(r.in.return_authenticator); @@ -293,7 +293,7 @@ static BOOL test_DatabaseSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) r.out.delta_enum_array->delta_enum[0].delta_union.domain) { sequence_nums[r.in.database_id] = r.out.delta_enum_array->delta_enum[0].delta_union.domain->sequence_num; - printf("sequence_nums[%d]=0x%08x%08x\n", + printf("\tsequence_nums[%d]=0x%08x%08x\n", r.in.database_id, sequence_nums[r.in.database_id].high, sequence_nums[r.in.database_id].low); @@ -321,7 +321,7 @@ static BOOL test_DatabaseDeltas(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } - r.in.logonserver = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); r.in.computername = lp_netbios_name(); r.in.preferredmaximumlength = (uint32)-1; ZERO_STRUCT(r.in.return_authenticator); @@ -372,7 +372,7 @@ static BOOL test_AccountDeltas(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } - r.in.logonserver = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); r.in.computername = lp_netbios_name(); ZERO_STRUCT(r.in.return_authenticator); creds_client_authenticator(&creds, &r.in.credential); @@ -407,7 +407,7 @@ static BOOL test_AccountSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } - r.in.logonserver = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); r.in.computername = lp_netbios_name(); ZERO_STRUCT(r.in.return_authenticator); creds_client_authenticator(&creds, &r.in.credential); @@ -447,6 +447,63 @@ static BOOL test_GetDcName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } + printf("\tDC is at '%s'\n", r.out.dcname); + + return True; +} + +/* + try a netlogon LogonControl +*/ +static BOOL test_LogonControl(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct netr_LogonControl r; + BOOL ret = True; + int i; + + r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + r.in.function_code = 1; + + for (i=1;i<4;i++) { + r.in.level = i; + + printf("Testing LogonControl level %d\n", i); + + status = dcerpc_netr_LogonControl(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("LogonControl - %s\n", nt_errstr(status)); + ret = False; + } + } + + return ret; +} + + +/* + try a netlogon GetAnyDCName +*/ +static BOOL test_GetAnyDCName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct netr_GetAnyDCName r; + + r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + r.in.domainname = lp_workgroup(); + + printf("Testing GetAnyDCName\n"); + + status = dcerpc_netr_GetAnyDCName(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("GetAnyDCName - %s\n", nt_errstr(status)); + return False; + } + + if (r.out.dcname) { + printf("\tDC is at '%s'\n", r.out.dcname); + } + return True; } @@ -506,6 +563,14 @@ BOOL torture_rpc_netlogon(int dummy) ret = False; } + if (!test_LogonControl(p, mem_ctx)) { + ret = False; + } + + if (!test_GetAnyDCName(p, mem_ctx)) { + ret = False; + } + torture_rpc_close(p); return ret; |