s3-groupdb: fix enum_aliasmem in ldb branch.
[Samba.git] / source / rpc_server / srv_netlog_nt.c
blob4a78c949e1a918121ba0e904041e8d2df4057721
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_name2;
140 const char *dc_name = NULL;
141 struct sockaddr_storage dc_ss;
142 const char *domain = NULL;
143 struct netr_NETLOGON_INFO_1 *info1;
144 struct netr_NETLOGON_INFO_2 *info2;
145 struct netr_NETLOGON_INFO_3 *info3;
147 tc_status = W_ERROR_V(WERR_NO_SUCH_DOMAIN);
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 dc_name = talloc_asprintf(p->mem_ctx, "\\\\%s", dc_name2);
162 if (!dc_name) {
163 return WERR_NOMEM;
166 tc_status = W_ERROR_V(WERR_OK);
168 break;
170 case NETLOGON_CONTROL_REDISCOVER:
171 domain = r->in.data->domain;
173 if ( !is_trusted_domain( domain ) )
174 break;
176 if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
177 tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
178 break;
181 dc_name = talloc_asprintf(p->mem_ctx, "\\\\%s", dc_name2);
182 if (!dc_name) {
183 return WERR_NOMEM;
186 tc_status = W_ERROR_V(WERR_OK);
188 break;
190 default:
191 /* no idea what this should be */
192 DEBUG(0,("_netr_LogonControl2: unimplemented function level [%d]\n",
193 r->in.function_code));
194 return WERR_UNKNOWN_LEVEL;
197 /* prepare the response */
199 switch (r->in.level) {
200 case 1:
201 info1 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_1);
202 W_ERROR_HAVE_NO_MEMORY(info1);
204 init_netlogon_info1(info1,
205 flags,
206 pdc_connection_status);
207 r->out.query->info1 = info1;
208 break;
209 case 2:
210 info2 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_2);
211 W_ERROR_HAVE_NO_MEMORY(info2);
213 init_netlogon_info2(info2,
214 flags,
215 pdc_connection_status,
216 dc_name,
217 tc_status);
218 r->out.query->info2 = info2;
219 break;
220 case 3:
221 info3 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_3);
222 W_ERROR_HAVE_NO_MEMORY(info3);
224 init_netlogon_info3(info3,
225 flags,
226 logon_attempts);
227 r->out.query->info3 = info3;
228 break;
229 default:
230 return WERR_UNKNOWN_LEVEL;
233 if (lp_server_role() == ROLE_DOMAIN_BDC) {
234 send_sync_message();
237 return WERR_OK;
240 /*************************************************************************
241 _netr_NetrEnumerateTrustedDomains
242 *************************************************************************/
244 WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
245 struct netr_NetrEnumerateTrustedDomains *r)
247 struct netr_Blob trusted_domains_blob;
248 DATA_BLOB blob;
250 DEBUG(6,("_netr_NetrEnumerateTrustedDomains: %d\n", __LINE__));
252 /* set up the Trusted Domain List response */
254 blob = data_blob_talloc_zero(p->mem_ctx, 2);
255 trusted_domains_blob.data = blob.data;
256 trusted_domains_blob.length = blob.length;
258 DEBUG(6,("_netr_NetrEnumerateTrustedDomains: %d\n", __LINE__));
260 *r->out.trusted_domains_blob = trusted_domains_blob;
262 return WERR_OK;
265 /******************************************************************
266 gets a machine password entry. checks access rights of the host.
267 ******************************************************************/
269 static NTSTATUS get_md4pw(char *md4pw, const char *mach_acct, uint16 sec_chan_type)
271 struct samu *sampass = NULL;
272 const uint8 *pass;
273 bool ret;
274 uint32 acct_ctrl;
276 #if 0
277 char addr[INET6_ADDRSTRLEN];
280 * Currently this code is redundent as we already have a filter
281 * by hostname list. What this code really needs to do is to
282 * get a hosts allowed/hosts denied list from the SAM database
283 * on a per user basis, and make the access decision there.
284 * I will leave this code here for now as a reminder to implement
285 * this at a later date. JRA.
288 if (!allow_access(lp_domain_hostsdeny(), lp_domain_hostsallow(),
289 client_name(get_client_fd()),
290 client_addr(get_client_fd(),addr,sizeof(addr)))) {
291 DEBUG(0,("get_md4pw: Workstation %s denied access to domain\n", mach_acct));
292 return False;
294 #endif /* 0 */
296 if ( !(sampass = samu_new( NULL )) ) {
297 return NT_STATUS_NO_MEMORY;
300 /* JRA. This is ok as it is only used for generating the challenge. */
301 become_root();
302 ret = pdb_getsampwnam(sampass, mach_acct);
303 unbecome_root();
305 if (!ret) {
306 DEBUG(0,("get_md4pw: Workstation %s: no account in domain\n", mach_acct));
307 TALLOC_FREE(sampass);
308 return NT_STATUS_ACCESS_DENIED;
311 acct_ctrl = pdb_get_acct_ctrl(sampass);
312 if (acct_ctrl & ACB_DISABLED) {
313 DEBUG(0,("get_md4pw: Workstation %s: account is disabled\n", mach_acct));
314 TALLOC_FREE(sampass);
315 return NT_STATUS_ACCOUNT_DISABLED;
318 if (!(acct_ctrl & ACB_SVRTRUST) &&
319 !(acct_ctrl & ACB_WSTRUST) &&
320 !(acct_ctrl & ACB_DOMTRUST))
322 DEBUG(0,("get_md4pw: Workstation %s: account is not a trust account\n", mach_acct));
323 TALLOC_FREE(sampass);
324 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
327 switch (sec_chan_type) {
328 case SEC_CHAN_BDC:
329 if (!(acct_ctrl & ACB_SVRTRUST)) {
330 DEBUG(0,("get_md4pw: Workstation %s: BDC secure channel requested "
331 "but not a server trust account\n", mach_acct));
332 TALLOC_FREE(sampass);
333 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
335 break;
336 case SEC_CHAN_WKSTA:
337 if (!(acct_ctrl & ACB_WSTRUST)) {
338 DEBUG(0,("get_md4pw: Workstation %s: WORKSTATION secure channel requested "
339 "but not a workstation trust account\n", mach_acct));
340 TALLOC_FREE(sampass);
341 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
343 break;
344 case SEC_CHAN_DOMAIN:
345 if (!(acct_ctrl & ACB_DOMTRUST)) {
346 DEBUG(0,("get_md4pw: Workstation %s: DOMAIN secure channel requested "
347 "but not a interdomain trust account\n", mach_acct));
348 TALLOC_FREE(sampass);
349 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
351 break;
352 default:
353 break;
356 if ((pass = pdb_get_nt_passwd(sampass)) == NULL) {
357 DEBUG(0,("get_md4pw: Workstation %s: account does not have a password\n", mach_acct));
358 TALLOC_FREE(sampass);
359 return NT_STATUS_LOGON_FAILURE;
362 memcpy(md4pw, pass, 16);
363 dump_data(5, (uint8 *)md4pw, 16);
365 TALLOC_FREE(sampass);
367 return NT_STATUS_OK;
372 /*************************************************************************
373 _netr_ServerReqChallenge
374 *************************************************************************/
376 NTSTATUS _netr_ServerReqChallenge(pipes_struct *p,
377 struct netr_ServerReqChallenge *r)
379 if (!p->dc) {
380 p->dc = TALLOC_ZERO_P(p->pipe_state_mem_ctx, struct dcinfo);
381 if (!p->dc) {
382 return NT_STATUS_NO_MEMORY;
384 } else {
385 DEBUG(10,("_netr_ServerReqChallenge: new challenge requested. Clearing old state.\n"));
386 ZERO_STRUCTP(p->dc);
389 fstrcpy(p->dc->remote_machine, r->in.computer_name);
391 /* Save the client challenge to the server. */
392 memcpy(p->dc->clnt_chal.data, r->in.credentials->data,
393 sizeof(r->in.credentials->data));
395 /* Create a server challenge for the client */
396 /* Set this to a random value. */
397 generate_random_buffer(p->dc->srv_chal.data, 8);
399 /* set up the LSA REQUEST CHALLENGE response */
400 init_net_r_req_chal(r->out.return_credentials, &p->dc->srv_chal);
402 p->dc->challenge_sent = True;
404 return NT_STATUS_OK;
407 /*************************************************************************
408 _netr_ServerAuthenticate
409 Create the initial credentials.
410 *************************************************************************/
412 NTSTATUS _netr_ServerAuthenticate(pipes_struct *p,
413 struct netr_ServerAuthenticate *r)
415 NTSTATUS status;
416 struct netr_Credential srv_chal_out;
418 if (!p->dc || !p->dc->challenge_sent) {
419 return NT_STATUS_ACCESS_DENIED;
422 status = get_md4pw((char *)p->dc->mach_pw,
423 r->in.account_name,
424 r->in.secure_channel_type);
425 if (!NT_STATUS_IS_OK(status)) {
426 DEBUG(0,("_netr_ServerAuthenticate: get_md4pw failed. Failed to "
427 "get password for machine account %s "
428 "from client %s: %s\n",
429 r->in.account_name,
430 r->in.computer_name,
431 nt_errstr(status) ));
432 /* always return NT_STATUS_ACCESS_DENIED */
433 return NT_STATUS_ACCESS_DENIED;
436 /* From the client / server challenges and md4 password, generate sess key */
437 creds_server_init(0, /* No neg flags. */
438 p->dc,
439 &p->dc->clnt_chal, /* Stored client chal. */
440 &p->dc->srv_chal, /* Stored server chal. */
441 p->dc->mach_pw,
442 &srv_chal_out);
444 /* Check client credentials are valid. */
445 if (!netlogon_creds_server_check(p->dc, r->in.credentials)) {
446 DEBUG(0,("_netr_ServerAuthenticate: netlogon_creds_server_check failed. Rejecting auth "
447 "request from client %s machine account %s\n",
448 r->in.computer_name,
449 r->in.account_name));
450 return NT_STATUS_ACCESS_DENIED;
453 fstrcpy(p->dc->mach_acct, r->in.account_name);
454 fstrcpy(p->dc->remote_machine, r->in.computer_name);
455 p->dc->authenticated = True;
457 /* set up the LSA AUTH response */
458 /* Return the server credentials. */
460 memcpy(r->out.return_credentials->data, &srv_chal_out.data,
461 sizeof(r->out.return_credentials->data));
463 return NT_STATUS_OK;
466 /*************************************************************************
467 _netr_ServerAuthenticate2
468 *************************************************************************/
470 NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p,
471 struct netr_ServerAuthenticate2 *r)
473 NTSTATUS status;
474 uint32_t srv_flgs;
475 /* r->in.negotiate_flags is an aliased pointer to r->out.negotiate_flags,
476 * so use a copy to avoid destroying the client values. */
477 uint32_t in_neg_flags = *r->in.negotiate_flags;
478 struct netr_Credential srv_chal_out;
480 /* According to Microsoft (see bugid #6099)
481 * Windows 7 looks at the negotiate_flags
482 * returned in this structure *even if the
483 * call fails with access denied* ! So in order
484 * to allow Win7 to connect to a Samba NT style
485 * PDC we set the flags before we know if it's
486 * an error or not.
489 /* 0x000001ff */
490 srv_flgs = NETLOGON_NEG_ACCOUNT_LOCKOUT |
491 NETLOGON_NEG_PERSISTENT_SAMREPL |
492 NETLOGON_NEG_ARCFOUR |
493 NETLOGON_NEG_PROMOTION_COUNT |
494 NETLOGON_NEG_CHANGELOG_BDC |
495 NETLOGON_NEG_FULL_SYNC_REPL |
496 NETLOGON_NEG_MULTIPLE_SIDS |
497 NETLOGON_NEG_REDO |
498 NETLOGON_NEG_PASSWORD_CHANGE_REFUSAL;
500 /* Ensure we support strong (128-bit) keys. */
501 if (in_neg_flags & NETLOGON_NEG_128BIT) {
502 srv_flgs |= NETLOGON_NEG_128BIT;
505 if (lp_server_schannel() != false) {
506 srv_flgs |= NETLOGON_NEG_SCHANNEL;
509 /* We use this as the key to store the creds: */
510 /* r->in.computer_name */
512 if (!p->dc || !p->dc->challenge_sent) {
513 DEBUG(0,("_netr_ServerAuthenticate2: no challenge sent to client %s\n",
514 r->in.computer_name));
515 status = NT_STATUS_ACCESS_DENIED;
516 goto out;
519 if ( (lp_server_schannel() == true) &&
520 ((in_neg_flags & NETLOGON_NEG_SCHANNEL) == 0) ) {
522 /* schannel must be used, but client did not offer it. */
523 DEBUG(0,("_netr_ServerAuthenticate2: schannel required but client failed "
524 "to offer it. Client was %s\n",
525 r->in.account_name));
526 status = NT_STATUS_ACCESS_DENIED;
527 goto out;
530 status = get_md4pw((char *)p->dc->mach_pw,
531 r->in.account_name,
532 r->in.secure_channel_type);
533 if (!NT_STATUS_IS_OK(status)) {
534 DEBUG(0,("_netr_ServerAuthenticate2: failed to get machine password for "
535 "account %s: %s\n",
536 r->in.account_name, nt_errstr(status) ));
537 /* always return NT_STATUS_ACCESS_DENIED */
538 status = NT_STATUS_ACCESS_DENIED;
539 goto out;
542 /* From the client / server challenges and md4 password, generate sess key */
543 creds_server_init(in_neg_flags,
544 p->dc,
545 &p->dc->clnt_chal, /* Stored client chal. */
546 &p->dc->srv_chal, /* Stored server chal. */
547 p->dc->mach_pw,
548 &srv_chal_out);
550 /* Check client credentials are valid. */
551 if (!netlogon_creds_server_check(p->dc, r->in.credentials)) {
552 DEBUG(0,("_netr_ServerAuthenticate2: netlogon_creds_server_check failed. Rejecting auth "
553 "request from client %s machine account %s\n",
554 r->in.computer_name,
555 r->in.account_name));
556 status = NT_STATUS_ACCESS_DENIED;
557 goto out;
560 /* set up the LSA AUTH 2 response */
561 memcpy(r->out.return_credentials->data, &srv_chal_out.data,
562 sizeof(r->out.return_credentials->data));
564 fstrcpy(p->dc->mach_acct, r->in.account_name);
565 fstrcpy(p->dc->remote_machine, r->in.computer_name);
566 fstrcpy(p->dc->domain, lp_workgroup() );
568 p->dc->authenticated = True;
570 /* Store off the state so we can continue after client disconnect. */
571 become_root();
572 secrets_store_schannel_session_info(p->mem_ctx,
573 r->in.computer_name,
574 p->dc);
575 unbecome_root();
576 status = NT_STATUS_OK;
578 out:
580 *r->out.negotiate_flags = srv_flgs;
581 return status;
584 /*************************************************************************
585 _netr_ServerPasswordSet
586 *************************************************************************/
588 NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
589 struct netr_ServerPasswordSet *r)
591 NTSTATUS status = NT_STATUS_OK;
592 fstring remote_machine;
593 struct samu *sampass=NULL;
594 bool ret = False;
595 unsigned char pwd[16];
596 int i;
597 uint32 acct_ctrl;
598 struct netr_Authenticator cred_out;
599 const uchar *old_pw;
601 DEBUG(5,("_netr_ServerPasswordSet: %d\n", __LINE__));
603 /* We need the remote machine name for the creds lookup. */
604 fstrcpy(remote_machine, r->in.computer_name);
606 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
607 /* 'server schannel = yes' should enforce use of
608 schannel, the client did offer it in auth2, but
609 obviously did not use it. */
610 DEBUG(0,("_netr_ServerPasswordSet: client %s not using schannel for netlogon\n",
611 remote_machine ));
612 return NT_STATUS_ACCESS_DENIED;
615 if (!p->dc) {
616 /* Restore the saved state of the netlogon creds. */
617 become_root();
618 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
619 remote_machine,
620 &p->dc);
621 unbecome_root();
622 if (!ret) {
623 return NT_STATUS_INVALID_HANDLE;
627 if (!p->dc || !p->dc->authenticated) {
628 return NT_STATUS_INVALID_HANDLE;
631 DEBUG(3,("_netr_ServerPasswordSet: Server Password Set by remote machine:[%s] on account [%s]\n",
632 remote_machine, p->dc->mach_acct));
634 /* Step the creds chain forward. */
635 if (!netlogon_creds_server_step(p->dc, r->in.credential, &cred_out)) {
636 DEBUG(2,("_netr_ServerPasswordSet: netlogon_creds_server_step failed. Rejecting auth "
637 "request from client %s machine account %s\n",
638 remote_machine, p->dc->mach_acct ));
639 return NT_STATUS_INVALID_PARAMETER;
642 /* We must store the creds state after an update. */
643 sampass = samu_new( NULL );
644 if (!sampass) {
645 return NT_STATUS_NO_MEMORY;
648 become_root();
649 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
650 remote_machine,
651 p->dc);
652 ret = pdb_getsampwnam(sampass, p->dc->mach_acct);
653 unbecome_root();
655 if (!ret) {
656 TALLOC_FREE(sampass);
657 return NT_STATUS_ACCESS_DENIED;
660 /* Ensure the account exists and is a machine account. */
662 acct_ctrl = pdb_get_acct_ctrl(sampass);
664 if (!(acct_ctrl & ACB_WSTRUST ||
665 acct_ctrl & ACB_SVRTRUST ||
666 acct_ctrl & ACB_DOMTRUST)) {
667 TALLOC_FREE(sampass);
668 return NT_STATUS_NO_SUCH_USER;
671 if (pdb_get_acct_ctrl(sampass) & ACB_DISABLED) {
672 TALLOC_FREE(sampass);
673 return NT_STATUS_ACCOUNT_DISABLED;
676 /* Woah - what does this to to the credential chain ? JRA */
677 cred_hash3(pwd, r->in.new_password->hash, p->dc->sess_key, 0);
679 DEBUG(100,("_netr_ServerPasswordSet: new given value was :\n"));
680 for(i = 0; i < sizeof(pwd); i++)
681 DEBUG(100,("%02X ", pwd[i]));
682 DEBUG(100,("\n"));
684 old_pw = pdb_get_nt_passwd(sampass);
686 if (old_pw && memcmp(pwd, old_pw, 16) == 0) {
687 /* Avoid backend modificiations and other fun if the
688 client changed the password to the *same thing* */
690 ret = True;
691 } else {
693 /* LM password should be NULL for machines */
694 if (!pdb_set_lanman_passwd(sampass, NULL, PDB_CHANGED)) {
695 TALLOC_FREE(sampass);
696 return NT_STATUS_NO_MEMORY;
699 if (!pdb_set_nt_passwd(sampass, pwd, PDB_CHANGED)) {
700 TALLOC_FREE(sampass);
701 return NT_STATUS_NO_MEMORY;
704 if (!pdb_set_pass_last_set_time(sampass, time(NULL), PDB_CHANGED)) {
705 TALLOC_FREE(sampass);
706 /* Not quite sure what this one qualifies as, but this will do */
707 return NT_STATUS_UNSUCCESSFUL;
710 become_root();
711 status = pdb_update_sam_account(sampass);
712 unbecome_root();
715 /* set up the LSA Server Password Set response */
717 memcpy(r->out.return_authenticator, &cred_out,
718 sizeof(*(r->out.return_authenticator)));
720 TALLOC_FREE(sampass);
721 return status;
724 /*************************************************************************
725 _netr_LogonSamLogoff
726 *************************************************************************/
728 NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
729 struct netr_LogonSamLogoff *r)
731 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
732 /* 'server schannel = yes' should enforce use of
733 schannel, the client did offer it in auth2, but
734 obviously did not use it. */
735 DEBUG(0,("_netr_LogonSamLogoff: client %s not using schannel for netlogon\n",
736 get_remote_machine_name() ));
737 return NT_STATUS_ACCESS_DENIED;
741 if (!get_valid_user_struct(p->vuid))
742 return NT_STATUS_NO_SUCH_USER;
744 /* Using the remote machine name for the creds store: */
745 /* r->in.computer_name */
747 if (!p->dc) {
748 /* Restore the saved state of the netlogon creds. */
749 bool ret;
751 become_root();
752 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
753 r->in.computer_name,
754 &p->dc);
755 unbecome_root();
756 if (!ret) {
757 return NT_STATUS_INVALID_HANDLE;
761 if (!p->dc || !p->dc->authenticated) {
762 return NT_STATUS_INVALID_HANDLE;
765 /* checks and updates credentials. creates reply credentials */
766 if (!netlogon_creds_server_step(p->dc, r->in.credential, r->out.return_authenticator)) {
767 DEBUG(2,("_netr_LogonSamLogoff: netlogon_creds_server_step failed. Rejecting auth "
768 "request from client %s machine account %s\n",
769 r->in.computer_name, p->dc->mach_acct ));
770 return NT_STATUS_INVALID_PARAMETER;
773 /* We must store the creds state after an update. */
774 become_root();
775 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
776 r->in.computer_name,
777 p->dc);
778 unbecome_root();
780 return NT_STATUS_OK;
783 /*******************************************************************
784 gets a domain user's groups from their already-calculated NT_USER_TOKEN
785 ********************************************************************/
787 static NTSTATUS nt_token_to_group_list(TALLOC_CTX *mem_ctx,
788 const DOM_SID *domain_sid,
789 size_t num_sids,
790 const DOM_SID *sids,
791 int *numgroups, DOM_GID **pgids)
793 int i;
795 *numgroups=0;
796 *pgids = NULL;
798 for (i=0; i<num_sids; i++) {
799 DOM_GID gid;
800 if (!sid_peek_check_rid(domain_sid, &sids[i], &gid.g_rid)) {
801 continue;
803 gid.attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT|
804 SE_GROUP_ENABLED);
805 ADD_TO_ARRAY(mem_ctx, DOM_GID, gid, pgids, numgroups);
806 if (*pgids == NULL) {
807 return NT_STATUS_NO_MEMORY;
810 return NT_STATUS_OK;
813 /*************************************************************************
814 _netr_LogonSamLogon
815 *************************************************************************/
817 NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
818 struct netr_LogonSamLogon *r)
820 NTSTATUS status = NT_STATUS_OK;
821 struct netr_SamInfo3 *sam3 = NULL;
822 union netr_LogonInfo *logon = r->in.logon;
823 fstring nt_username, nt_domain, nt_workstation;
824 auth_usersupplied_info *user_info = NULL;
825 auth_serversupplied_info *server_info = NULL;
826 struct samu *sampw;
827 struct auth_context *auth_context = NULL;
828 bool process_creds = true;
830 switch (p->hdr_req.opnum) {
831 case NDR_NETR_LOGONSAMLOGON:
832 process_creds = true;
833 break;
834 case NDR_NETR_LOGONSAMLOGONEX:
835 default:
836 process_creds = false;
839 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
840 /* 'server schannel = yes' should enforce use of
841 schannel, the client did offer it in auth2, but
842 obviously did not use it. */
843 DEBUG(0,("_netr_LogonSamLogon: client %s not using schannel for netlogon\n",
844 get_remote_machine_name() ));
845 return NT_STATUS_ACCESS_DENIED;
848 sam3 = TALLOC_ZERO_P(p->mem_ctx, struct netr_SamInfo3);
849 if (!sam3) {
850 return NT_STATUS_NO_MEMORY;
853 /* store the user information, if there is any. */
854 r->out.validation->sam3 = sam3;
855 *r->out.authoritative = true; /* authoritative response */
856 if (r->in.validation_level != 2 && r->in.validation_level != 3) {
857 DEBUG(0,("_netr_LogonSamLogon: bad validation_level value %d.\n",
858 (int)r->in.validation_level));
859 return NT_STATUS_ACCESS_DENIED;
862 if (!get_valid_user_struct(p->vuid))
863 return NT_STATUS_NO_SUCH_USER;
865 if (process_creds) {
866 fstring remote_machine;
868 /* Get the remote machine name for the creds store. */
869 /* Note this is the remote machine this request is coming from (member server),
870 not neccessarily the workstation name the user is logging onto.
873 fstrcpy(remote_machine, r->in.computer_name);
875 if (!p->dc) {
876 /* Restore the saved state of the netlogon creds. */
877 bool ret;
879 become_root();
880 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
881 remote_machine,
882 &p->dc);
883 unbecome_root();
884 if (!ret) {
885 return NT_STATUS_INVALID_HANDLE;
889 if (!p->dc || !p->dc->authenticated) {
890 return NT_STATUS_INVALID_HANDLE;
893 /* checks and updates credentials. creates reply credentials */
894 if (!netlogon_creds_server_step(p->dc, r->in.credential, r->out.return_authenticator)) {
895 DEBUG(2,("_netr_LogonSamLogon: creds_server_step failed. Rejecting auth "
896 "request from client %s machine account %s\n",
897 remote_machine, p->dc->mach_acct ));
898 return NT_STATUS_INVALID_PARAMETER;
901 /* We must store the creds state after an update. */
902 become_root();
903 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
904 remote_machine,
905 p->dc);
906 unbecome_root();
909 switch (r->in.logon_level) {
910 case INTERACTIVE_LOGON_TYPE:
911 fstrcpy(nt_username,
912 logon->password->identity_info.account_name.string);
913 fstrcpy(nt_domain,
914 logon->password->identity_info.domain_name.string);
915 fstrcpy(nt_workstation,
916 logon->password->identity_info.workstation.string);
918 DEBUG(3,("SAM Logon (Interactive). Domain:[%s]. ", lp_workgroup()));
919 break;
920 case NET_LOGON_TYPE:
921 fstrcpy(nt_username,
922 logon->network->identity_info.account_name.string);
923 fstrcpy(nt_domain,
924 logon->network->identity_info.domain_name.string);
925 fstrcpy(nt_workstation,
926 logon->network->identity_info.workstation.string);
928 DEBUG(3,("SAM Logon (Network). Domain:[%s]. ", lp_workgroup()));
929 break;
930 default:
931 DEBUG(2,("SAM Logon: unsupported switch value\n"));
932 return NT_STATUS_INVALID_INFO_CLASS;
933 } /* end switch */
935 DEBUG(3,("User:[%s@%s] Requested Domain:[%s]\n", nt_username, nt_workstation, nt_domain));
936 fstrcpy(current_user_info.smb_name, nt_username);
937 sub_set_smb_name(nt_username);
939 DEBUG(5,("Attempting validation level %d for unmapped username %s.\n",
940 r->in.validation_level, nt_username));
942 status = NT_STATUS_OK;
944 switch (r->in.logon_level) {
945 case NET_LOGON_TYPE:
947 const char *wksname = nt_workstation;
949 status = make_auth_context_fixed(&auth_context,
950 logon->network->challenge);
951 if (!NT_STATUS_IS_OK(status)) {
952 return status;
955 /* For a network logon, the workstation name comes in with two
956 * backslashes in the front. Strip them if they are there. */
958 if (*wksname == '\\') wksname++;
959 if (*wksname == '\\') wksname++;
961 /* Standard challenge/response authenticaion */
962 if (!make_user_info_netlogon_network(&user_info,
963 nt_username, nt_domain,
964 wksname,
965 logon->network->identity_info.parameter_control,
966 logon->network->lm.data,
967 logon->network->lm.length,
968 logon->network->nt.data,
969 logon->network->nt.length)) {
970 status = NT_STATUS_NO_MEMORY;
972 break;
974 case INTERACTIVE_LOGON_TYPE:
975 /* 'Interactive' authentication, supplies the password in its
976 MD4 form, encrypted with the session key. We will convert
977 this to challenge/response for the auth subsystem to chew
978 on */
980 const uint8 *chal;
982 if (!NT_STATUS_IS_OK(status = make_auth_context_subsystem(&auth_context))) {
983 return status;
986 chal = auth_context->get_ntlm_challenge(auth_context);
988 if (!make_user_info_netlogon_interactive(&user_info,
989 nt_username, nt_domain,
990 nt_workstation,
991 logon->password->identity_info.parameter_control,
992 chal,
993 logon->password->lmpassword.hash,
994 logon->password->ntpassword.hash,
995 p->dc->sess_key)) {
996 status = NT_STATUS_NO_MEMORY;
998 break;
1000 default:
1001 DEBUG(2,("SAM Logon: unsupported switch value\n"));
1002 return NT_STATUS_INVALID_INFO_CLASS;
1003 } /* end switch */
1005 if ( NT_STATUS_IS_OK(status) ) {
1006 status = auth_context->check_ntlm_password(auth_context,
1007 user_info, &server_info);
1010 (auth_context->free)(&auth_context);
1011 free_user_info(&user_info);
1013 DEBUG(5,("_netr_LogonSamLogon: check_password returned status %s\n",
1014 nt_errstr(status)));
1016 /* Check account and password */
1018 if (!NT_STATUS_IS_OK(status)) {
1019 /* If we don't know what this domain is, we need to
1020 indicate that we are not authoritative. This
1021 allows the client to decide if it needs to try
1022 a local user. Fix by jpjanosi@us.ibm.com, #2976 */
1023 if ( NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)
1024 && !strequal(nt_domain, get_global_sam_name())
1025 && !is_trusted_domain(nt_domain) )
1026 *r->out.authoritative = false; /* We are not authoritative */
1028 TALLOC_FREE(server_info);
1029 return status;
1032 if (server_info->guest) {
1033 /* We don't like guest domain logons... */
1034 DEBUG(5,("_netr_LogonSamLogon: Attempted domain logon as GUEST "
1035 "denied.\n"));
1036 TALLOC_FREE(server_info);
1037 return NT_STATUS_LOGON_FAILURE;
1040 /* This is the point at which, if the login was successful, that
1041 the SAM Local Security Authority should record that the user is
1042 logged in to the domain. */
1045 DOM_GID *gids = NULL;
1046 const DOM_SID *user_sid = NULL;
1047 const DOM_SID *group_sid = NULL;
1048 DOM_SID domain_sid;
1049 uint32 user_rid, group_rid;
1051 int num_gids = 0;
1052 const char *my_name;
1054 struct netr_UserSessionKey user_session_key;
1055 struct netr_LMSessionKey lm_session_key;
1056 unsigned char pipe_session_key[16];
1058 NTTIME last_logon, last_logoff, acct_expiry, last_password_change;
1059 NTTIME allow_password_change, force_password_change;
1060 struct samr_RidWithAttributeArray groups;
1061 int i;
1062 struct dom_sid2 *sid = NULL;
1064 ZERO_STRUCT(user_session_key);
1065 ZERO_STRUCT(lm_session_key);
1067 sampw = server_info->sam_account;
1069 user_sid = pdb_get_user_sid(sampw);
1070 group_sid = pdb_get_group_sid(sampw);
1072 if ((user_sid == NULL) || (group_sid == NULL)) {
1073 DEBUG(1, ("_netr_LogonSamLogon: User without group or user SID\n"));
1074 return NT_STATUS_UNSUCCESSFUL;
1077 sid_copy(&domain_sid, user_sid);
1078 sid_split_rid(&domain_sid, &user_rid);
1080 sid = sid_dup_talloc(p->mem_ctx, &domain_sid);
1081 if (!sid) {
1082 return NT_STATUS_NO_MEMORY;
1085 if (!sid_peek_check_rid(&domain_sid, group_sid, &group_rid)) {
1086 DEBUG(1, ("_netr_LogonSamLogon: user %s\\%s has user sid "
1087 "%s\n but group sid %s.\n"
1088 "The conflicting domain portions are not "
1089 "supported for NETLOGON calls\n",
1090 pdb_get_domain(sampw),
1091 pdb_get_username(sampw),
1092 sid_string_dbg(user_sid),
1093 sid_string_dbg(group_sid)));
1094 return NT_STATUS_UNSUCCESSFUL;
1097 if(server_info->login_server) {
1098 my_name = server_info->login_server;
1099 } else {
1100 my_name = global_myname();
1103 status = nt_token_to_group_list(p->mem_ctx, &domain_sid,
1104 server_info->num_sids,
1105 server_info->sids,
1106 &num_gids, &gids);
1108 if (!NT_STATUS_IS_OK(status)) {
1109 return status;
1112 if (server_info->user_session_key.length) {
1113 memcpy(user_session_key.key,
1114 server_info->user_session_key.data,
1115 MIN(sizeof(user_session_key.key),
1116 server_info->user_session_key.length));
1117 if (process_creds) {
1118 /* Get the pipe session key from the creds. */
1119 memcpy(pipe_session_key, p->dc->sess_key, 16);
1120 } else {
1121 /* Get the pipe session key from the schannel. */
1122 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL || p->auth.a_u.schannel_auth == NULL) {
1123 return NT_STATUS_INVALID_HANDLE;
1125 memcpy(pipe_session_key, p->auth.a_u.schannel_auth->sess_key, 16);
1127 SamOEMhash(user_session_key.key, pipe_session_key, 16);
1128 memset(pipe_session_key, '\0', 16);
1130 if (server_info->lm_session_key.length) {
1131 memcpy(lm_session_key.key,
1132 server_info->lm_session_key.data,
1133 MIN(sizeof(lm_session_key.key),
1134 server_info->lm_session_key.length));
1135 if (process_creds) {
1136 /* Get the pipe session key from the creds. */
1137 memcpy(pipe_session_key, p->dc->sess_key, 16);
1138 } else {
1139 /* Get the pipe session key from the schannel. */
1140 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL || p->auth.a_u.schannel_auth == NULL) {
1141 return NT_STATUS_INVALID_HANDLE;
1143 memcpy(pipe_session_key, p->auth.a_u.schannel_auth->sess_key, 16);
1145 SamOEMhash(lm_session_key.key, pipe_session_key, 8);
1146 memset(pipe_session_key, '\0', 16);
1149 groups.count = num_gids;
1150 groups.rids = TALLOC_ARRAY(p->mem_ctx, struct samr_RidWithAttribute,
1151 groups.count);
1152 if (!groups.rids) {
1153 return NT_STATUS_NO_MEMORY;
1156 for (i=0; i < groups.count; i++) {
1157 groups.rids[i].rid = gids[i].g_rid;
1158 groups.rids[i].attributes = gids[i].attr;
1161 unix_to_nt_time(&last_logon, pdb_get_logon_time(sampw));
1162 unix_to_nt_time(&last_logoff, get_time_t_max());
1163 unix_to_nt_time(&acct_expiry, get_time_t_max());
1164 unix_to_nt_time(&last_password_change, pdb_get_pass_last_set_time(sampw));
1165 unix_to_nt_time(&allow_password_change, pdb_get_pass_can_change_time(sampw));
1166 unix_to_nt_time(&force_password_change, pdb_get_pass_must_change_time(sampw));
1168 init_netr_SamInfo3(sam3,
1169 last_logon,
1170 last_logoff,
1171 acct_expiry,
1172 last_password_change,
1173 allow_password_change,
1174 force_password_change,
1175 talloc_strdup(p->mem_ctx, pdb_get_username(sampw)),
1176 talloc_strdup(p->mem_ctx, pdb_get_fullname(sampw)),
1177 talloc_strdup(p->mem_ctx, pdb_get_logon_script(sampw)),
1178 talloc_strdup(p->mem_ctx, pdb_get_profile_path(sampw)),
1179 talloc_strdup(p->mem_ctx, pdb_get_homedir(sampw)),
1180 talloc_strdup(p->mem_ctx, pdb_get_dir_drive(sampw)),
1181 0, /* logon_count */
1182 0, /* bad_password_count */
1183 user_rid,
1184 group_rid,
1185 groups,
1186 NETLOGON_EXTRA_SIDS,
1187 user_session_key,
1188 my_name,
1189 talloc_strdup(p->mem_ctx, pdb_get_domain(sampw)),
1190 sid,
1191 lm_session_key,
1192 pdb_get_acct_ctrl(sampw),
1193 0, /* sidcount */
1194 NULL); /* struct netr_SidAttr *sids */
1195 ZERO_STRUCT(user_session_key);
1196 ZERO_STRUCT(lm_session_key);
1198 TALLOC_FREE(server_info);
1199 return status;
1202 /*************************************************************************
1203 _netr_LogonSamLogonEx
1204 - no credential chaining. Map into net sam logon.
1205 *************************************************************************/
1207 NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p,
1208 struct netr_LogonSamLogonEx *r)
1210 struct netr_LogonSamLogon q;
1212 /* Only allow this if the pipe is protected. */
1213 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1214 DEBUG(0,("_net_sam_logon_ex: client %s not using schannel for netlogon\n",
1215 get_remote_machine_name() ));
1216 return NT_STATUS_INVALID_PARAMETER;
1219 q.in.server_name = r->in.server_name;
1220 q.in.computer_name = r->in.computer_name;
1221 q.in.logon_level = r->in.logon_level;
1222 q.in.logon = r->in.logon;
1223 q.in.validation_level = r->in.validation_level;
1224 /* we do not handle the flags */
1225 /* = r->in.flags; */
1227 q.out.validation = r->out.validation;
1228 q.out.authoritative = r->out.authoritative;
1229 /* we do not handle the flags */
1230 /* = r->out.flags; */
1232 return _netr_LogonSamLogon(p, &q);
1235 /*************************************************************************
1236 _ds_enum_dom_trusts
1237 *************************************************************************/
1238 #if 0 /* JERRY -- not correct */
1239 NTSTATUS _ds_enum_dom_trusts(pipes_struct *p, DS_Q_ENUM_DOM_TRUSTS *q_u,
1240 DS_R_ENUM_DOM_TRUSTS *r_u)
1242 NTSTATUS status = NT_STATUS_OK;
1244 /* TODO: According to MSDN, the can only be executed against a
1245 DC or domain member running Windows 2000 or later. Need
1246 to test against a standalone 2k server and see what it
1247 does. A windows 2000 DC includes its own domain in the
1248 list. --jerry */
1250 return status;
1252 #endif /* JERRY */
1255 /****************************************************************
1256 ****************************************************************/
1258 WERROR _netr_LogonUasLogon(pipes_struct *p,
1259 struct netr_LogonUasLogon *r)
1261 p->rng_fault_state = true;
1262 return WERR_NOT_SUPPORTED;
1265 /****************************************************************
1266 ****************************************************************/
1268 WERROR _netr_LogonUasLogoff(pipes_struct *p,
1269 struct netr_LogonUasLogoff *r)
1271 p->rng_fault_state = true;
1272 return WERR_NOT_SUPPORTED;
1275 /****************************************************************
1276 ****************************************************************/
1278 NTSTATUS _netr_DatabaseDeltas(pipes_struct *p,
1279 struct netr_DatabaseDeltas *r)
1281 p->rng_fault_state = true;
1282 return NT_STATUS_NOT_IMPLEMENTED;
1285 /****************************************************************
1286 ****************************************************************/
1288 NTSTATUS _netr_DatabaseSync(pipes_struct *p,
1289 struct netr_DatabaseSync *r)
1291 p->rng_fault_state = true;
1292 return NT_STATUS_NOT_IMPLEMENTED;
1295 /****************************************************************
1296 ****************************************************************/
1298 NTSTATUS _netr_AccountDeltas(pipes_struct *p,
1299 struct netr_AccountDeltas *r)
1301 p->rng_fault_state = true;
1302 return NT_STATUS_NOT_IMPLEMENTED;
1305 /****************************************************************
1306 ****************************************************************/
1308 NTSTATUS _netr_AccountSync(pipes_struct *p,
1309 struct netr_AccountSync *r)
1311 p->rng_fault_state = true;
1312 return NT_STATUS_NOT_IMPLEMENTED;
1315 /****************************************************************
1316 ****************************************************************/
1318 WERROR _netr_GetDcName(pipes_struct *p,
1319 struct netr_GetDcName *r)
1321 p->rng_fault_state = true;
1322 return WERR_NOT_SUPPORTED;
1325 /****************************************************************
1326 ****************************************************************/
1328 WERROR _netr_GetAnyDCName(pipes_struct *p,
1329 struct netr_GetAnyDCName *r)
1331 p->rng_fault_state = true;
1332 return WERR_NOT_SUPPORTED;
1335 /****************************************************************
1336 ****************************************************************/
1338 NTSTATUS _netr_DatabaseSync2(pipes_struct *p,
1339 struct netr_DatabaseSync2 *r)
1341 p->rng_fault_state = true;
1342 return NT_STATUS_NOT_IMPLEMENTED;
1345 /****************************************************************
1346 ****************************************************************/
1348 NTSTATUS _netr_DatabaseRedo(pipes_struct *p,
1349 struct netr_DatabaseRedo *r)
1351 p->rng_fault_state = true;
1352 return NT_STATUS_NOT_IMPLEMENTED;
1355 /****************************************************************
1356 ****************************************************************/
1358 WERROR _netr_LogonControl2Ex(pipes_struct *p,
1359 struct netr_LogonControl2Ex *r)
1361 p->rng_fault_state = true;
1362 return WERR_NOT_SUPPORTED;
1365 /****************************************************************
1366 ****************************************************************/
1368 WERROR _netr_DsRGetDCName(pipes_struct *p,
1369 struct netr_DsRGetDCName *r)
1371 p->rng_fault_state = true;
1372 return WERR_NOT_SUPPORTED;
1375 /****************************************************************
1376 ****************************************************************/
1378 NTSTATUS _netr_LogonGetCapabilities(pipes_struct *p,
1379 struct netr_LogonGetCapabilities *r)
1381 return NT_STATUS_NOT_IMPLEMENTED;
1384 /****************************************************************
1385 ****************************************************************/
1387 WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p,
1388 struct netr_NETRLOGONSETSERVICEBITS *r)
1390 p->rng_fault_state = true;
1391 return WERR_NOT_SUPPORTED;
1394 /****************************************************************
1395 ****************************************************************/
1397 WERROR _netr_LogonGetTrustRid(pipes_struct *p,
1398 struct netr_LogonGetTrustRid *r)
1400 p->rng_fault_state = true;
1401 return WERR_NOT_SUPPORTED;
1404 /****************************************************************
1405 ****************************************************************/
1407 WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p,
1408 struct netr_NETRLOGONCOMPUTESERVERDIGEST *r)
1410 p->rng_fault_state = true;
1411 return WERR_NOT_SUPPORTED;
1414 /****************************************************************
1415 ****************************************************************/
1417 WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p,
1418 struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r)
1420 p->rng_fault_state = true;
1421 return WERR_NOT_SUPPORTED;
1424 /****************************************************************
1425 ****************************************************************/
1427 NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
1428 struct netr_ServerAuthenticate3 *r)
1430 p->rng_fault_state = true;
1431 return NT_STATUS_NOT_IMPLEMENTED;
1434 /****************************************************************
1435 ****************************************************************/
1437 WERROR _netr_DsRGetDCNameEx(pipes_struct *p,
1438 struct netr_DsRGetDCNameEx *r)
1440 p->rng_fault_state = true;
1441 return WERR_NOT_SUPPORTED;
1444 /****************************************************************
1445 ****************************************************************/
1447 WERROR _netr_DsRGetSiteName(pipes_struct *p,
1448 struct netr_DsRGetSiteName *r)
1450 p->rng_fault_state = true;
1451 return WERR_NOT_SUPPORTED;
1454 /****************************************************************
1455 ****************************************************************/
1457 NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p,
1458 struct netr_LogonGetDomainInfo *r)
1460 p->rng_fault_state = true;
1461 return NT_STATUS_NOT_IMPLEMENTED;
1464 /****************************************************************
1465 ****************************************************************/
1467 NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p,
1468 struct netr_ServerPasswordSet2 *r)
1470 p->rng_fault_state = true;
1471 return NT_STATUS_NOT_IMPLEMENTED;
1474 /****************************************************************
1475 ****************************************************************/
1477 WERROR _netr_ServerPasswordGet(pipes_struct *p,
1478 struct netr_ServerPasswordGet *r)
1480 p->rng_fault_state = true;
1481 return WERR_NOT_SUPPORTED;
1484 /****************************************************************
1485 ****************************************************************/
1487 WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p,
1488 struct netr_NETRLOGONSENDTOSAM *r)
1490 p->rng_fault_state = true;
1491 return WERR_NOT_SUPPORTED;
1494 /****************************************************************
1495 ****************************************************************/
1497 WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p,
1498 struct netr_DsRAddressToSitenamesW *r)
1500 p->rng_fault_state = true;
1501 return WERR_NOT_SUPPORTED;
1504 /****************************************************************
1505 ****************************************************************/
1507 WERROR _netr_DsRGetDCNameEx2(pipes_struct *p,
1508 struct netr_DsRGetDCNameEx2 *r)
1510 p->rng_fault_state = true;
1511 return WERR_NOT_SUPPORTED;
1514 /****************************************************************
1515 ****************************************************************/
1517 WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p,
1518 struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r)
1520 p->rng_fault_state = true;
1521 return WERR_NOT_SUPPORTED;
1524 /****************************************************************
1525 ****************************************************************/
1527 WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p,
1528 struct netr_NetrEnumerateTrustedDomainsEx *r)
1530 p->rng_fault_state = true;
1531 return WERR_NOT_SUPPORTED;
1534 /****************************************************************
1535 ****************************************************************/
1537 WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p,
1538 struct netr_DsRAddressToSitenamesExW *r)
1540 p->rng_fault_state = true;
1541 return WERR_NOT_SUPPORTED;
1544 /****************************************************************
1545 ****************************************************************/
1547 WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p,
1548 struct netr_DsrGetDcSiteCoverageW *r)
1550 p->rng_fault_state = true;
1551 return WERR_NOT_SUPPORTED;
1554 /****************************************************************
1555 ****************************************************************/
1557 WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p,
1558 struct netr_DsrEnumerateDomainTrusts *r)
1560 p->rng_fault_state = true;
1561 return WERR_NOT_SUPPORTED;
1564 /****************************************************************
1565 ****************************************************************/
1567 WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p,
1568 struct netr_DsrDeregisterDNSHostRecords *r)
1570 p->rng_fault_state = true;
1571 return WERR_NOT_SUPPORTED;
1574 /****************************************************************
1575 ****************************************************************/
1577 NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p,
1578 struct netr_ServerTrustPasswordsGet *r)
1580 p->rng_fault_state = true;
1581 return NT_STATUS_NOT_IMPLEMENTED;
1584 /****************************************************************
1585 ****************************************************************/
1587 WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p,
1588 struct netr_DsRGetForestTrustInformation *r)
1590 p->rng_fault_state = true;
1591 return WERR_NOT_SUPPORTED;
1594 /****************************************************************
1595 ****************************************************************/
1597 WERROR _netr_GetForestTrustInformation(pipes_struct *p,
1598 struct netr_GetForestTrustInformation *r)
1600 p->rng_fault_state = true;
1601 return WERR_NOT_SUPPORTED;
1604 /****************************************************************
1605 ****************************************************************/
1607 NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p,
1608 struct netr_LogonSamLogonWithFlags *r)
1610 p->rng_fault_state = true;
1611 return NT_STATUS_NOT_IMPLEMENTED;
1614 /****************************************************************
1615 ****************************************************************/
1617 WERROR _netr_NETRSERVERGETTRUSTINFO(pipes_struct *p,
1618 struct netr_NETRSERVERGETTRUSTINFO *r)
1620 p->rng_fault_state = true;
1621 return WERR_NOT_SUPPORTED;