Rename the 'hidden' variable to 'administrative share'.
[Samba/nascimento.git] / source3 / rpc_server / srv_netlog_nt.c
blob5b26f558459b1ddca94fafc0e0c77e722d97e7d9
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997.
7 * Copyright (C) Jeremy Allison 1998-2001.
8 * Copyright (C) Andrew Bartlett 2001.
9 * Copyright (C) Guenther Deschner 2008.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 /* This is the implementation of the netlogon pipe. */
27 #include "includes.h"
29 extern userdom_struct current_user_info;
31 #undef DBGC_CLASS
32 #define DBGC_CLASS DBGC_RPC_SRV
34 /*************************************************************************
35 init_net_r_req_chal:
36 *************************************************************************/
38 static void init_net_r_req_chal(struct netr_Credential *r,
39 struct netr_Credential *srv_chal)
41 DEBUG(6,("init_net_r_req_chal: %d\n", __LINE__));
43 memcpy(r->data, srv_chal->data, sizeof(r->data));
46 /*******************************************************************
47 Inits a netr_NETLOGON_INFO_1 structure.
48 ********************************************************************/
50 static void init_netlogon_info1(struct netr_NETLOGON_INFO_1 *r,
51 uint32_t flags,
52 uint32_t pdc_connection_status)
54 r->flags = flags;
55 r->pdc_connection_status = pdc_connection_status;
58 /*******************************************************************
59 Inits a netr_NETLOGON_INFO_2 structure.
60 ********************************************************************/
62 static void init_netlogon_info2(struct netr_NETLOGON_INFO_2 *r,
63 uint32_t flags,
64 uint32_t pdc_connection_status,
65 const char *trusted_dc_name,
66 uint32_t tc_connection_status)
68 r->flags = flags;
69 r->pdc_connection_status = pdc_connection_status;
70 r->trusted_dc_name = trusted_dc_name;
71 r->tc_connection_status = tc_connection_status;
74 /*******************************************************************
75 Inits a netr_NETLOGON_INFO_3 structure.
76 ********************************************************************/
78 static void init_netlogon_info3(struct netr_NETLOGON_INFO_3 *r,
79 uint32_t flags,
80 uint32_t logon_attempts)
82 r->flags = flags;
83 r->logon_attempts = logon_attempts;
86 /*************************************************************************
87 _netr_LogonControl
88 *************************************************************************/
90 WERROR _netr_LogonControl(pipes_struct *p,
91 struct netr_LogonControl *r)
93 struct netr_NETLOGON_INFO_1 *info1;
94 uint32_t flags = 0x0;
95 uint32_t pdc_connection_status = W_ERROR_V(WERR_OK);
97 /* Setup the Logon Control response */
99 switch (r->in.level) {
100 case 1:
101 info1 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_1);
102 if (!info1) {
103 return WERR_NOMEM;
105 init_netlogon_info1(info1,
106 flags,
107 pdc_connection_status);
108 r->out.info->info1 = info1;
109 break;
110 default:
111 return WERR_UNKNOWN_LEVEL;
114 return WERR_OK;
117 /****************************************************************************
118 Send a message to smbd to do a sam synchronisation
119 **************************************************************************/
121 static void send_sync_message(void)
123 DEBUG(3, ("sending sam synchronisation message\n"));
124 message_send_all(smbd_messaging_context(), MSG_SMB_SAM_SYNC, NULL, 0,
125 NULL);
128 /*************************************************************************
129 _netr_LogonControl2
130 *************************************************************************/
132 WERROR _netr_LogonControl2(pipes_struct *p,
133 struct netr_LogonControl2 *r)
135 uint32 flags = 0x0;
136 uint32 pdc_connection_status = 0x0;
137 uint32 logon_attempts = 0x0;
138 uint32 tc_status;
139 fstring dc_name, dc_name2;
140 struct sockaddr_storage dc_ss;
141 const char *domain = NULL;
142 struct netr_NETLOGON_INFO_1 *info1;
143 struct netr_NETLOGON_INFO_2 *info2;
144 struct netr_NETLOGON_INFO_3 *info3;
146 tc_status = W_ERROR_V(WERR_NO_SUCH_DOMAIN);
147 fstrcpy( dc_name, "" );
149 switch (r->in.function_code) {
150 case NETLOGON_CONTROL_TC_QUERY:
151 domain = r->in.data->domain;
153 if ( !is_trusted_domain( domain ) )
154 break;
156 if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
157 tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
158 break;
161 fstr_sprintf( dc_name, "\\\\%s", dc_name2 );
163 tc_status = W_ERROR_V(WERR_OK);
165 break;
167 case NETLOGON_CONTROL_REDISCOVER:
168 domain = r->in.data->domain;
170 if ( !is_trusted_domain( domain ) )
171 break;
173 if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
174 tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
175 break;
178 fstr_sprintf( dc_name, "\\\\%s", dc_name2 );
180 tc_status = W_ERROR_V(WERR_OK);
182 break;
184 default:
185 /* no idea what this should be */
186 DEBUG(0,("_netr_LogonControl2: unimplemented function level [%d]\n",
187 r->in.function_code));
188 return WERR_UNKNOWN_LEVEL;
191 /* prepare the response */
193 switch (r->in.level) {
194 case 1:
195 info1 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_1);
196 W_ERROR_HAVE_NO_MEMORY(info1);
198 init_netlogon_info1(info1,
199 flags,
200 pdc_connection_status);
201 r->out.query->info1 = info1;
202 break;
203 case 2:
204 info2 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_2);
205 W_ERROR_HAVE_NO_MEMORY(info2);
207 init_netlogon_info2(info2,
208 flags,
209 pdc_connection_status,
210 dc_name,
211 tc_status);
212 r->out.query->info2 = info2;
213 break;
214 case 3:
215 info3 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_3);
216 W_ERROR_HAVE_NO_MEMORY(info3);
218 init_netlogon_info3(info3,
219 flags,
220 logon_attempts);
221 r->out.query->info3 = info3;
222 break;
223 default:
224 return WERR_UNKNOWN_LEVEL;
227 if (lp_server_role() == ROLE_DOMAIN_BDC) {
228 send_sync_message();
231 return WERR_OK;
234 /*************************************************************************
235 _netr_NetrEnumerateTrustedDomains
236 *************************************************************************/
238 WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
239 struct netr_NetrEnumerateTrustedDomains *r)
241 struct netr_Blob trusted_domains_blob;
242 DATA_BLOB blob;
244 DEBUG(6,("_netr_NetrEnumerateTrustedDomains: %d\n", __LINE__));
246 /* set up the Trusted Domain List response */
248 blob = data_blob_talloc_zero(p->mem_ctx, 2);
249 trusted_domains_blob.data = blob.data;
250 trusted_domains_blob.length = blob.length;
252 DEBUG(6,("_netr_NetrEnumerateTrustedDomains: %d\n", __LINE__));
254 *r->out.trusted_domains_blob = trusted_domains_blob;
256 return WERR_OK;
259 /******************************************************************
260 gets a machine password entry. checks access rights of the host.
261 ******************************************************************/
263 static NTSTATUS get_md4pw(char *md4pw, const char *mach_acct, uint16 sec_chan_type)
265 struct samu *sampass = NULL;
266 const uint8 *pass;
267 bool ret;
268 uint32 acct_ctrl;
270 #if 0
271 char addr[INET6_ADDRSTRLEN];
274 * Currently this code is redundent as we already have a filter
275 * by hostname list. What this code really needs to do is to
276 * get a hosts allowed/hosts denied list from the SAM database
277 * on a per user basis, and make the access decision there.
278 * I will leave this code here for now as a reminder to implement
279 * this at a later date. JRA.
282 if (!allow_access(lp_domain_hostsdeny(), lp_domain_hostsallow(),
283 client_name(get_client_fd()),
284 client_addr(get_client_fd(),addr,sizeof(addr)))) {
285 DEBUG(0,("get_md4pw: Workstation %s denied access to domain\n", mach_acct));
286 return False;
288 #endif /* 0 */
290 if ( !(sampass = samu_new( NULL )) ) {
291 return NT_STATUS_NO_MEMORY;
294 /* JRA. This is ok as it is only used for generating the challenge. */
295 become_root();
296 ret = pdb_getsampwnam(sampass, mach_acct);
297 unbecome_root();
299 if (!ret) {
300 DEBUG(0,("get_md4pw: Workstation %s: no account in domain\n", mach_acct));
301 TALLOC_FREE(sampass);
302 return NT_STATUS_ACCESS_DENIED;
305 acct_ctrl = pdb_get_acct_ctrl(sampass);
306 if (acct_ctrl & ACB_DISABLED) {
307 DEBUG(0,("get_md4pw: Workstation %s: account is disabled\n", mach_acct));
308 TALLOC_FREE(sampass);
309 return NT_STATUS_ACCOUNT_DISABLED;
312 if (!(acct_ctrl & ACB_SVRTRUST) &&
313 !(acct_ctrl & ACB_WSTRUST) &&
314 !(acct_ctrl & ACB_DOMTRUST))
316 DEBUG(0,("get_md4pw: Workstation %s: account is not a trust account\n", mach_acct));
317 TALLOC_FREE(sampass);
318 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
321 switch (sec_chan_type) {
322 case SEC_CHAN_BDC:
323 if (!(acct_ctrl & ACB_SVRTRUST)) {
324 DEBUG(0,("get_md4pw: Workstation %s: BDC secure channel requested "
325 "but not a server trust account\n", mach_acct));
326 TALLOC_FREE(sampass);
327 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
329 break;
330 case SEC_CHAN_WKSTA:
331 if (!(acct_ctrl & ACB_WSTRUST)) {
332 DEBUG(0,("get_md4pw: Workstation %s: WORKSTATION secure channel requested "
333 "but not a workstation trust account\n", mach_acct));
334 TALLOC_FREE(sampass);
335 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
337 break;
338 case SEC_CHAN_DOMAIN:
339 if (!(acct_ctrl & ACB_DOMTRUST)) {
340 DEBUG(0,("get_md4pw: Workstation %s: DOMAIN secure channel requested "
341 "but not a interdomain trust account\n", mach_acct));
342 TALLOC_FREE(sampass);
343 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
345 break;
346 default:
347 break;
350 if ((pass = pdb_get_nt_passwd(sampass)) == NULL) {
351 DEBUG(0,("get_md4pw: Workstation %s: account does not have a password\n", mach_acct));
352 TALLOC_FREE(sampass);
353 return NT_STATUS_LOGON_FAILURE;
356 memcpy(md4pw, pass, 16);
357 dump_data(5, (uint8 *)md4pw, 16);
359 TALLOC_FREE(sampass);
361 return NT_STATUS_OK;
366 /*************************************************************************
367 _netr_ServerReqChallenge
368 *************************************************************************/
370 NTSTATUS _netr_ServerReqChallenge(pipes_struct *p,
371 struct netr_ServerReqChallenge *r)
373 if (!p->dc) {
374 p->dc = TALLOC_ZERO_P(p->pipe_state_mem_ctx, struct dcinfo);
375 if (!p->dc) {
376 return NT_STATUS_NO_MEMORY;
378 } else {
379 DEBUG(10,("_netr_ServerReqChallenge: new challenge requested. Clearing old state.\n"));
380 ZERO_STRUCTP(p->dc);
383 fstrcpy(p->dc->remote_machine, r->in.computer_name);
385 /* Save the client challenge to the server. */
386 memcpy(p->dc->clnt_chal.data, r->in.credentials->data,
387 sizeof(r->in.credentials->data));
389 /* Create a server challenge for the client */
390 /* Set this to a random value. */
391 generate_random_buffer(p->dc->srv_chal.data, 8);
393 /* set up the LSA REQUEST CHALLENGE response */
394 init_net_r_req_chal(r->out.return_credentials, &p->dc->srv_chal);
396 p->dc->challenge_sent = True;
398 return NT_STATUS_OK;
401 /*************************************************************************
402 _netr_ServerAuthenticate
403 Create the initial credentials.
404 *************************************************************************/
406 NTSTATUS _netr_ServerAuthenticate(pipes_struct *p,
407 struct netr_ServerAuthenticate *r)
409 NTSTATUS status;
410 struct netr_Credential srv_chal_out;
412 if (!p->dc || !p->dc->challenge_sent) {
413 return NT_STATUS_ACCESS_DENIED;
416 status = get_md4pw((char *)p->dc->mach_pw,
417 r->in.account_name,
418 r->in.secure_channel_type);
419 if (!NT_STATUS_IS_OK(status)) {
420 DEBUG(0,("_netr_ServerAuthenticate: get_md4pw failed. Failed to "
421 "get password for machine account %s "
422 "from client %s: %s\n",
423 r->in.account_name,
424 r->in.computer_name,
425 nt_errstr(status) ));
426 /* always return NT_STATUS_ACCESS_DENIED */
427 return NT_STATUS_ACCESS_DENIED;
430 /* From the client / server challenges and md4 password, generate sess key */
431 creds_server_init(0, /* No neg flags. */
432 p->dc,
433 &p->dc->clnt_chal, /* Stored client chal. */
434 &p->dc->srv_chal, /* Stored server chal. */
435 p->dc->mach_pw,
436 &srv_chal_out);
438 /* Check client credentials are valid. */
439 if (!netlogon_creds_server_check(p->dc, r->in.credentials)) {
440 DEBUG(0,("_netr_ServerAuthenticate: netlogon_creds_server_check failed. Rejecting auth "
441 "request from client %s machine account %s\n",
442 r->in.computer_name,
443 r->in.account_name));
444 return NT_STATUS_ACCESS_DENIED;
447 fstrcpy(p->dc->mach_acct, r->in.account_name);
448 fstrcpy(p->dc->remote_machine, r->in.computer_name);
449 p->dc->authenticated = True;
451 /* set up the LSA AUTH response */
452 /* Return the server credentials. */
454 memcpy(r->out.return_credentials->data, &srv_chal_out.data,
455 sizeof(r->out.return_credentials->data));
457 return NT_STATUS_OK;
460 /*************************************************************************
461 _netr_ServerAuthenticate2
462 *************************************************************************/
464 NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p,
465 struct netr_ServerAuthenticate2 *r)
467 NTSTATUS status;
468 uint32_t srv_flgs;
469 struct netr_Credential srv_chal_out;
471 /* We use this as the key to store the creds: */
472 /* r->in.computer_name */
474 if (!p->dc || !p->dc->challenge_sent) {
475 DEBUG(0,("_netr_ServerAuthenticate2: no challenge sent to client %s\n",
476 r->in.computer_name));
477 return NT_STATUS_ACCESS_DENIED;
480 if ( (lp_server_schannel() == true) &&
481 ((*r->in.negotiate_flags & NETLOGON_NEG_SCHANNEL) == 0) ) {
483 /* schannel must be used, but client did not offer it. */
484 DEBUG(0,("_netr_ServerAuthenticate2: schannel required but client failed "
485 "to offer it. Client was %s\n",
486 r->in.account_name));
487 return NT_STATUS_ACCESS_DENIED;
490 status = get_md4pw((char *)p->dc->mach_pw,
491 r->in.account_name,
492 r->in.secure_channel_type);
493 if (!NT_STATUS_IS_OK(status)) {
494 DEBUG(0,("_netr_ServerAuthenticate2: failed to get machine password for "
495 "account %s: %s\n",
496 r->in.account_name, nt_errstr(status) ));
497 /* always return NT_STATUS_ACCESS_DENIED */
498 return NT_STATUS_ACCESS_DENIED;
501 /* From the client / server challenges and md4 password, generate sess key */
502 creds_server_init(*r->in.negotiate_flags,
503 p->dc,
504 &p->dc->clnt_chal, /* Stored client chal. */
505 &p->dc->srv_chal, /* Stored server chal. */
506 p->dc->mach_pw,
507 &srv_chal_out);
509 /* Check client credentials are valid. */
510 if (!netlogon_creds_server_check(p->dc, r->in.credentials)) {
511 DEBUG(0,("_netr_ServerAuthenticate2: netlogon_creds_server_check failed. Rejecting auth "
512 "request from client %s machine account %s\n",
513 r->in.computer_name,
514 r->in.account_name));
515 return NT_STATUS_ACCESS_DENIED;
518 srv_flgs = 0x000001ff;
520 if (lp_server_schannel() != false) {
521 srv_flgs |= NETLOGON_NEG_SCHANNEL;
524 /* set up the LSA AUTH 2 response */
525 memcpy(r->out.return_credentials->data, &srv_chal_out.data,
526 sizeof(r->out.return_credentials->data));
527 *r->out.negotiate_flags = srv_flgs;
529 fstrcpy(p->dc->mach_acct, r->in.account_name);
530 fstrcpy(p->dc->remote_machine, r->in.computer_name);
531 fstrcpy(p->dc->domain, lp_workgroup() );
533 p->dc->authenticated = True;
535 /* Store off the state so we can continue after client disconnect. */
536 become_root();
537 secrets_store_schannel_session_info(p->mem_ctx,
538 r->in.computer_name,
539 p->dc);
540 unbecome_root();
542 return NT_STATUS_OK;
545 /*************************************************************************
546 _netr_ServerPasswordSet
547 *************************************************************************/
549 NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
550 struct netr_ServerPasswordSet *r)
552 NTSTATUS status = NT_STATUS_OK;
553 fstring remote_machine;
554 struct samu *sampass=NULL;
555 bool ret = False;
556 unsigned char pwd[16];
557 int i;
558 uint32 acct_ctrl;
559 struct netr_Authenticator cred_out;
560 const uchar *old_pw;
562 DEBUG(5,("_netr_ServerPasswordSet: %d\n", __LINE__));
564 /* We need the remote machine name for the creds lookup. */
565 fstrcpy(remote_machine, r->in.computer_name);
567 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
568 /* 'server schannel = yes' should enforce use of
569 schannel, the client did offer it in auth2, but
570 obviously did not use it. */
571 DEBUG(0,("_netr_ServerPasswordSet: client %s not using schannel for netlogon\n",
572 remote_machine ));
573 return NT_STATUS_ACCESS_DENIED;
576 if (!p->dc) {
577 /* Restore the saved state of the netlogon creds. */
578 become_root();
579 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
580 remote_machine,
581 &p->dc);
582 unbecome_root();
583 if (!ret) {
584 return NT_STATUS_INVALID_HANDLE;
588 if (!p->dc || !p->dc->authenticated) {
589 return NT_STATUS_INVALID_HANDLE;
592 DEBUG(3,("_netr_ServerPasswordSet: Server Password Set by remote machine:[%s] on account [%s]\n",
593 remote_machine, p->dc->mach_acct));
595 /* Step the creds chain forward. */
596 if (!netlogon_creds_server_step(p->dc, r->in.credential, &cred_out)) {
597 DEBUG(2,("_netr_ServerPasswordSet: netlogon_creds_server_step failed. Rejecting auth "
598 "request from client %s machine account %s\n",
599 remote_machine, p->dc->mach_acct ));
600 return NT_STATUS_INVALID_PARAMETER;
603 /* We must store the creds state after an update. */
604 sampass = samu_new( NULL );
605 if (!sampass) {
606 return NT_STATUS_NO_MEMORY;
609 become_root();
610 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
611 remote_machine,
612 p->dc);
613 ret = pdb_getsampwnam(sampass, p->dc->mach_acct);
614 unbecome_root();
616 if (!ret) {
617 TALLOC_FREE(sampass);
618 return NT_STATUS_ACCESS_DENIED;
621 /* Ensure the account exists and is a machine account. */
623 acct_ctrl = pdb_get_acct_ctrl(sampass);
625 if (!(acct_ctrl & ACB_WSTRUST ||
626 acct_ctrl & ACB_SVRTRUST ||
627 acct_ctrl & ACB_DOMTRUST)) {
628 TALLOC_FREE(sampass);
629 return NT_STATUS_NO_SUCH_USER;
632 if (pdb_get_acct_ctrl(sampass) & ACB_DISABLED) {
633 TALLOC_FREE(sampass);
634 return NT_STATUS_ACCOUNT_DISABLED;
637 /* Woah - what does this to to the credential chain ? JRA */
638 cred_hash3(pwd, r->in.new_password->hash, p->dc->sess_key, 0);
640 DEBUG(100,("_netr_ServerPasswordSet: new given value was :\n"));
641 for(i = 0; i < sizeof(pwd); i++)
642 DEBUG(100,("%02X ", pwd[i]));
643 DEBUG(100,("\n"));
645 old_pw = pdb_get_nt_passwd(sampass);
647 if (old_pw && memcmp(pwd, old_pw, 16) == 0) {
648 /* Avoid backend modificiations and other fun if the
649 client changed the password to the *same thing* */
651 ret = True;
652 } else {
654 /* LM password should be NULL for machines */
655 if (!pdb_set_lanman_passwd(sampass, NULL, PDB_CHANGED)) {
656 TALLOC_FREE(sampass);
657 return NT_STATUS_NO_MEMORY;
660 if (!pdb_set_nt_passwd(sampass, pwd, PDB_CHANGED)) {
661 TALLOC_FREE(sampass);
662 return NT_STATUS_NO_MEMORY;
665 if (!pdb_set_pass_last_set_time(sampass, time(NULL), PDB_CHANGED)) {
666 TALLOC_FREE(sampass);
667 /* Not quite sure what this one qualifies as, but this will do */
668 return NT_STATUS_UNSUCCESSFUL;
671 become_root();
672 status = pdb_update_sam_account(sampass);
673 unbecome_root();
676 /* set up the LSA Server Password Set response */
678 memcpy(r->out.return_authenticator, &cred_out,
679 sizeof(r->out.return_authenticator));
681 TALLOC_FREE(sampass);
682 return status;
685 /*************************************************************************
686 _netr_LogonSamLogoff
687 *************************************************************************/
689 NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
690 struct netr_LogonSamLogoff *r)
692 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
693 /* 'server schannel = yes' should enforce use of
694 schannel, the client did offer it in auth2, but
695 obviously did not use it. */
696 DEBUG(0,("_netr_LogonSamLogoff: client %s not using schannel for netlogon\n",
697 get_remote_machine_name() ));
698 return NT_STATUS_ACCESS_DENIED;
702 if (!get_valid_user_struct(p->vuid))
703 return NT_STATUS_NO_SUCH_USER;
705 /* Using the remote machine name for the creds store: */
706 /* r->in.computer_name */
708 if (!p->dc) {
709 /* Restore the saved state of the netlogon creds. */
710 bool ret;
712 become_root();
713 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
714 r->in.computer_name,
715 &p->dc);
716 unbecome_root();
717 if (!ret) {
718 return NT_STATUS_INVALID_HANDLE;
722 if (!p->dc || !p->dc->authenticated) {
723 return NT_STATUS_INVALID_HANDLE;
726 /* checks and updates credentials. creates reply credentials */
727 if (!netlogon_creds_server_step(p->dc, r->in.credential, r->out.return_authenticator)) {
728 DEBUG(2,("_netr_LogonSamLogoff: netlogon_creds_server_step failed. Rejecting auth "
729 "request from client %s machine account %s\n",
730 r->in.computer_name, p->dc->mach_acct ));
731 return NT_STATUS_INVALID_PARAMETER;
734 /* We must store the creds state after an update. */
735 become_root();
736 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
737 r->in.computer_name,
738 p->dc);
739 unbecome_root();
741 return NT_STATUS_OK;
744 /*******************************************************************
745 gets a domain user's groups from their already-calculated NT_USER_TOKEN
746 ********************************************************************/
748 static NTSTATUS nt_token_to_group_list(TALLOC_CTX *mem_ctx,
749 const DOM_SID *domain_sid,
750 size_t num_sids,
751 const DOM_SID *sids,
752 int *numgroups, DOM_GID **pgids)
754 int i;
756 *numgroups=0;
757 *pgids = NULL;
759 for (i=0; i<num_sids; i++) {
760 DOM_GID gid;
761 if (!sid_peek_check_rid(domain_sid, &sids[i], &gid.g_rid)) {
762 continue;
764 gid.attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT|
765 SE_GROUP_ENABLED);
766 ADD_TO_ARRAY(mem_ctx, DOM_GID, gid, pgids, numgroups);
767 if (*pgids == NULL) {
768 return NT_STATUS_NO_MEMORY;
771 return NT_STATUS_OK;
774 /*************************************************************************
775 _netr_LogonSamLogon
776 *************************************************************************/
778 NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
779 struct netr_LogonSamLogon *r)
781 NTSTATUS status = NT_STATUS_OK;
782 struct netr_SamInfo3 *sam3 = NULL;
783 union netr_LogonLevel *logon = r->in.logon;
784 fstring nt_username, nt_domain, nt_workstation;
785 auth_usersupplied_info *user_info = NULL;
786 auth_serversupplied_info *server_info = NULL;
787 struct samu *sampw;
788 struct auth_context *auth_context = NULL;
789 bool process_creds = true;
791 switch (p->hdr_req.opnum) {
792 case NDR_NETR_LOGONSAMLOGON:
793 process_creds = true;
794 break;
795 case NDR_NETR_LOGONSAMLOGONEX:
796 default:
797 process_creds = false;
800 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
801 /* 'server schannel = yes' should enforce use of
802 schannel, the client did offer it in auth2, but
803 obviously did not use it. */
804 DEBUG(0,("_netr_LogonSamLogon: client %s not using schannel for netlogon\n",
805 get_remote_machine_name() ));
806 return NT_STATUS_ACCESS_DENIED;
809 sam3 = TALLOC_ZERO_P(p->mem_ctx, struct netr_SamInfo3);
810 if (!sam3) {
811 return NT_STATUS_NO_MEMORY;
814 /* store the user information, if there is any. */
815 r->out.validation->sam3 = sam3;
816 *r->out.authoritative = true; /* authoritative response */
817 if (r->in.validation_level != 2 && r->in.validation_level != 3) {
818 DEBUG(0,("_netr_LogonSamLogon: bad validation_level value %d.\n",
819 (int)r->in.validation_level));
820 return NT_STATUS_ACCESS_DENIED;
823 if (!get_valid_user_struct(p->vuid))
824 return NT_STATUS_NO_SUCH_USER;
826 if (process_creds) {
827 fstring remote_machine;
829 /* Get the remote machine name for the creds store. */
830 /* Note this is the remote machine this request is coming from (member server),
831 not neccessarily the workstation name the user is logging onto.
834 fstrcpy(remote_machine, r->in.computer_name);
836 if (!p->dc) {
837 /* Restore the saved state of the netlogon creds. */
838 bool ret;
840 become_root();
841 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
842 remote_machine,
843 &p->dc);
844 unbecome_root();
845 if (!ret) {
846 return NT_STATUS_INVALID_HANDLE;
850 if (!p->dc || !p->dc->authenticated) {
851 return NT_STATUS_INVALID_HANDLE;
854 /* checks and updates credentials. creates reply credentials */
855 if (!netlogon_creds_server_step(p->dc, r->in.credential, r->out.return_authenticator)) {
856 DEBUG(2,("_netr_LogonSamLogon: creds_server_step failed. Rejecting auth "
857 "request from client %s machine account %s\n",
858 remote_machine, p->dc->mach_acct ));
859 return NT_STATUS_INVALID_PARAMETER;
862 /* We must store the creds state after an update. */
863 become_root();
864 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
865 remote_machine,
866 p->dc);
867 unbecome_root();
870 switch (r->in.logon_level) {
871 case INTERACTIVE_LOGON_TYPE:
872 fstrcpy(nt_username,
873 logon->password->identity_info.account_name.string);
874 fstrcpy(nt_domain,
875 logon->password->identity_info.domain_name.string);
876 fstrcpy(nt_workstation,
877 logon->password->identity_info.workstation.string);
879 DEBUG(3,("SAM Logon (Interactive). Domain:[%s]. ", lp_workgroup()));
880 break;
881 case NET_LOGON_TYPE:
882 fstrcpy(nt_username,
883 logon->network->identity_info.account_name.string);
884 fstrcpy(nt_domain,
885 logon->network->identity_info.domain_name.string);
886 fstrcpy(nt_workstation,
887 logon->network->identity_info.workstation.string);
889 DEBUG(3,("SAM Logon (Network). Domain:[%s]. ", lp_workgroup()));
890 break;
891 default:
892 DEBUG(2,("SAM Logon: unsupported switch value\n"));
893 return NT_STATUS_INVALID_INFO_CLASS;
894 } /* end switch */
896 DEBUG(3,("User:[%s@%s] Requested Domain:[%s]\n", nt_username, nt_workstation, nt_domain));
897 fstrcpy(current_user_info.smb_name, nt_username);
898 sub_set_smb_name(nt_username);
900 DEBUG(5,("Attempting validation level %d for unmapped username %s.\n",
901 r->in.validation_level, nt_username));
903 status = NT_STATUS_OK;
905 switch (r->in.logon_level) {
906 case NET_LOGON_TYPE:
908 const char *wksname = nt_workstation;
910 status = make_auth_context_fixed(&auth_context,
911 logon->network->challenge);
912 if (!NT_STATUS_IS_OK(status)) {
913 return status;
916 /* For a network logon, the workstation name comes in with two
917 * backslashes in the front. Strip them if they are there. */
919 if (*wksname == '\\') wksname++;
920 if (*wksname == '\\') wksname++;
922 /* Standard challenge/response authenticaion */
923 if (!make_user_info_netlogon_network(&user_info,
924 nt_username, nt_domain,
925 wksname,
926 logon->network->identity_info.parameter_control,
927 logon->network->lm.data,
928 logon->network->lm.length,
929 logon->network->nt.data,
930 logon->network->nt.length)) {
931 status = NT_STATUS_NO_MEMORY;
933 break;
935 case INTERACTIVE_LOGON_TYPE:
936 /* 'Interactive' authentication, supplies the password in its
937 MD4 form, encrypted with the session key. We will convert
938 this to challenge/response for the auth subsystem to chew
939 on */
941 const uint8 *chal;
943 if (!NT_STATUS_IS_OK(status = make_auth_context_subsystem(&auth_context))) {
944 return status;
947 chal = auth_context->get_ntlm_challenge(auth_context);
949 if (!make_user_info_netlogon_interactive(&user_info,
950 nt_username, nt_domain,
951 nt_workstation,
952 logon->password->identity_info.parameter_control,
953 chal,
954 logon->password->lmpassword.hash,
955 logon->password->ntpassword.hash,
956 p->dc->sess_key)) {
957 status = NT_STATUS_NO_MEMORY;
959 break;
961 default:
962 DEBUG(2,("SAM Logon: unsupported switch value\n"));
963 return NT_STATUS_INVALID_INFO_CLASS;
964 } /* end switch */
966 if ( NT_STATUS_IS_OK(status) ) {
967 status = auth_context->check_ntlm_password(auth_context,
968 user_info, &server_info);
971 (auth_context->free)(&auth_context);
972 free_user_info(&user_info);
974 DEBUG(5,("_netr_LogonSamLogon: check_password returned status %s\n",
975 nt_errstr(status)));
977 /* Check account and password */
979 if (!NT_STATUS_IS_OK(status)) {
980 /* If we don't know what this domain is, we need to
981 indicate that we are not authoritative. This
982 allows the client to decide if it needs to try
983 a local user. Fix by jpjanosi@us.ibm.com, #2976 */
984 if ( NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)
985 && !strequal(nt_domain, get_global_sam_name())
986 && !is_trusted_domain(nt_domain) )
987 *r->out.authoritative = false; /* We are not authoritative */
989 TALLOC_FREE(server_info);
990 return status;
993 if (server_info->guest) {
994 /* We don't like guest domain logons... */
995 DEBUG(5,("_netr_LogonSamLogon: Attempted domain logon as GUEST "
996 "denied.\n"));
997 TALLOC_FREE(server_info);
998 return NT_STATUS_LOGON_FAILURE;
1001 /* This is the point at which, if the login was successful, that
1002 the SAM Local Security Authority should record that the user is
1003 logged in to the domain. */
1006 DOM_GID *gids = NULL;
1007 const DOM_SID *user_sid = NULL;
1008 const DOM_SID *group_sid = NULL;
1009 DOM_SID domain_sid;
1010 uint32 user_rid, group_rid;
1012 int num_gids = 0;
1013 const char *my_name;
1015 struct netr_UserSessionKey user_session_key;
1016 struct netr_LMSessionKey lm_session_key;
1017 unsigned char pipe_session_key[16];
1019 NTTIME last_logon, last_logoff, acct_expiry, last_password_change;
1020 NTTIME allow_password_change, force_password_change;
1021 struct samr_RidWithAttributeArray groups;
1022 int i;
1023 struct dom_sid2 *sid = NULL;
1025 ZERO_STRUCT(user_session_key);
1026 ZERO_STRUCT(lm_session_key);
1028 sampw = server_info->sam_account;
1030 user_sid = pdb_get_user_sid(sampw);
1031 group_sid = pdb_get_group_sid(sampw);
1033 if ((user_sid == NULL) || (group_sid == NULL)) {
1034 DEBUG(1, ("_netr_LogonSamLogon: User without group or user SID\n"));
1035 return NT_STATUS_UNSUCCESSFUL;
1038 sid_copy(&domain_sid, user_sid);
1039 sid_split_rid(&domain_sid, &user_rid);
1041 sid = sid_dup_talloc(p->mem_ctx, &domain_sid);
1042 if (!sid) {
1043 return NT_STATUS_NO_MEMORY;
1046 if (!sid_peek_check_rid(&domain_sid, group_sid, &group_rid)) {
1047 DEBUG(1, ("_netr_LogonSamLogon: user %s\\%s has user sid "
1048 "%s\n but group sid %s.\n"
1049 "The conflicting domain portions are not "
1050 "supported for NETLOGON calls\n",
1051 pdb_get_domain(sampw),
1052 pdb_get_username(sampw),
1053 sid_string_dbg(user_sid),
1054 sid_string_dbg(group_sid)));
1055 return NT_STATUS_UNSUCCESSFUL;
1058 if(server_info->login_server) {
1059 my_name = server_info->login_server;
1060 } else {
1061 my_name = global_myname();
1064 status = nt_token_to_group_list(p->mem_ctx, &domain_sid,
1065 server_info->num_sids,
1066 server_info->sids,
1067 &num_gids, &gids);
1069 if (!NT_STATUS_IS_OK(status)) {
1070 return status;
1073 if (server_info->user_session_key.length) {
1074 memcpy(user_session_key.key,
1075 server_info->user_session_key.data,
1076 MIN(sizeof(user_session_key.key),
1077 server_info->user_session_key.length));
1078 if (process_creds) {
1079 /* Get the pipe session key from the creds. */
1080 memcpy(pipe_session_key, p->dc->sess_key, 16);
1081 } else {
1082 /* Get the pipe session key from the schannel. */
1083 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL || p->auth.a_u.schannel_auth == NULL) {
1084 return NT_STATUS_INVALID_HANDLE;
1086 memcpy(pipe_session_key, p->auth.a_u.schannel_auth->sess_key, 16);
1088 SamOEMhash(user_session_key.key, pipe_session_key, 16);
1089 memset(pipe_session_key, '\0', 16);
1091 if (server_info->lm_session_key.length) {
1092 memcpy(lm_session_key.key,
1093 server_info->lm_session_key.data,
1094 MIN(sizeof(lm_session_key.key),
1095 server_info->lm_session_key.length));
1096 if (process_creds) {
1097 /* Get the pipe session key from the creds. */
1098 memcpy(pipe_session_key, p->dc->sess_key, 16);
1099 } else {
1100 /* Get the pipe session key from the schannel. */
1101 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL || p->auth.a_u.schannel_auth == NULL) {
1102 return NT_STATUS_INVALID_HANDLE;
1104 memcpy(pipe_session_key, p->auth.a_u.schannel_auth->sess_key, 16);
1106 SamOEMhash(lm_session_key.key, pipe_session_key, 16);
1107 memset(pipe_session_key, '\0', 16);
1110 groups.count = num_gids;
1111 groups.rids = TALLOC_ARRAY(p->mem_ctx, struct samr_RidWithAttribute,
1112 groups.count);
1113 if (!groups.rids) {
1114 return NT_STATUS_NO_MEMORY;
1117 for (i=0; i < groups.count; i++) {
1118 groups.rids[i].rid = gids[i].g_rid;
1119 groups.rids[i].attributes = gids[i].attr;
1122 unix_to_nt_time(&last_logon, pdb_get_logon_time(sampw));
1123 unix_to_nt_time(&last_logoff, get_time_t_max());
1124 unix_to_nt_time(&acct_expiry, get_time_t_max());
1125 unix_to_nt_time(&last_password_change, pdb_get_pass_last_set_time(sampw));
1126 unix_to_nt_time(&allow_password_change, pdb_get_pass_can_change_time(sampw));
1127 unix_to_nt_time(&force_password_change, pdb_get_pass_must_change_time(sampw));
1129 init_netr_SamInfo3(sam3,
1130 last_logon,
1131 last_logoff,
1132 acct_expiry,
1133 last_password_change,
1134 allow_password_change,
1135 force_password_change,
1136 talloc_strdup(p->mem_ctx, pdb_get_username(sampw)),
1137 talloc_strdup(p->mem_ctx, pdb_get_fullname(sampw)),
1138 talloc_strdup(p->mem_ctx, pdb_get_logon_script(sampw)),
1139 talloc_strdup(p->mem_ctx, pdb_get_profile_path(sampw)),
1140 talloc_strdup(p->mem_ctx, pdb_get_homedir(sampw)),
1141 talloc_strdup(p->mem_ctx, pdb_get_dir_drive(sampw)),
1142 0, /* logon_count */
1143 0, /* bad_password_count */
1144 user_rid,
1145 group_rid,
1146 groups,
1147 NETLOGON_EXTRA_SIDS,
1148 user_session_key,
1149 my_name,
1150 talloc_strdup(p->mem_ctx, pdb_get_domain(sampw)),
1151 sid,
1152 lm_session_key,
1153 pdb_get_acct_ctrl(sampw),
1154 0, /* sidcount */
1155 NULL); /* struct netr_SidAttr *sids */
1156 ZERO_STRUCT(user_session_key);
1157 ZERO_STRUCT(lm_session_key);
1159 TALLOC_FREE(server_info);
1160 return status;
1163 /*************************************************************************
1164 _netr_LogonSamLogonEx
1165 - no credential chaining. Map into net sam logon.
1166 *************************************************************************/
1168 NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p,
1169 struct netr_LogonSamLogonEx *r)
1171 struct netr_LogonSamLogon q;
1173 /* Only allow this if the pipe is protected. */
1174 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1175 DEBUG(0,("_net_sam_logon_ex: client %s not using schannel for netlogon\n",
1176 get_remote_machine_name() ));
1177 return NT_STATUS_INVALID_PARAMETER;
1180 q.in.server_name = r->in.server_name;
1181 q.in.computer_name = r->in.computer_name;
1182 q.in.logon_level = r->in.logon_level;
1183 q.in.logon = r->in.logon;
1184 q.in.validation_level = r->in.validation_level;
1185 /* we do not handle the flags */
1186 /* = r->in.flags; */
1188 q.out.validation = r->out.validation;
1189 q.out.authoritative = r->out.authoritative;
1190 /* we do not handle the flags */
1191 /* = r->out.flags; */
1193 return _netr_LogonSamLogon(p, &q);
1196 /*************************************************************************
1197 _ds_enum_dom_trusts
1198 *************************************************************************/
1199 #if 0 /* JERRY -- not correct */
1200 NTSTATUS _ds_enum_dom_trusts(pipes_struct *p, DS_Q_ENUM_DOM_TRUSTS *q_u,
1201 DS_R_ENUM_DOM_TRUSTS *r_u)
1203 NTSTATUS status = NT_STATUS_OK;
1205 /* TODO: According to MSDN, the can only be executed against a
1206 DC or domain member running Windows 2000 or later. Need
1207 to test against a standalone 2k server and see what it
1208 does. A windows 2000 DC includes its own domain in the
1209 list. --jerry */
1211 return status;
1213 #endif /* JERRY */
1216 /****************************************************************
1217 ****************************************************************/
1219 WERROR _netr_LogonUasLogon(pipes_struct *p,
1220 struct netr_LogonUasLogon *r)
1222 p->rng_fault_state = true;
1223 return WERR_NOT_SUPPORTED;
1226 /****************************************************************
1227 ****************************************************************/
1229 WERROR _netr_LogonUasLogoff(pipes_struct *p,
1230 struct netr_LogonUasLogoff *r)
1232 p->rng_fault_state = true;
1233 return WERR_NOT_SUPPORTED;
1236 /****************************************************************
1237 ****************************************************************/
1239 NTSTATUS _netr_DatabaseDeltas(pipes_struct *p,
1240 struct netr_DatabaseDeltas *r)
1242 p->rng_fault_state = true;
1243 return NT_STATUS_NOT_IMPLEMENTED;
1246 /****************************************************************
1247 ****************************************************************/
1249 NTSTATUS _netr_DatabaseSync(pipes_struct *p,
1250 struct netr_DatabaseSync *r)
1252 p->rng_fault_state = true;
1253 return NT_STATUS_NOT_IMPLEMENTED;
1256 /****************************************************************
1257 ****************************************************************/
1259 NTSTATUS _netr_AccountDeltas(pipes_struct *p,
1260 struct netr_AccountDeltas *r)
1262 p->rng_fault_state = true;
1263 return NT_STATUS_NOT_IMPLEMENTED;
1266 /****************************************************************
1267 ****************************************************************/
1269 NTSTATUS _netr_AccountSync(pipes_struct *p,
1270 struct netr_AccountSync *r)
1272 p->rng_fault_state = true;
1273 return NT_STATUS_NOT_IMPLEMENTED;
1276 /****************************************************************
1277 ****************************************************************/
1279 WERROR _netr_GetDcName(pipes_struct *p,
1280 struct netr_GetDcName *r)
1282 p->rng_fault_state = true;
1283 return WERR_NOT_SUPPORTED;
1286 /****************************************************************
1287 ****************************************************************/
1289 WERROR _netr_GetAnyDCName(pipes_struct *p,
1290 struct netr_GetAnyDCName *r)
1292 p->rng_fault_state = true;
1293 return WERR_NOT_SUPPORTED;
1296 /****************************************************************
1297 ****************************************************************/
1299 NTSTATUS _netr_DatabaseSync2(pipes_struct *p,
1300 struct netr_DatabaseSync2 *r)
1302 p->rng_fault_state = true;
1303 return NT_STATUS_NOT_IMPLEMENTED;
1306 /****************************************************************
1307 ****************************************************************/
1309 NTSTATUS _netr_DatabaseRedo(pipes_struct *p,
1310 struct netr_DatabaseRedo *r)
1312 p->rng_fault_state = true;
1313 return NT_STATUS_NOT_IMPLEMENTED;
1316 /****************************************************************
1317 ****************************************************************/
1319 WERROR _netr_LogonControl2Ex(pipes_struct *p,
1320 struct netr_LogonControl2Ex *r)
1322 p->rng_fault_state = true;
1323 return WERR_NOT_SUPPORTED;
1326 /****************************************************************
1327 ****************************************************************/
1329 WERROR _netr_DsRGetDCName(pipes_struct *p,
1330 struct netr_DsRGetDCName *r)
1332 p->rng_fault_state = true;
1333 return WERR_NOT_SUPPORTED;
1336 /****************************************************************
1337 ****************************************************************/
1339 WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p,
1340 struct netr_NETRLOGONDUMMYROUTINE1 *r)
1342 p->rng_fault_state = true;
1343 return WERR_NOT_SUPPORTED;
1346 /****************************************************************
1347 ****************************************************************/
1349 WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p,
1350 struct netr_NETRLOGONSETSERVICEBITS *r)
1352 p->rng_fault_state = true;
1353 return WERR_NOT_SUPPORTED;
1356 /****************************************************************
1357 ****************************************************************/
1359 WERROR _netr_LogonGetTrustRid(pipes_struct *p,
1360 struct netr_LogonGetTrustRid *r)
1362 p->rng_fault_state = true;
1363 return WERR_NOT_SUPPORTED;
1366 /****************************************************************
1367 ****************************************************************/
1369 WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p,
1370 struct netr_NETRLOGONCOMPUTESERVERDIGEST *r)
1372 p->rng_fault_state = true;
1373 return WERR_NOT_SUPPORTED;
1376 /****************************************************************
1377 ****************************************************************/
1379 WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p,
1380 struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r)
1382 p->rng_fault_state = true;
1383 return WERR_NOT_SUPPORTED;
1386 /****************************************************************
1387 ****************************************************************/
1389 NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
1390 struct netr_ServerAuthenticate3 *r)
1392 p->rng_fault_state = true;
1393 return NT_STATUS_NOT_IMPLEMENTED;
1396 /****************************************************************
1397 ****************************************************************/
1399 WERROR _netr_DsRGetDCNameEx(pipes_struct *p,
1400 struct netr_DsRGetDCNameEx *r)
1402 p->rng_fault_state = true;
1403 return WERR_NOT_SUPPORTED;
1406 /****************************************************************
1407 ****************************************************************/
1409 WERROR _netr_DsRGetSiteName(pipes_struct *p,
1410 struct netr_DsRGetSiteName *r)
1412 p->rng_fault_state = true;
1413 return WERR_NOT_SUPPORTED;
1416 /****************************************************************
1417 ****************************************************************/
1419 NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p,
1420 struct netr_LogonGetDomainInfo *r)
1422 p->rng_fault_state = true;
1423 return NT_STATUS_NOT_IMPLEMENTED;
1426 /****************************************************************
1427 ****************************************************************/
1429 NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p,
1430 struct netr_ServerPasswordSet2 *r)
1432 p->rng_fault_state = true;
1433 return NT_STATUS_NOT_IMPLEMENTED;
1436 /****************************************************************
1437 ****************************************************************/
1439 WERROR _netr_ServerPasswordGet(pipes_struct *p,
1440 struct netr_ServerPasswordGet *r)
1442 p->rng_fault_state = true;
1443 return WERR_NOT_SUPPORTED;
1446 /****************************************************************
1447 ****************************************************************/
1449 WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p,
1450 struct netr_NETRLOGONSENDTOSAM *r)
1452 p->rng_fault_state = true;
1453 return WERR_NOT_SUPPORTED;
1456 /****************************************************************
1457 ****************************************************************/
1459 WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p,
1460 struct netr_DsRAddressToSitenamesW *r)
1462 p->rng_fault_state = true;
1463 return WERR_NOT_SUPPORTED;
1466 /****************************************************************
1467 ****************************************************************/
1469 WERROR _netr_DsRGetDCNameEx2(pipes_struct *p,
1470 struct netr_DsRGetDCNameEx2 *r)
1472 p->rng_fault_state = true;
1473 return WERR_NOT_SUPPORTED;
1476 /****************************************************************
1477 ****************************************************************/
1479 WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p,
1480 struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r)
1482 p->rng_fault_state = true;
1483 return WERR_NOT_SUPPORTED;
1486 /****************************************************************
1487 ****************************************************************/
1489 WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p,
1490 struct netr_NetrEnumerateTrustedDomainsEx *r)
1492 p->rng_fault_state = true;
1493 return WERR_NOT_SUPPORTED;
1496 /****************************************************************
1497 ****************************************************************/
1499 WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p,
1500 struct netr_DsRAddressToSitenamesExW *r)
1502 p->rng_fault_state = true;
1503 return WERR_NOT_SUPPORTED;
1506 /****************************************************************
1507 ****************************************************************/
1509 WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p,
1510 struct netr_DsrGetDcSiteCoverageW *r)
1512 p->rng_fault_state = true;
1513 return WERR_NOT_SUPPORTED;
1516 /****************************************************************
1517 ****************************************************************/
1519 WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p,
1520 struct netr_DsrEnumerateDomainTrusts *r)
1522 p->rng_fault_state = true;
1523 return WERR_NOT_SUPPORTED;
1526 /****************************************************************
1527 ****************************************************************/
1529 WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p,
1530 struct netr_DsrDeregisterDNSHostRecords *r)
1532 p->rng_fault_state = true;
1533 return WERR_NOT_SUPPORTED;
1536 /****************************************************************
1537 ****************************************************************/
1539 NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p,
1540 struct netr_ServerTrustPasswordsGet *r)
1542 p->rng_fault_state = true;
1543 return NT_STATUS_NOT_IMPLEMENTED;
1546 /****************************************************************
1547 ****************************************************************/
1549 WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p,
1550 struct netr_DsRGetForestTrustInformation *r)
1552 p->rng_fault_state = true;
1553 return WERR_NOT_SUPPORTED;
1556 /****************************************************************
1557 ****************************************************************/
1559 WERROR _netr_GetForestTrustInformation(pipes_struct *p,
1560 struct netr_GetForestTrustInformation *r)
1562 p->rng_fault_state = true;
1563 return WERR_NOT_SUPPORTED;
1566 /****************************************************************
1567 ****************************************************************/
1569 NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p,
1570 struct netr_LogonSamLogonWithFlags *r)
1572 p->rng_fault_state = true;
1573 return NT_STATUS_NOT_IMPLEMENTED;
1576 /****************************************************************
1577 ****************************************************************/
1579 WERROR _netr_NETRSERVERGETTRUSTINFO(pipes_struct *p,
1580 struct netr_NETRSERVERGETTRUSTINFO *r)
1582 p->rng_fault_state = true;
1583 return WERR_NOT_SUPPORTED;