s3-util: use shared dom_sid_dup.
[samba.git] / source3 / rpc_server / srv_netlog_nt.c
index 4bd176c1eae174d3f1cb99eb36c661955577b964..76da1d00d667183e603f1b31a9ee00980acae652 100644 (file)
@@ -34,6 +34,9 @@
 #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;
 
@@ -49,7 +52,7 @@ struct netlogon_server_pipe_state {
  _netr_LogonControl
  *************************************************************************/
 
-WERROR _netr_LogonControl(pipes_struct *p,
+WERROR _netr_LogonControl(struct pipes_struct *p,
                          struct netr_LogonControl *r)
 {
        struct netr_LogonControl2Ex l;
@@ -76,18 +79,17 @@ WERROR _netr_LogonControl(pipes_struct *p,
 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;
@@ -167,7 +169,7 @@ static bool wb_check_trust_creds(const char *domain, WERROR *tc_status)
  _netr_LogonControl2Ex
 ****************************************************************/
 
-WERROR _netr_LogonControl2Ex(pipes_struct *p,
+WERROR _netr_LogonControl2Ex(struct pipes_struct *p,
                             struct netr_LogonControl2Ex *r)
 {
        uint32_t flags = 0x0;
@@ -185,7 +187,7 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
        const char *fn;
        uint32_t acct_ctrl;
 
-       switch (p->hdr_req.opnum) {
+       switch (p->opnum) {
        case NDR_NETR_LOGONCONTROL:
                fn = "_netr_LogonControl";
                break;
@@ -379,7 +381,7 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
        }
 
         if (lp_server_role() == ROLE_DOMAIN_BDC) {
-                send_sync_message();
+                send_sync_message(p->msg_ctx);
        }
 
        return WERR_OK;
@@ -389,7 +391,7 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
  _netr_NetrEnumerateTrustedDomains
  *************************************************************************/
 
-NTSTATUS _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
+NTSTATUS _netr_NetrEnumerateTrustedDomains(struct pipes_struct *p,
                                           struct netr_NetrEnumerateTrustedDomains *r)
 {
        NTSTATUS status;
@@ -406,18 +408,14 @@ NTSTATUS _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
        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,
@@ -426,10 +424,7 @@ NTSTATUS _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
                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,
@@ -450,16 +445,18 @@ NTSTATUS _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
                                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);
@@ -591,7 +588,9 @@ static NTSTATUS samr_find_machine_account(TALLOC_CTX *mem_ctx,
  ******************************************************************/
 
 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;
@@ -603,7 +602,6 @@ static NTSTATUS get_md4pw(struct samr_Password *md4pw, const char *mach_acct,
        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
@@ -615,8 +613,8 @@ static NTSTATUS get_md4pw(struct samr_Password *md4pw, const char *mach_acct,
      */
 
        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;
        }
@@ -636,7 +634,7 @@ static NTSTATUS get_md4pw(struct samr_Password *md4pw, const char *mach_acct,
        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;
@@ -740,7 +738,7 @@ static NTSTATUS get_md4pw(struct samr_Password *md4pw, const char *mach_acct,
  _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 =
@@ -772,7 +770,7 @@ NTSTATUS _netr_ServerReqChallenge(pipes_struct *p,
  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;
@@ -798,7 +796,7 @@ NTSTATUS _netr_ServerAuthenticate(pipes_struct *p,
  _netr_ServerAuthenticate3
  *************************************************************************/
 
-NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
+NTSTATUS _netr_ServerAuthenticate3(struct pipes_struct *p,
                                   struct netr_ServerAuthenticate3 *r)
 {
        NTSTATUS status;
@@ -843,7 +841,7 @@ NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
                srv_flgs |= NETLOGON_NEG_SCHANNEL;
        }
 
-       switch (p->hdr_req.opnum) {
+       switch (p->opnum) {
                case NDR_NETR_SERVERAUTHENTICATE:
                        fn = "_netr_ServerAuthenticate";
                        break;
@@ -881,7 +879,7 @@ NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
        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",
@@ -912,7 +910,7 @@ NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
                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;
@@ -941,7 +939,7 @@ NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
  _netr_ServerAuthenticate2
  *************************************************************************/
 
-NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p,
+NTSTATUS _netr_ServerAuthenticate2(struct pipes_struct *p,
                                   struct netr_ServerAuthenticate2 *r)
 {
        struct netr_ServerAuthenticate3 a;
@@ -968,7 +966,7 @@ static NTSTATUS schannel_check_required(struct pipe_auth_data *auth_info,
                                        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;
                }
@@ -994,7 +992,7 @@ static NTSTATUS schannel_check_required(struct pipe_auth_data *auth_info,
 /*************************************************************************
  *************************************************************************/
 
-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,
@@ -1025,6 +1023,7 @@ static NTSTATUS netr_creds_server_step_check(pipes_struct *p,
 
 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)
 {
@@ -1039,7 +1038,7 @@ static NTSTATUS netr_set_machine_account_password(TALLOC_CTX *mem_ctx,
        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;
@@ -1106,7 +1105,7 @@ static NTSTATUS netr_set_machine_account_password(TALLOC_CTX *mem_ctx,
  _netr_ServerPasswordSet
  *************************************************************************/
 
-NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
+NTSTATUS _netr_ServerPasswordSet(struct pipes_struct *p,
                                 struct netr_ServerPasswordSet *r)
 {
        NTSTATUS status = NT_STATUS_OK;
@@ -1143,6 +1142,7 @@ NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
 
        status = netr_set_machine_account_password(p->mem_ctx,
                                                   p->server_info,
+                                                  p->msg_ctx,
                                                   creds->account_name,
                                                   r->in.new_password);
        return status;
@@ -1152,7 +1152,7 @@ NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
  _netr_ServerPasswordSet2
 ****************************************************************/
 
-NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p,
+NTSTATUS _netr_ServerPasswordSet2(struct pipes_struct *p,
                                  struct netr_ServerPasswordSet2 *r)
 {
        NTSTATUS status;
@@ -1189,6 +1189,7 @@ NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p,
 
        status = netr_set_machine_account_password(p->mem_ctx,
                                                   p->server_info,
+                                                  p->msg_ctx,
                                                   creds->account_name,
                                                   &nt_hash);
        return status;
@@ -1198,7 +1199,7 @@ NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p,
  _netr_LogonSamLogoff
  *************************************************************************/
 
-NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
+NTSTATUS _netr_LogonSamLogoff(struct pipes_struct *p,
                              struct netr_LogonSamLogoff *r)
 {
        NTSTATUS status;
@@ -1219,7 +1220,7 @@ NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
  _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)
 {
@@ -1233,7 +1234,7 @@ static NTSTATUS _netr_LogonSamLogon_base(pipes_struct *p,
        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";
@@ -1387,7 +1388,7 @@ static NTSTATUS _netr_LogonSamLogon_base(pipes_struct *p,
                        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",
@@ -1426,7 +1427,7 @@ static NTSTATUS _netr_LogonSamLogon_base(pipes_struct *p,
                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;
                }
@@ -1457,7 +1458,7 @@ static NTSTATUS _netr_LogonSamLogon_base(pipes_struct *p,
  _netr_LogonSamLogonWithFlags
 ****************************************************************/
 
-NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p,
+NTSTATUS _netr_LogonSamLogonWithFlags(struct pipes_struct *p,
                                      struct netr_LogonSamLogonWithFlags *r)
 {
        NTSTATUS status;
@@ -1497,7 +1498,7 @@ NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p,
  _netr_LogonSamLogon
  *************************************************************************/
 
-NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
+NTSTATUS _netr_LogonSamLogon(struct pipes_struct *p,
                             struct netr_LogonSamLogon *r)
 {
        NTSTATUS status;
@@ -1527,7 +1528,7 @@ NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
  - 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;
@@ -1542,7 +1543,7 @@ NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p,
        }
 
        /* 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;
@@ -1558,7 +1559,7 @@ NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p,
  _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;
@@ -1577,7 +1578,7 @@ NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_LogonUasLogon(pipes_struct *p,
+WERROR _netr_LogonUasLogon(struct pipes_struct *p,
                           struct netr_LogonUasLogon *r)
 {
        p->rng_fault_state = true;
@@ -1587,7 +1588,7 @@ WERROR _netr_LogonUasLogon(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_LogonUasLogoff(pipes_struct *p,
+WERROR _netr_LogonUasLogoff(struct pipes_struct *p,
                            struct netr_LogonUasLogoff *r)
 {
        p->rng_fault_state = true;
@@ -1597,7 +1598,7 @@ WERROR _netr_LogonUasLogoff(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_DatabaseDeltas(pipes_struct *p,
+NTSTATUS _netr_DatabaseDeltas(struct pipes_struct *p,
                              struct netr_DatabaseDeltas *r)
 {
        p->rng_fault_state = true;
@@ -1607,7 +1608,7 @@ NTSTATUS _netr_DatabaseDeltas(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_DatabaseSync(pipes_struct *p,
+NTSTATUS _netr_DatabaseSync(struct pipes_struct *p,
                            struct netr_DatabaseSync *r)
 {
        p->rng_fault_state = true;
@@ -1617,7 +1618,7 @@ NTSTATUS _netr_DatabaseSync(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_AccountDeltas(pipes_struct *p,
+NTSTATUS _netr_AccountDeltas(struct pipes_struct *p,
                             struct netr_AccountDeltas *r)
 {
        p->rng_fault_state = true;
@@ -1627,7 +1628,7 @@ NTSTATUS _netr_AccountDeltas(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_AccountSync(pipes_struct *p,
+NTSTATUS _netr_AccountSync(struct pipes_struct *p,
                           struct netr_AccountSync *r)
 {
        p->rng_fault_state = true;
@@ -1678,7 +1679,7 @@ static bool wb_getdcname(TALLOC_CTX *mem_ctx,
  _netr_GetDcName
 ****************************************************************/
 
-WERROR _netr_GetDcName(pipes_struct *p,
+WERROR _netr_GetDcName(struct pipes_struct *p,
                       struct netr_GetDcName *r)
 {
        NTSTATUS status;
@@ -1701,7 +1702,7 @@ WERROR _netr_GetDcName(pipes_struct *p,
        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,
@@ -1724,7 +1725,7 @@ WERROR _netr_GetDcName(pipes_struct *p,
  _netr_GetAnyDCName
 ****************************************************************/
 
-WERROR _netr_GetAnyDCName(pipes_struct *p,
+WERROR _netr_GetAnyDCName(struct pipes_struct *p,
                          struct netr_GetAnyDCName *r)
 {
        NTSTATUS status;
@@ -1746,7 +1747,7 @@ WERROR _netr_GetAnyDCName(pipes_struct *p,
        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,
@@ -1768,7 +1769,7 @@ WERROR _netr_GetAnyDCName(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_DatabaseSync2(pipes_struct *p,
+NTSTATUS _netr_DatabaseSync2(struct pipes_struct *p,
                             struct netr_DatabaseSync2 *r)
 {
        p->rng_fault_state = true;
@@ -1778,7 +1779,7 @@ NTSTATUS _netr_DatabaseSync2(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_DatabaseRedo(pipes_struct *p,
+NTSTATUS _netr_DatabaseRedo(struct pipes_struct *p,
                            struct netr_DatabaseRedo *r)
 {
        p->rng_fault_state = true;
@@ -1788,7 +1789,7 @@ NTSTATUS _netr_DatabaseRedo(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsRGetDCName(pipes_struct *p,
+WERROR _netr_DsRGetDCName(struct pipes_struct *p,
                          struct netr_DsRGetDCName *r)
 {
        p->rng_fault_state = true;
@@ -1798,7 +1799,7 @@ WERROR _netr_DsRGetDCName(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_LogonGetCapabilities(pipes_struct *p,
+NTSTATUS _netr_LogonGetCapabilities(struct pipes_struct *p,
                                    struct netr_LogonGetCapabilities *r)
 {
        return NT_STATUS_NOT_IMPLEMENTED;
@@ -1807,7 +1808,7 @@ NTSTATUS _netr_LogonGetCapabilities(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p,
+WERROR _netr_NETRLOGONSETSERVICEBITS(struct pipes_struct *p,
                                     struct netr_NETRLOGONSETSERVICEBITS *r)
 {
        p->rng_fault_state = true;
@@ -1817,7 +1818,7 @@ WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_LogonGetTrustRid(pipes_struct *p,
+WERROR _netr_LogonGetTrustRid(struct pipes_struct *p,
                              struct netr_LogonGetTrustRid *r)
 {
        p->rng_fault_state = true;
@@ -1827,7 +1828,7 @@ WERROR _netr_LogonGetTrustRid(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p,
+WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(struct pipes_struct *p,
                                          struct netr_NETRLOGONCOMPUTESERVERDIGEST *r)
 {
        p->rng_fault_state = true;
@@ -1837,7 +1838,7 @@ WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p,
+WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(struct pipes_struct *p,
                                          struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r)
 {
        p->rng_fault_state = true;
@@ -1847,7 +1848,7 @@ WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsRGetDCNameEx(pipes_struct *p,
+WERROR _netr_DsRGetDCNameEx(struct pipes_struct *p,
                            struct netr_DsRGetDCNameEx *r)
 {
        p->rng_fault_state = true;
@@ -1857,7 +1858,7 @@ WERROR _netr_DsRGetDCNameEx(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsRGetSiteName(pipes_struct *p,
+WERROR _netr_DsRGetSiteName(struct pipes_struct *p,
                            struct netr_DsRGetSiteName *r)
 {
        p->rng_fault_state = true;
@@ -1867,7 +1868,7 @@ WERROR _netr_DsRGetSiteName(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p,
+NTSTATUS _netr_LogonGetDomainInfo(struct pipes_struct *p,
                                  struct netr_LogonGetDomainInfo *r)
 {
        p->rng_fault_state = true;
@@ -1877,7 +1878,7 @@ NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_ServerPasswordGet(pipes_struct *p,
+WERROR _netr_ServerPasswordGet(struct pipes_struct *p,
                               struct netr_ServerPasswordGet *r)
 {
        p->rng_fault_state = true;
@@ -1887,7 +1888,7 @@ WERROR _netr_ServerPasswordGet(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p,
+WERROR _netr_NETRLOGONSENDTOSAM(struct pipes_struct *p,
                                struct netr_NETRLOGONSENDTOSAM *r)
 {
        p->rng_fault_state = true;
@@ -1897,7 +1898,7 @@ WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p,
+WERROR _netr_DsRAddressToSitenamesW(struct pipes_struct *p,
                                    struct netr_DsRAddressToSitenamesW *r)
 {
        p->rng_fault_state = true;
@@ -1907,7 +1908,7 @@ WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsRGetDCNameEx2(pipes_struct *p,
+WERROR _netr_DsRGetDCNameEx2(struct pipes_struct *p,
                             struct netr_DsRGetDCNameEx2 *r)
 {
        p->rng_fault_state = true;
@@ -1917,7 +1918,7 @@ WERROR _netr_DsRGetDCNameEx2(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p,
+WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct pipes_struct *p,
                                                 struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r)
 {
        p->rng_fault_state = true;
@@ -1927,7 +1928,7 @@ WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p,
+WERROR _netr_NetrEnumerateTrustedDomainsEx(struct pipes_struct *p,
                                           struct netr_NetrEnumerateTrustedDomainsEx *r)
 {
        p->rng_fault_state = true;
@@ -1937,7 +1938,7 @@ WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p,
+WERROR _netr_DsRAddressToSitenamesExW(struct pipes_struct *p,
                                      struct netr_DsRAddressToSitenamesExW *r)
 {
        p->rng_fault_state = true;
@@ -1947,7 +1948,7 @@ WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p,
+WERROR _netr_DsrGetDcSiteCoverageW(struct pipes_struct *p,
                                   struct netr_DsrGetDcSiteCoverageW *r)
 {
        p->rng_fault_state = true;
@@ -1957,7 +1958,7 @@ WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p,
+WERROR _netr_DsrEnumerateDomainTrusts(struct pipes_struct *p,
                                      struct netr_DsrEnumerateDomainTrusts *r)
 {
        p->rng_fault_state = true;
@@ -1967,7 +1968,7 @@ WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p,
+WERROR _netr_DsrDeregisterDNSHostRecords(struct pipes_struct *p,
                                         struct netr_DsrDeregisterDNSHostRecords *r)
 {
        p->rng_fault_state = true;
@@ -1977,7 +1978,7 @@ WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p,
+NTSTATUS _netr_ServerTrustPasswordsGet(struct pipes_struct *p,
                                       struct netr_ServerTrustPasswordsGet *r)
 {
        p->rng_fault_state = true;
@@ -1987,7 +1988,7 @@ NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p,
+WERROR _netr_DsRGetForestTrustInformation(struct pipes_struct *p,
                                          struct netr_DsRGetForestTrustInformation *r)
 {
        p->rng_fault_state = true;
@@ -1997,7 +1998,7 @@ WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _netr_GetForestTrustInformation(pipes_struct *p,
+NTSTATUS _netr_GetForestTrustInformation(struct pipes_struct *p,
                                         struct netr_GetForestTrustInformation *r)
 {
        p->rng_fault_state = true;
@@ -2007,10 +2008,29 @@ NTSTATUS _netr_GetForestTrustInformation(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-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;
+}