/* Logon domain user */
-NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- uint32 logon_parameters,
- const char *domain,
- const char *username,
- const char *password,
- const char *workstation,
- uint16_t _ignored_validation_level,
- int logon_type)
-{
- NTSTATUS status;
- union netr_LogonLevel *logon;
- uint16_t validation_level = 0;
- union netr_Validation *validation = NULL;
- uint8_t authoritative = 0;
- uint32_t flags = 0;
- fstring clnt_name_slash;
-
- logon = talloc_zero(mem_ctx, union netr_LogonLevel);
- if (!logon) {
- return NT_STATUS_NO_MEMORY;
- }
-
- if (workstation) {
- fstr_sprintf( clnt_name_slash, "\\\\%s", workstation );
- } else {
- fstr_sprintf( clnt_name_slash, "\\\\%s", lp_netbios_name() );
- }
-
- /* Initialise input parameters */
-
- switch (logon_type) {
- case NetlogonInteractiveInformation: {
-
- struct netr_PasswordInfo *password_info;
-
- struct samr_Password lmpassword;
- struct samr_Password ntpassword;
-
- password_info = talloc_zero(mem_ctx, struct netr_PasswordInfo);
- if (!password_info) {
- return NT_STATUS_NO_MEMORY;
- }
-
- nt_lm_owf_gen(password, ntpassword.hash, lmpassword.hash);
-
- password_info->identity_info.domain_name.string = domain;
- password_info->identity_info.parameter_control = logon_parameters;
- password_info->identity_info.logon_id_low = 0xdead;
- password_info->identity_info.logon_id_high = 0xbeef;
- password_info->identity_info.account_name.string = username;
- password_info->identity_info.workstation.string = clnt_name_slash;
-
- password_info->lmpassword = lmpassword;
- password_info->ntpassword = ntpassword;
-
- logon->password = password_info;
-
- break;
- }
- case NetlogonNetworkInformation: {
- struct netr_NetworkInfo *network_info;
- uint8 chal[8];
- unsigned char local_lm_response[24];
- unsigned char local_nt_response[24];
- struct netr_ChallengeResponse lm;
- struct netr_ChallengeResponse nt;
-
- ZERO_STRUCT(lm);
- ZERO_STRUCT(nt);
-
- network_info = talloc_zero(mem_ctx, struct netr_NetworkInfo);
- if (!network_info) {
- return NT_STATUS_NO_MEMORY;
- }
-
- generate_random_buffer(chal, 8);
-
- SMBencrypt(password, chal, local_lm_response);
- SMBNTencrypt(password, chal, local_nt_response);
-
- lm.length = 24;
- lm.data = local_lm_response;
-
- nt.length = 24;
- nt.data = local_nt_response;
-
- network_info->identity_info.domain_name.string = domain;
- network_info->identity_info.parameter_control = logon_parameters;
- network_info->identity_info.logon_id_low = 0xdead;
- network_info->identity_info.logon_id_high = 0xbeef;
- network_info->identity_info.account_name.string = username;
- network_info->identity_info.workstation.string = clnt_name_slash;
-
- memcpy(network_info->challenge, chal, 8);
- network_info->nt = nt;
- network_info->lm = lm;
-
- logon->network = network_info;
-
- break;
- }
- default:
- DEBUG(0, ("switch value %d not supported\n",
- logon_type));
- return NT_STATUS_INVALID_INFO_CLASS;
- }
-
- status = netlogon_creds_cli_LogonSamLogon(cli->netlogon_creds,
- cli->binding_handle,
- logon_type,
- logon,
- mem_ctx,
- &validation_level,
- &validation,
- &authoritative,
- &flags);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- return NT_STATUS_OK;
-}
-
NTSTATUS rpccli_netlogon_password_logon(struct netlogon_creds_cli_context *creds,
struct dcerpc_binding_handle *binding_handle,
uint32_t logon_parameters,