#include "rpc_client/cli_lsarpc.h"
#include "librpc/gen_ndr/messaging.h"
#include "../lib/crypto/md4.h"
+#include "rpc_client/init_lsa.h"
+#include "rpc_server/rpc_ncacn_np.h"
+#include "../libcli/security/dom_sid.h"
extern userdom_struct current_user_info;
_netr_LogonControl
*************************************************************************/
-WERROR _netr_LogonControl(pipes_struct *p,
+WERROR _netr_LogonControl(struct pipes_struct *p,
struct netr_LogonControl *r)
{
struct netr_LogonControl2Ex l;
Send a message to smbd to do a sam synchronisation
**************************************************************************/
-static void send_sync_message(void)
+static void send_sync_message(struct messaging_context *msg_ctx)
{
DEBUG(3, ("sending sam synchronisation message\n"));
- message_send_all(smbd_messaging_context(), MSG_SMB_SAM_SYNC, NULL, 0,
- NULL);
+ message_send_all(msg_ctx, MSG_SMB_SAM_SYNC, NULL, 0, NULL);
}
/*************************************************************************
_netr_LogonControl2
*************************************************************************/
-WERROR _netr_LogonControl2(pipes_struct *p,
+WERROR _netr_LogonControl2(struct pipes_struct *p,
struct netr_LogonControl2 *r)
{
struct netr_LogonControl2Ex l;
_netr_LogonControl2Ex
****************************************************************/
-WERROR _netr_LogonControl2Ex(pipes_struct *p,
+WERROR _netr_LogonControl2Ex(struct pipes_struct *p,
struct netr_LogonControl2Ex *r)
{
uint32_t flags = 0x0;
const char *fn;
uint32_t acct_ctrl;
- switch (p->hdr_req.opnum) {
+ switch (p->opnum) {
case NDR_NETR_LOGONCONTROL:
fn = "_netr_LogonControl";
break;
}
if (lp_server_role() == ROLE_DOMAIN_BDC) {
- send_sync_message();
+ send_sync_message(p->msg_ctx);
}
return WERR_OK;
_netr_NetrEnumerateTrustedDomains
*************************************************************************/
-NTSTATUS _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
+NTSTATUS _netr_NetrEnumerateTrustedDomains(struct pipes_struct *p,
struct netr_NetrEnumerateTrustedDomains *r)
{
NTSTATUS status;
DEBUG(6,("_netr_NetrEnumerateTrustedDomains: %d\n", __LINE__));
status = rpc_pipe_open_internal(p->mem_ctx, &ndr_table_lsarpc.syntax_id,
- rpc_lsarpc_dispatch, p->server_info,
+ p->server_info,
+ p->client_id,
+ p->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- trusted_domains = talloc_zero_array(p->mem_ctx, const char *, num_domains);
- if (!trusted_domains) {
- status = NT_STATUS_NO_MEMORY;
- goto out;
- }
-
status = rpccli_lsa_open_policy2(cli, p->mem_ctx,
true,
LSA_POLICY_VIEW_LOCAL_INFORMATION,
goto out;
}
- status = STATUS_MORE_ENTRIES;
-
- while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
-
+ do {
/* Lookup list of trusted domains */
status = rpccli_lsa_EnumTrustDom(cli, p->mem_ctx,
goto out;
}
}
- }
+ } while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
- /* multi sz terminate */
- trusted_domains = talloc_realloc(p->mem_ctx, trusted_domains, const char *, num_domains + 1);
- if (trusted_domains == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto out;
- }
+ if (num_domains > 0) {
+ /* multi sz terminate */
+ trusted_domains = talloc_realloc(p->mem_ctx, trusted_domains, const char *, num_domains + 1);
+ if (trusted_domains == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto out;
+ }
- trusted_domains[num_domains+1] = NULL;
+ trusted_domains[num_domains] = NULL;
+ }
if (!push_reg_multi_sz(trusted_domains, &blob, trusted_domains)) {
TALLOC_FREE(trusted_domains);
******************************************************************/
static NTSTATUS get_md4pw(struct samr_Password *md4pw, const char *mach_acct,
- enum netr_SchannelType sec_chan_type, struct dom_sid *sid)
+ enum netr_SchannelType sec_chan_type,
+ struct dom_sid *sid,
+ struct messaging_context *msg_ctx)
{
NTSTATUS status;
TALLOC_CTX *mem_ctx;
union samr_UserInfo *info;
struct auth_serversupplied_info *server_info;
#if 0
- char addr[INET6_ADDRSTRLEN];
/*
* Currently this code is redundent as we already have a filter
*/
if (!allow_access(lp_domain_hostsdeny(), lp_domain_hostsallow(),
- client_name(get_client_fd()),
- client_addr(get_client_fd(),addr,sizeof(addr)))) {
+ p->client_id.name,
+ p->client_id.addr)) {
DEBUG(0,("get_md4pw: Workstation %s denied access to domain\n", mach_acct));
return False;
}
ZERO_STRUCT(user_handle);
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id,
- rpc_samr_dispatch, server_info,
+ server_info, NULL, msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
goto out;
_netr_ServerReqChallenge
*************************************************************************/
-NTSTATUS _netr_ServerReqChallenge(pipes_struct *p,
+NTSTATUS _netr_ServerReqChallenge(struct pipes_struct *p,
struct netr_ServerReqChallenge *r)
{
struct netlogon_server_pipe_state *pipe_state =
Create the initial credentials.
*************************************************************************/
-NTSTATUS _netr_ServerAuthenticate(pipes_struct *p,
+NTSTATUS _netr_ServerAuthenticate(struct pipes_struct *p,
struct netr_ServerAuthenticate *r)
{
struct netr_ServerAuthenticate3 a;
_netr_ServerAuthenticate3
*************************************************************************/
-NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
+NTSTATUS _netr_ServerAuthenticate3(struct pipes_struct *p,
struct netr_ServerAuthenticate3 *r)
{
NTSTATUS status;
srv_flgs |= NETLOGON_NEG_SCHANNEL;
}
- switch (p->hdr_req.opnum) {
+ switch (p->opnum) {
case NDR_NETR_SERVERAUTHENTICATE:
fn = "_netr_ServerAuthenticate";
break;
status = get_md4pw(&mach_pwd,
r->in.account_name,
r->in.secure_channel_type,
- &sid);
+ &sid, p->msg_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("%s: failed to get machine password for "
"account %s: %s\n",
goto out;
}
- creds->sid = sid_dup_talloc(creds, &sid);
+ creds->sid = dom_sid_dup(creds, &sid);
if (!creds->sid) {
status = NT_STATUS_NO_MEMORY;
goto out;
_netr_ServerAuthenticate2
*************************************************************************/
-NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p,
+NTSTATUS _netr_ServerAuthenticate2(struct pipes_struct *p,
struct netr_ServerAuthenticate2 *r)
{
struct netr_ServerAuthenticate3 a;
const char *computer_name,
bool integrity, bool privacy)
{
- if (auth_info && auth_info->auth_type == PIPE_AUTH_TYPE_SCHANNEL) {
+ if (auth_info && auth_info->auth_type == DCERPC_AUTH_TYPE_SCHANNEL) {
if (!privacy && !integrity) {
return NT_STATUS_OK;
}
/*************************************************************************
*************************************************************************/
-static NTSTATUS netr_creds_server_step_check(pipes_struct *p,
+static NTSTATUS netr_creds_server_step_check(struct pipes_struct *p,
TALLOC_CTX *mem_ctx,
const char *computer_name,
struct netr_Authenticator *received_authenticator,
static NTSTATUS netr_set_machine_account_password(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx,
const char *account_name,
struct samr_Password *nt_hash)
{
ZERO_STRUCT(user_handle);
status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id,
- rpc_samr_dispatch, server_info,
+ server_info, NULL, msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
goto out;
_netr_ServerPasswordSet
*************************************************************************/
-NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
+NTSTATUS _netr_ServerPasswordSet(struct pipes_struct *p,
struct netr_ServerPasswordSet *r)
{
NTSTATUS status = NT_STATUS_OK;
status = netr_set_machine_account_password(p->mem_ctx,
p->server_info,
+ p->msg_ctx,
creds->account_name,
r->in.new_password);
return status;
_netr_ServerPasswordSet2
****************************************************************/
-NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p,
+NTSTATUS _netr_ServerPasswordSet2(struct pipes_struct *p,
struct netr_ServerPasswordSet2 *r)
{
NTSTATUS status;
status = netr_set_machine_account_password(p->mem_ctx,
p->server_info,
+ p->msg_ctx,
creds->account_name,
&nt_hash);
return status;
_netr_LogonSamLogoff
*************************************************************************/
-NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
+NTSTATUS _netr_LogonSamLogoff(struct pipes_struct *p,
struct netr_LogonSamLogoff *r)
{
NTSTATUS status;
_netr_LogonSamLogon_base
*************************************************************************/
-static NTSTATUS _netr_LogonSamLogon_base(pipes_struct *p,
+static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p,
struct netr_LogonSamLogonEx *r,
struct netlogon_creds_CredentialState *creds)
{
bool process_creds = true;
const char *fn;
- switch (p->hdr_req.opnum) {
+ switch (p->opnum) {
case NDR_NETR_LOGONSAMLOGON:
process_creds = true;
fn = "_netr_LogonSamLogon";
user_info, &server_info);
}
- (auth_context->free)(&auth_context);
+ TALLOC_FREE(auth_context);
free_user_info(&user_info);
DEBUG(5,("%s: check_password returned status %s\n",
memcpy(pipe_session_key, creds->session_key, 16);
} else {
/* Get the pipe session key from the schannel. */
- if ((p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL)
+ if ((p->auth.auth_type != DCERPC_AUTH_TYPE_SCHANNEL)
|| (p->auth.a_u.schannel_auth == NULL)) {
return NT_STATUS_INVALID_HANDLE;
}
_netr_LogonSamLogonWithFlags
****************************************************************/
-NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p,
+NTSTATUS _netr_LogonSamLogonWithFlags(struct pipes_struct *p,
struct netr_LogonSamLogonWithFlags *r)
{
NTSTATUS status;
_netr_LogonSamLogon
*************************************************************************/
-NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
+NTSTATUS _netr_LogonSamLogon(struct pipes_struct *p,
struct netr_LogonSamLogon *r)
{
NTSTATUS status;
- no credential chaining. Map into net sam logon.
*************************************************************************/
-NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p,
+NTSTATUS _netr_LogonSamLogonEx(struct pipes_struct *p,
struct netr_LogonSamLogonEx *r)
{
NTSTATUS status;
}
/* Only allow this if the pipe is protected. */
- if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
+ if (p->auth.auth_type != DCERPC_AUTH_TYPE_SCHANNEL) {
DEBUG(0,("_netr_LogonSamLogonEx: client %s not using schannel for netlogon\n",
get_remote_machine_name() ));
return NT_STATUS_INVALID_PARAMETER;
_ds_enum_dom_trusts
*************************************************************************/
#if 0 /* JERRY -- not correct */
- NTSTATUS _ds_enum_dom_trusts(pipes_struct *p, DS_Q_ENUM_DOM_TRUSTS *q_u,
+ NTSTATUS _ds_enum_dom_trusts(struct pipes_struct *p, DS_Q_ENUM_DOM_TRUSTS *q_u,
DS_R_ENUM_DOM_TRUSTS *r_u)
{
NTSTATUS status = NT_STATUS_OK;
/****************************************************************
****************************************************************/
-WERROR _netr_LogonUasLogon(pipes_struct *p,
+WERROR _netr_LogonUasLogon(struct pipes_struct *p,
struct netr_LogonUasLogon *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_LogonUasLogoff(pipes_struct *p,
+WERROR _netr_LogonUasLogoff(struct pipes_struct *p,
struct netr_LogonUasLogoff *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_DatabaseDeltas(pipes_struct *p,
+NTSTATUS _netr_DatabaseDeltas(struct pipes_struct *p,
struct netr_DatabaseDeltas *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_DatabaseSync(pipes_struct *p,
+NTSTATUS _netr_DatabaseSync(struct pipes_struct *p,
struct netr_DatabaseSync *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_AccountDeltas(pipes_struct *p,
+NTSTATUS _netr_AccountDeltas(struct pipes_struct *p,
struct netr_AccountDeltas *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_AccountSync(pipes_struct *p,
+NTSTATUS _netr_AccountSync(struct pipes_struct *p,
struct netr_AccountSync *r)
{
p->rng_fault_state = true;
_netr_GetDcName
****************************************************************/
-WERROR _netr_GetDcName(pipes_struct *p,
+WERROR _netr_GetDcName(struct pipes_struct *p,
struct netr_GetDcName *r)
{
NTSTATUS status;
flags = DS_PDC_REQUIRED | DS_IS_FLAT_NAME | DS_RETURN_FLAT_NAME;
status = dsgetdcname(p->mem_ctx,
- smbd_messaging_context(),
+ p->msg_ctx,
r->in.domainname,
NULL,
NULL,
_netr_GetAnyDCName
****************************************************************/
-WERROR _netr_GetAnyDCName(pipes_struct *p,
+WERROR _netr_GetAnyDCName(struct pipes_struct *p,
struct netr_GetAnyDCName *r)
{
NTSTATUS status;
flags = DS_IS_FLAT_NAME | DS_RETURN_FLAT_NAME;
status = dsgetdcname(p->mem_ctx,
- smbd_messaging_context(),
+ p->msg_ctx,
r->in.domainname,
NULL,
NULL,
/****************************************************************
****************************************************************/
-NTSTATUS _netr_DatabaseSync2(pipes_struct *p,
+NTSTATUS _netr_DatabaseSync2(struct pipes_struct *p,
struct netr_DatabaseSync2 *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_DatabaseRedo(pipes_struct *p,
+NTSTATUS _netr_DatabaseRedo(struct pipes_struct *p,
struct netr_DatabaseRedo *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsRGetDCName(pipes_struct *p,
+WERROR _netr_DsRGetDCName(struct pipes_struct *p,
struct netr_DsRGetDCName *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_LogonGetCapabilities(pipes_struct *p,
+NTSTATUS _netr_LogonGetCapabilities(struct pipes_struct *p,
struct netr_LogonGetCapabilities *r)
{
return NT_STATUS_NOT_IMPLEMENTED;
/****************************************************************
****************************************************************/
-WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p,
+WERROR _netr_NETRLOGONSETSERVICEBITS(struct pipes_struct *p,
struct netr_NETRLOGONSETSERVICEBITS *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_LogonGetTrustRid(pipes_struct *p,
+WERROR _netr_LogonGetTrustRid(struct pipes_struct *p,
struct netr_LogonGetTrustRid *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p,
+WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(struct pipes_struct *p,
struct netr_NETRLOGONCOMPUTESERVERDIGEST *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p,
+WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(struct pipes_struct *p,
struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsRGetDCNameEx(pipes_struct *p,
+WERROR _netr_DsRGetDCNameEx(struct pipes_struct *p,
struct netr_DsRGetDCNameEx *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsRGetSiteName(pipes_struct *p,
+WERROR _netr_DsRGetSiteName(struct pipes_struct *p,
struct netr_DsRGetSiteName *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p,
+NTSTATUS _netr_LogonGetDomainInfo(struct pipes_struct *p,
struct netr_LogonGetDomainInfo *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_ServerPasswordGet(pipes_struct *p,
+WERROR _netr_ServerPasswordGet(struct pipes_struct *p,
struct netr_ServerPasswordGet *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p,
+WERROR _netr_NETRLOGONSENDTOSAM(struct pipes_struct *p,
struct netr_NETRLOGONSENDTOSAM *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p,
+WERROR _netr_DsRAddressToSitenamesW(struct pipes_struct *p,
struct netr_DsRAddressToSitenamesW *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsRGetDCNameEx2(pipes_struct *p,
+WERROR _netr_DsRGetDCNameEx2(struct pipes_struct *p,
struct netr_DsRGetDCNameEx2 *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p,
+WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct pipes_struct *p,
struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p,
+WERROR _netr_NetrEnumerateTrustedDomainsEx(struct pipes_struct *p,
struct netr_NetrEnumerateTrustedDomainsEx *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p,
+WERROR _netr_DsRAddressToSitenamesExW(struct pipes_struct *p,
struct netr_DsRAddressToSitenamesExW *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p,
+WERROR _netr_DsrGetDcSiteCoverageW(struct pipes_struct *p,
struct netr_DsrGetDcSiteCoverageW *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p,
+WERROR _netr_DsrEnumerateDomainTrusts(struct pipes_struct *p,
struct netr_DsrEnumerateDomainTrusts *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p,
+WERROR _netr_DsrDeregisterDNSHostRecords(struct pipes_struct *p,
struct netr_DsrDeregisterDNSHostRecords *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p,
+NTSTATUS _netr_ServerTrustPasswordsGet(struct pipes_struct *p,
struct netr_ServerTrustPasswordsGet *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p,
+WERROR _netr_DsRGetForestTrustInformation(struct pipes_struct *p,
struct netr_DsRGetForestTrustInformation *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_GetForestTrustInformation(pipes_struct *p,
+NTSTATUS _netr_GetForestTrustInformation(struct pipes_struct *p,
struct netr_GetForestTrustInformation *r)
{
p->rng_fault_state = true;
/****************************************************************
****************************************************************/
-NTSTATUS _netr_ServerGetTrustInfo(pipes_struct *p,
+NTSTATUS _netr_ServerGetTrustInfo(struct pipes_struct *p,
struct netr_ServerGetTrustInfo *r)
{
p->rng_fault_state = true;
return NT_STATUS_NOT_IMPLEMENTED;
}
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_Unused47(struct pipes_struct *p,
+ struct netr_Unused47 *r)
+{
+ p->rng_fault_state = true;
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_DsrUpdateReadOnlyServerDnsRecords(struct pipes_struct *p,
+ struct netr_DsrUpdateReadOnlyServerDnsRecords *r)
+{
+ p->rng_fault_state = true;
+ return NT_STATUS_NOT_IMPLEMENTED;
+}