From b0531a38cc7135538d251440ac4fc2c887d9f335 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Dec 2003 01:41:38 +0000 Subject: started adding netlogon IDL and test suite (This used to be commit 3d64eefb464d09fb6e84d6139f801887a278cf86) --- source4/Makefile.in | 2 +- source4/build/pidl/util.pm | 2 + source4/librpc/idl/netlogon.idl | 631 +++++++++++++++++++++++++++++++++++++++- source4/librpc/ndr/ndr_basic.c | 28 ++ source4/torture/rpc/netlogon.c | 72 +++++ source4/torture/torture.c | 1 + 6 files changed, 732 insertions(+), 4 deletions(-) create mode 100644 source4/torture/rpc/netlogon.c diff --git a/source4/Makefile.in b/source4/Makefile.in index f0e9574f4b..399027dc16 100644 --- a/source4/Makefile.in +++ b/source4/Makefile.in @@ -441,7 +441,7 @@ SMBTORTURE_RPC_OBJ = torture/rpc/lsa.o torture/rpc/echo.o torture/rpc/dfs.o \ torture/rpc/spoolss.o torture/rpc/samr.o torture/rpc/wkssvc.o \ torture/rpc/srvsvc.o torture/rpc/atsvc.o torture/rpc/eventlog.o \ torture/rpc/epmapper.o torture/rpc/winreg.o torture/rpc/mgmt.o \ - torture/rpc/scanner.o torture/rpc/autoidl.o + torture/rpc/scanner.o torture/rpc/autoidl.o torture/rpc/netlogon.o SMBTORTURE_OBJ1 = torture/torture.o torture/torture_util.o torture/nbio.o torture/scanner.o \ torture/utable.o torture/denytest.o torture/mangle_test.o \ diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm index e99942f0ea..08a8917fa5 100644 --- a/source4/build/pidl/util.pm +++ b/source4/build/pidl/util.pm @@ -183,6 +183,7 @@ sub is_scalar_type($) return 1, if ($type eq "uint8"); return 1, if ($type eq "uint16"); return 1, if ($type eq "NTTIME"); + return 1, if ($type eq "time_t"); return 1, if ($type eq "error_status_t"); return 1, if ($type eq "boolean32"); return 1, if ($type eq "unsigned32"); @@ -210,6 +211,7 @@ sub type_align($) return 1, if ($type eq "uint8"); return 2, if ($type eq "uint16"); return 4, if ($type eq "NTTIME"); + return 4, if ($type eq "time_t"); return 8, if ($type eq "HYPER_T"); return 2, if ($type eq "wchar_t"); return 4, if ($type eq "DATA_BLOB"); diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl index 049e6936ca..445f89d440 100644 --- a/source4/librpc/idl/netlogon.idl +++ b/source4/librpc/idl/netlogon.idl @@ -1,15 +1,640 @@ /* - plug and play services? + netlogon interface + much of this was derived from the ethereal sources - thanks to everyone + who contributed! */ +#include "idl_types.h" + [ uuid(12345678-1234-abcd-ef00-01234567cffb), version(1.0) ] + interface netlogon { - /*****************/ /* Function 0x00 */ - WERROR netlogon_Unknown0(); + typedef struct { + unistr *effective_name; + uint32 priv; + uint32 auth_flags; + uint32 logon_count; + uint32 bad_pw_count; + time_t last_logon; + time_t last_logoff; + time_t logoff_time; + time_t kickoff_time; + uint32 password_age; + time_t pw_can_change; + time_t pw_must_change; + unistr *computer; + unistr *domain; + unistr *script_path; + uint32 unknown; + } netr_UasInfo; + + WERROR netr_LogonUasLogon( + [in] unistr *server_name, + [in] unistr username, + [in] unistr workstation, + [out] netr_UasInfo *info + ); + +#if 0 + typedef struct { + uint32 duration; + short logon_count; + } LOGOFF_UAS_INFO; + uint32 netr_LogonUasLogoff( + [in] unistr *ServerName, + [in][ref][string] wchar_t *UserName, + [in][ref][string] wchar_t *Workstation, + [out][ref] LOGOFF_UAS_INFO *info + ); + typedef struct { + UNICODESTRING LogonDomainName; + uint32 ParameterControl; + uint64 LogonID; + UNICODESTRING UserName; + UNICODESTRING Workstation; + } LOGON_IDENTITY_INFO; + typedef struct { + char password[16]; + } LM_OWF_PASSWORD; + typedef struct { + char password[16]; + } NT_OWF_PASSWORD; + typedef struct { + LOGON_IDENTITY_INFO identity_info; + LM_OWF_PASSWORD lmpassword; + NT_OWF_PASSWORD ntpassword; + } INTERACTIVE_INFO; + typedef struct { + char chl[8]; + } CHALLENGE; + typedef struct { + LOGON_IDENTITY_INFO logon_info; + CHALLENGE chal; + STRING ntchallengeresponse; + STRING lmchallengeresponse; + } NETWORK_INFO; + typedef struct { + LOGON_IDENTITY_INFO logon_info; + LM_OWF_PASSWORD lmpassword; + NT_OWF_PASSWORD ntpassword; + } SERVICE_INFO; + typedef [switch_type(short)] union { + [case(1)][unique] INTERACTIVE_INFO *iinfo; + [case(2)][unique] NETWORK_INFO *ninfo; + [case(3)][unique] SERVICE_INFO *sinfo; + } LEVEL; + typedef struct { + char cred[8]; + } CREDENTIAL; + typedef struct { + CREDENTIAL cred; + uint32 timestamp; + } AUTHENTICATOR; + typedef struct { + uint32 user_id; + uint32 attributes; + } GROUP_MEMBERSHIP; + typedef struct { + char user_session_key[16]; + } USER_SESSION_KEY; + typedef struct { + uint64 LogonTime; + uint64 LogoffTime; + uint64 KickOffTime; + uint64 PasswdLastSet; + uint64 PasswdCanChange; + uint64 PasswdMustChange; + unicodestring effectivename; + unicodestring fullname; + unicodestring logonscript; + unicodestring profilepath; + unicodestring homedirectory; + unicodestring homedirectorydrive; + short LogonCount; + short BadPasswdCount; + uint32 userid; + uint32 primarygroup; + uint32 groupcount; + [unique][size_is(groupcount)] GROUP_MEMBERSHIP *groupids; + uint32 userflags; + USER_SESSION_KEY key; + unicodestring logonserver; + unicodestring domainname; + [unique] SID logondomainid; + uint32 expansionroom[10]; + } VALIDATION_SAM_INFO; + typedef struct { + uint64 LogonTime; + uint64 LogoffTime; + uint64 KickOffTime; + uint64 PasswdLastSet; + uint64 PasswdCanChange; + uint64 PasswdMustChange; + unicodestring effectivename; + unicodestring fullname; + unicodestring logonscript; + unicodestring profilepath; + unicodestring homedirectory; + unicodestring homedirectorydrive; + short LogonCount; + short BadPasswdCount; + uint32 userid; + uint32 primarygroup; + uint32 groupcount; + [unique] GROUP_MEMBERSHIP *groupids; + uint32 userflags; + USER_SESSION_KEY key; + unicodestring logonserver; + unicodestring domainname; + [unique] SID logondomainid; + uint32 expansionroom[10]; + uint32 sidcount; + [unique] SID_AND_ATTRIBS; + } VALIDATION_SAM_INFO2; + typedef struct { + uint32 pac_size + [unique][size_is(pac_size)] char *pac; + UNICODESTRING logondomain; + UNICODESTRING logonserver; + UNICODESTRING principalname; + uint32 auth_size; + [unique][size_is(auth_size)] char *auth; + USER_SESSION_KEY user_session_key; + uint32 expansionroom[10]; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + } VALIDATION_PAC_INFO; + typedef [switch_type(short)] union { + [case(2)][unique] VALIDATION_SAM_INFO *sam; + [case(3)][unique] VALIDATION_SAM_INFO2 *sam2; + [case(4)][unique] VALIDATION_PAC_INFO *pac; + [case(5)][unique] VALIDATION_PAC_INFO *pac2; + } VALIDATION; + uint32 netr_LogonSamLogon( + [in] unistr *ServerName, + [in] unistr *Workstation, + [in][unique] AUTHENTICATOR *credential, + [in][out][unique] AUTHENTICATOR *returnauthenticator, + [in] short LogonLevel, + [in][ref] LOGON_LEVEL *logonlevel, + [in] short ValidationLevel, + [out][ref] VALIDATION *validation, + [out][ref] boolean Authorative + ); + uint32 netr_LogonSamLogoff( + [in] unistr *ServerName, + [in] unistr *ComputerName, + [in][unique] AUTHENTICATOR credential, + [in][unique] AUTHENTICATOR return_authenticator, + [in] short logon_level, + [in][ref] LEVEL logoninformation + ); + uint32 netr_ServerReqChallenge( + [in] unistr *ServerName, + [in][ref][string] wchar_t *ComputerName, + [in][ref] CREDENTIAL client_credential, + [out][ref] CREDENTIAL server_credential + ); + uint32 netr_ServerAuthenticate( + [in] unistr *ServerName, + [in][ref][string] wchar_t *UserName, + [in] short secure_challenge_type, + [in][ref][string] wchar_t *ComputerName, + [in][ref] CREDENTIAL client_challenge, + [out][ref] CREDENTIAL server_challenge + ); + typedef struct { + char encrypted_password[16]; + } ENCRYPTED_LM_OWF_PASSWORD; + uint32 netr_ServerPasswordSet( + [in] unistr *ServerName, + [in][ref][string] wchar_t *UserName, + [in] short secure_challenge_type, + [in][ref][string] wchar_t *ComputerName, + [in][ref] AUTHENTICATOR credential, + [in][ref] LM_OWF_PASSWORD UasNewPassword, + [out][ref] AUTHENTICATOR return_authenticator + ); + typedef struct { + unistr *UserName; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_DELETE_USER; + typedef struct { + bool SensitiveDataFlag; + uint32 DataLength; + [unique][size_is(DataLength)] char *SensitiveData; + } USER_PRIVATE_INFO; + typedef struct { + UNICODESTRING UserName; + UNICODESTRING FullName; + uint32 UserID; + uint32 PrimaryGroupID; + UNICODESTRING HomeDir; + UNICODESTRING HomeDirDrive; + UNICODESTRING LogonScript; + UNICODESTRING Comment; + UNICODESTRING Workstations; + NTTIME LastLogon; + NTTIME LastLogoff; + LOGON_HOURS logonhours; + short BadPwCount; + short LogonCount; + NTTIME PwLastSet; + NTTIME AccountExpires; + uint32 AccountControl; + LM_OWF_PASSWORD lmpw; + NT_OWF_PASSWORD ntpw; + bool NTPwPresent; + bool LMPwPresent; + bool PwExpired; + UNICODESTRING UserComment; + UNICODESTRING Parameters; + short CountryCode; + short CodePage; + USER_PRIVATE_INFO user_private_info; + uint32 SecurityInformation; + LSA_SECURITY_DESCRIPTOR sec_desc; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_USER; + typedef struct { + UNICODESTRING DomainName; + UNICODESTRING OEMInfo; + NTTIME forcedlogoff; + short minpasswdlen; + short passwdhistorylen; + NTTIME pwd_must_change_time; + NTTIME pwd_can_change_time; + NTTIME domain_modify_time; + NTTIME domain_create_time; + uint32 SecurityInformation; + LSA_SECURITY_DESCRIPTOR sec_desc; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_DOMAIN; + typedef struct { + UNICODESTRING groupname; + GROUP_MEMBERSHIP group_membership; + UNICODESTRING comment; + uint32 SecurityInformation; + LSA_SECURITY_DESCRIPTOR sec_desc; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_GROUP; + typedef struct { + UNICODESTRING OldName; + UNICODESTRING NewName; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_RENAME; + typedef struct { + [unique][size_is(num_rids)] uint32 *rids; + [unique][size_is(num_rids)] uint32 *attribs; + uint32 num_rids; + uint32 dummy1; + uint32 dummy2; + uint32 dummy3; + uint32 dummy4; + } DELTA_GROUP_MEMBER; + typedef struct { + UNICODESTRING alias_name; + uint32 rid; + uint32 SecurityInformation; + LSA_SECURITY_DESCRIPTOR sec_desc; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_ALIAS; + typedef struct { + [unique] SID_ARRAY sids; + uint32 dummy1; + uint32 dummy2; + uint32 dummy3; + uint32 dummy4; + } DELTA_ALIAS_MEMBER; + typedef struct { + uint32 pagedpoollimit; + uint32 nonpagedpoollimit; + uint32 minimumworkingsetsize; + uint32 maximumworkingsetsize; + uint32 pagefilelimit; + NTTIME timelimit; + } QUOTA_LIMITS; + typedef struct { + uint32 maxlogsize; + NTTIME auditretentionperiod; + bool auditingmode; + uint32 maxauditeventcount; + [unique][size_is(maxauditeventcount)] uint32 *eventauditoptions; + UNICODESTRING primarydomainname; + [unique] SID *sid; + QUOTA_LIMITS quota_limits; + NTTIME db_modify_time; + NTTIME db_create_time; + uint32 SecurityInformation; + LSA_SECURITY_DESCRIPTOR sec_desc; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_POLICY; + typedef struct { + UNICODESTRING DomainName; + uint32 num_controllers; + [unique][size_is(num_controllers)] UNICODESTRING *controller_names; + uint32 SecurityInformation; + LSA_SECURITY_DESCRIPTOR sec_desc; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_TRUSTED_DOMAINS; + typedef struct { + uint32 privilegeentries; + uint32 provolegecontrol; + [unique][size_is(privilege_entries)] uint32 *privilege_attrib; + [unique][size_is(privilege_entries)] UNICODESTRING *privilege_name; + QUOTALIMITS quotalimits; + uint32 SecurityInformation; + LSA_SECURITY_DESCRIPTOR sec_desc; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_ACCOUNTS; + typedef struct { + uint32 len; + uint32 maxlen; + [unique][size_is(maxlen)][length_is(len)] char *cipher_data; + } CIPHER_VALUE; + typedef struct { + CIPHER_VALUE current_cipher; + NTTIME current_cipher_set_time; + CIPHER_VALUE old_cipher; + NTTIME old_cipher_set_time; + uint32 SecurityInformation; + LSA_SECURITY_DESCRIPTOR sec_desc; + UNICODESTRING dummy1; + UNICODESTRING dummy2; + UNICODESTRING dummy3; + UNICODESTRING dummy4; + uint32 dummy5; + uint32 dummy6; + uint32 dummy7; + uint32 dummy8; + } DELTA_SECRET; + typedef struct { + uint32 low_value; + uint32 high_value; + } xxx; + + typedef [switch_type(short)] union { + [case(1)][unique] DELTA_DOMAIN *domain; + [case(2)][unique] DELTA_GROUP *group; + [case(4)][unique] DELTA_RENAME_GROUP *rename_group; + [case(5)][unique] DELTA_USER *user; + [case(7)][unique] DELTA_RENAME_USER *rename_user; + [case(8)][unique] DELTA_GROUP_MEMBER *group_member; + [case(9)][unique] DELTA_ALIAS *alias; + [case(11)][unique] DELTA_RENAME_ALIAS *rename_alias; + [case(12)][unique] DELTA_ALIAS_MEMBER *alias_member; + [case(13)][unique] DELTA_POLICY *policy; + [case(14)][unique] DELTA_TRUSTED_DOMAINS *trusted_domains; + [case(16)][unique] DELTA_ACCOUNTS *accounts; + [case(18)][unique] DELTA_SECRET *secret; + [case(20)][unique] DELTA_DELETE_USER *delete_group; + [case(21)][unique] DELTA_DELETE_USER *delete_user; + [case(22)][unique] MODIFIED_COUNT *modified_count; + } DELTA_UNION; + + typedef [switch_type(short)] union { + [case(1)] uint32 rid; + [case(2)] uint32 rid; + [case(3)] uint32 rid; + [case(4)] uint32 rid; + [case(5)] uint32 rid; + [case(6)] uint32 rid; + [case(7)] uint32 rid; + [case(8)] uint32 rid; + [case(9)] uint32 rid; + [case(10)] uint32 rid; + [case(11)] uint32 rid; + [case(12)] uint32 rid; + [case(13)] [unique] SID *sid; + [case(14)] [unique] SID *sid; + [case(15)] [unique] SID *sid; + [case(16)] [unique] SID *sid; + [case(17)] [unique] SID *sid; + [case(18)] unistr *Name ; + [case(19)] unistr *Name ; + [case(20)] uint32 rid; + [case(21)] uint32 rid; + } DELTA_ID_UNION; + typedef struct { + short delta_type; + DELTA_ID_UNION delta_id_union; + DELTA_UNION delta_union; + } DELTA_ENUM; + typedef struct { + uint32 num_deltas; + [unique][size_is(num_deltas)] DELTA_ENUM *delta_enum; + } DELTA_ENUM_ARRAY; + uint32 netr_DatabaseDeltas( + [in][string][ref] wchar_t *logonserver, # REF!!! + [in][string][ref] wchar_t *computername, + [in][ref] AUTHENTICATOR credential, + [in][out][ref] AUTHENTICATOR return_authenticator, + [in] uint32 database_id, + [in][out][ref] MODIFIED_COUNT domain_modify_count, + [in] uint32 preferredmaximumlength, + [out][unique] DELTA_ENUM_ARRAY *delta_enum_array + ); + uint32 netr_DatabaseSync( + [in][string][ref] wchar_t *logonserver, # REF!!! + [in][string][ref] wchar_t *computername, + [in][ref] AUTHENTICATOR credential, + [in][out][ref] AUTHENTICATOR return_authenticator, + [in] uint32 database_id, + [in][out][ref] uint32 sync_context, + [in] uint32 preferredmaximumlength, + [out][unique] DELTA_ENUM_ARRAY *delta_enum_array + ); + typedef struct { + char computer_name[16]; + uint32 timecreated; + uint32 serial_number; + } UAS_INFO_0; + uint32 netr_AccountDeltas( + [in][string][unique] wchar_t *logonserver, + [in][string][ref] wchar_t *computername, + [in][ref] AUTHENTICATOR credential, + [in][out][ref] AUTHENTICATOR return_authenticator, + [out][ref][size_is(count_returned)] char *Buffer, + [out][ref] uint32 count_returned, + [out][ref] uint32 total_entries, + [in][out][ref] UAS_INFO_0 recordid, + [in][long] count, + [in][long] level, + [in][long] buffersize, + ); + uint32 netr_AccountSync( + [in][string][unique] wchar_t *logonserver, + [in][string][ref] wchar_t *computername, + [in][ref] AUTHENTICATOR credential, + [in][out][ref] AUTHENTICATOR return_authenticator, + [out][ref][size_is(count_returned)] char *Buffer, + [out][ref] uint32 count_returned, + [out][ref] uint32 total_entries, + [out][ref] uint32 next_reference, + [in][long] reference, + [in][long] level, + [in][long] buffersize, + [in][out][ref] UAS_INFO_0 recordid, + ); + uint32 netr_GetDcName( + [in][ref][string] wchar_t *logon_server, + [in] unistr *domainname, + [out]unistr *dcname, + }; + typedef struct { + uint32 flags; + uint32 pdc_connection_status; + } NETLOGON_INFO_1; + typedef struct { + uint32 flags; + uint32 pdc_connection_status; + unistrtrusted_dc_name; + uint32 tc_connection_status; + } 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)] [unique] NETLOGON_INFO_1 *i1; + [case(2)] [unique] NETLOGON_INFO_2 *i2; + [case(3)] [unique] NETLOGON_INFO_3 *i3; + } CONTROL_QUERY_INFORMATION; + uint32 netr_LogonControl( + [in][string][unique] wchar_t *logonserver, + [in] uint32 function_code, + [in] uint32 level, + [out][ref] CONTROL_QUERY_INFORMATION + ); + uint32 netr_GetAnyDCName( + [in] unistr *logon_server, + [in] unistr *domainname, + [out]unistr *dcname, + }; + typedef [switch_type(long)] union { + [case(5)] unistr *unknown; + [case(6)] unistr *unknown; + [case(0xfffe)] uint32 unknown; + [case(7)] unistry*unknown; + } CONTROL_DATA_INFORMATION; + uint32 netr_LogonControl2( + [in][string][unique] wchar_t *logonserver, + [in] uint32 function_code, + [in] uint32 level, + [in][ref] CONTROL_DATA_INFORMATION *data, + [out][ref] CONTROL_QUERY_INFORMATION *query + ); + uint32 netr_ServerAuthenticate2( + [in][string][unique] wchar_t *logonserver, + [in][ref][string] wchar_t *username, + [in] short secure_channel_type, + [in][ref][string] wchar_t *computername, + [in][ref] CREDENTIAL *client_chal, + [out][ref] CREDENTIAL *server_chal, + [in][out][ref] uint32 *negotiate_flags, + ); + uint32 netr_DatabaseSync2( + [in][string][ref] wchar_t *logonserver, # REF!!! + [in][string][ref] wchar_t *computername, + [in][ref] AUTHENTICATOR credential, + [in][out][ref] AUTHENTICATOR return_authenticator, + [in] uint32 database_id, + [in] short restart_state, + [in][out][ref] uint32 *sync_context, + [in] uint32 preferredmaximumlength, + [out][unique] DELTA_ENUM_ARRAY *delta_enum_array + ); + uint32 netr_DatabaseRedo( + [in][string][ref] wchar_t *logonserver, # REF!!! + [in][string][ref] wchar_t *computername, + [in][ref] AUTHENTICATOR credential, + [in][out][ref] AUTHENTICATOR return_authenticator, + [in][ref][size_is(change_log_entry_size)] char *change_log_entry, + [in] uint32 change_log_entry_size, + [out][unique] DELTA_ENUM_ARRAY *delta_enum_array + ); + uint32 netr_LogonControl2Ex( + [in][string][unique] wchar_t *logonserver, + [in] uint32 function_code, + [in] uint32 level, + [in][ref] CONTROL_DATA_INFORMATION *data, + [out][ref] CONTROL_QUERY_INFORMATION *query + ); +#endif } diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 52f4d29428..32cc7bac5f 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -597,6 +597,25 @@ NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, NTTIME *t) return NT_STATUS_OK; } +/* + push a time_t +*/ +NTSTATUS ndr_push_time_t(struct ndr_push *ndr, time_t t) +{ + return ndr_push_uint32(ndr, t); +} + +/* + pull a time_t +*/ +NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, time_t *t) +{ + uint32 tt; + NDR_CHECK(ndr_pull_uint32(ndr, &tt)); + *t = tt; + return NT_STATUS_OK; +} + void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type) { @@ -646,6 +665,15 @@ void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t) ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr->mem_ctx, &t)); } +void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t) +{ + if (t == (time_t)-1 || t == 0) { + ndr->print(ndr, "%-25s: (time_t)%d", name, (int)t); + } else { + ndr->print(ndr, "%-25s: %s", name, http_timestring(ndr->mem_ctx, t)); + } +} + void ndr_print_union(struct ndr_print *ndr, const char *name, uint16 level, const char *type) { ndr->print(ndr, "%-25s: union %s(case %u)", name, type, level); diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c new file mode 100644 index 0000000000..6ea51a9253 --- /dev/null +++ b/source4/torture/rpc/netlogon.c @@ -0,0 +1,72 @@ +/* + Unix SMB/CIFS implementation. + + test suite for netlogon rpc operations + + Copyright (C) Andrew Tridgell 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + + +static BOOL test_LogonUasLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct netr_LogonUasLogon r; + + r.in.server_name = NULL; + r.in.username = lp_parm_string(-1, "torture", "username"); + r.in.workstation = lp_netbios_name(); + + status = dcerpc_netr_LogonUasLogon(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("LogonUasLogon - %s\n", nt_errstr(status)); + return False; + } + + return True; + +} + + +BOOL torture_rpc_netlogon(int dummy) +{ + NTSTATUS status; + struct dcerpc_pipe *p; + TALLOC_CTX *mem_ctx; + BOOL ret = True; + + mem_ctx = talloc_init("torture_rpc_netlogon"); + + status = torture_rpc_connection(&p, + DCERPC_NETLOGON_NAME, + DCERPC_NETLOGON_UUID, + DCERPC_NETLOGON_VERSION); + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + p->flags |= DCERPC_DEBUG_PRINT_BOTH; + + if (!test_LogonUasLogon(p, mem_ctx)) { + ret = False; + } + + torture_rpc_close(p); + + return ret; +} diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 5b6566df81..3851337b8e 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -4062,6 +4062,7 @@ static struct { {"RPC-DFS", torture_rpc_dfs, 0}, {"RPC-SPOOLSS", torture_rpc_spoolss, 0}, {"RPC-SAMR", torture_rpc_samr, 0}, + {"RPC-NETLOGON", torture_rpc_netlogon, 0}, {"RPC-WKSSVC", torture_rpc_wkssvc, 0}, {"RPC-SRVSVC", torture_rpc_srvsvc, 0}, {"RPC-ATSVC", torture_rpc_atsvc, 0}, -- cgit