Enable build of pidl generated netlogon server.
[Samba/gebeck_regimport.git] / source / rpc_server / srv_netlog_nt.c
blob3a7075ecd6d1918b1e53fa528805e93d5372aded
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.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 /* This is the implementation of the netlogon pipe. */
26 #include "includes.h"
28 extern userdom_struct current_user_info;
30 #undef DBGC_CLASS
31 #define DBGC_CLASS DBGC_RPC_SRV
33 /*************************************************************************
34 init_net_r_req_chal:
35 *************************************************************************/
37 static void init_net_r_req_chal(NET_R_REQ_CHAL *r_c,
38 DOM_CHAL *srv_chal, NTSTATUS status)
40 DEBUG(6,("init_net_r_req_chal: %d\n", __LINE__));
41 memcpy(r_c->srv_chal.data, srv_chal->data, sizeof(srv_chal->data));
42 r_c->status = status;
45 /*************************************************************************
46 net_reply_logon_ctrl:
47 *************************************************************************/
49 NTSTATUS _net_logon_ctrl(pipes_struct *p, NET_Q_LOGON_CTRL *q_u,
50 NET_R_LOGON_CTRL *r_u)
52 uint32 flags = 0x0;
53 uint32 pdc_connection_status = 0x00; /* Maybe a win32 error code? */
55 /* Setup the Logon Control response */
57 init_net_r_logon_ctrl(r_u, q_u->query_level, flags,
58 pdc_connection_status);
60 return r_u->status;
63 /****************************************************************************
64 Send a message to smbd to do a sam synchronisation
65 **************************************************************************/
67 static void send_sync_message(void)
69 DEBUG(3, ("sending sam synchronisation message\n"));
70 message_send_all(smbd_messaging_context(), MSG_SMB_SAM_SYNC, NULL, 0,
71 NULL);
74 /*************************************************************************
75 net_reply_logon_ctrl2:
76 *************************************************************************/
78 NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_CTRL2 *r_u)
80 uint32 flags = 0x0;
81 uint32 pdc_connection_status = 0x0;
82 uint32 logon_attempts = 0x0;
83 uint32 tc_status;
84 fstring servername, domain, dc_name, dc_name2;
85 struct sockaddr_storage dc_ss;
87 /* this should be \\global_myname() */
88 unistr2_to_ascii(servername, &q_u->uni_server_name, sizeof(servername));
90 r_u->status = NT_STATUS_OK;
92 tc_status = W_ERROR_V(WERR_NO_SUCH_DOMAIN);
93 fstrcpy( dc_name, "" );
95 switch ( q_u->function_code ) {
96 case NETLOGON_CONTROL_TC_QUERY:
97 unistr2_to_ascii(domain, &q_u->info.info6.domain, sizeof(domain));
99 if ( !is_trusted_domain( domain ) )
100 break;
102 if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
103 tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
104 break;
107 fstr_sprintf( dc_name, "\\\\%s", dc_name2 );
109 tc_status = W_ERROR_V(WERR_OK);
111 break;
113 case NETLOGON_CONTROL_REDISCOVER:
114 unistr2_to_ascii(domain, &q_u->info.info6.domain, sizeof(domain));
116 if ( !is_trusted_domain( domain ) )
117 break;
119 if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
120 tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
121 break;
124 fstr_sprintf( dc_name, "\\\\%s", dc_name2 );
126 tc_status = W_ERROR_V(WERR_OK);
128 break;
130 default:
131 /* no idea what this should be */
132 DEBUG(0,("_net_logon_ctrl2: unimplemented function level [%d]\n",
133 q_u->function_code));
136 /* prepare the response */
138 init_net_r_logon_ctrl2( r_u, q_u->query_level, flags,
139 pdc_connection_status, logon_attempts, tc_status, dc_name );
141 if (lp_server_role() == ROLE_DOMAIN_BDC)
142 send_sync_message();
144 return r_u->status;
147 /*************************************************************************
148 net_reply_trust_dom_list:
149 *************************************************************************/
151 NTSTATUS _net_trust_dom_list(pipes_struct *p, NET_Q_TRUST_DOM_LIST *q_u, NET_R_TRUST_DOM_LIST *r_u)
153 const char *trusted_domain = "test_domain";
154 uint32 num_trust_domains = 1;
156 DEBUG(6,("_net_trust_dom_list: %d\n", __LINE__));
158 /* set up the Trusted Domain List response */
159 init_r_trust_dom(r_u, num_trust_domains, trusted_domain);
161 DEBUG(6,("_net_trust_dom_list: %d\n", __LINE__));
163 return r_u->status;
166 /***********************************************************************************
167 init_net_r_srv_pwset:
168 ***********************************************************************************/
170 static void init_net_r_srv_pwset(NET_R_SRV_PWSET *r_s,
171 DOM_CRED *srv_cred, NTSTATUS status)
173 DEBUG(5,("init_net_r_srv_pwset: %d\n", __LINE__));
175 memcpy(&r_s->srv_cred, srv_cred, sizeof(r_s->srv_cred));
176 r_s->status = status;
178 DEBUG(5,("init_net_r_srv_pwset: %d\n", __LINE__));
181 /******************************************************************
182 gets a machine password entry. checks access rights of the host.
183 ******************************************************************/
185 static NTSTATUS get_md4pw(char *md4pw, char *mach_acct, uint16 sec_chan_type)
187 struct samu *sampass = NULL;
188 const uint8 *pass;
189 bool ret;
190 uint32 acct_ctrl;
192 #if 0
193 char addr[INET6_ADDRSTRLEN];
196 * Currently this code is redundent as we already have a filter
197 * by hostname list. What this code really needs to do is to
198 * get a hosts allowed/hosts denied list from the SAM database
199 * on a per user basis, and make the access decision there.
200 * I will leave this code here for now as a reminder to implement
201 * this at a later date. JRA.
204 if (!allow_access(lp_domain_hostsdeny(), lp_domain_hostsallow(),
205 client_name(get_client_fd()),
206 client_addr(get_client_fd(),addr,sizeof(addr)))) {
207 DEBUG(0,("get_md4pw: Workstation %s denied access to domain\n", mach_acct));
208 return False;
210 #endif /* 0 */
212 if ( !(sampass = samu_new( NULL )) ) {
213 return NT_STATUS_NO_MEMORY;
216 /* JRA. This is ok as it is only used for generating the challenge. */
217 become_root();
218 ret = pdb_getsampwnam(sampass, mach_acct);
219 unbecome_root();
221 if (!ret) {
222 DEBUG(0,("get_md4pw: Workstation %s: no account in domain\n", mach_acct));
223 TALLOC_FREE(sampass);
224 return NT_STATUS_ACCESS_DENIED;
227 acct_ctrl = pdb_get_acct_ctrl(sampass);
228 if (acct_ctrl & ACB_DISABLED) {
229 DEBUG(0,("get_md4pw: Workstation %s: account is disabled\n", mach_acct));
230 TALLOC_FREE(sampass);
231 return NT_STATUS_ACCOUNT_DISABLED;
234 if (!(acct_ctrl & ACB_SVRTRUST) &&
235 !(acct_ctrl & ACB_WSTRUST) &&
236 !(acct_ctrl & ACB_DOMTRUST))
238 DEBUG(0,("get_md4pw: Workstation %s: account is not a trust account\n", mach_acct));
239 TALLOC_FREE(sampass);
240 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
243 switch (sec_chan_type) {
244 case SEC_CHAN_BDC:
245 if (!(acct_ctrl & ACB_SVRTRUST)) {
246 DEBUG(0,("get_md4pw: Workstation %s: BDC secure channel requested "
247 "but not a server trust account\n", mach_acct));
248 TALLOC_FREE(sampass);
249 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
251 break;
252 case SEC_CHAN_WKSTA:
253 if (!(acct_ctrl & ACB_WSTRUST)) {
254 DEBUG(0,("get_md4pw: Workstation %s: WORKSTATION secure channel requested "
255 "but not a workstation trust account\n", mach_acct));
256 TALLOC_FREE(sampass);
257 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
259 break;
260 case SEC_CHAN_DOMAIN:
261 if (!(acct_ctrl & ACB_DOMTRUST)) {
262 DEBUG(0,("get_md4pw: Workstation %s: DOMAIN secure channel requested "
263 "but not a interdomain trust account\n", mach_acct));
264 TALLOC_FREE(sampass);
265 return NT_STATUS_NO_TRUST_SAM_ACCOUNT;
267 break;
268 default:
269 break;
272 if ((pass = pdb_get_nt_passwd(sampass)) == NULL) {
273 DEBUG(0,("get_md4pw: Workstation %s: account does not have a password\n", mach_acct));
274 TALLOC_FREE(sampass);
275 return NT_STATUS_LOGON_FAILURE;
278 memcpy(md4pw, pass, 16);
279 dump_data(5, (uint8 *)md4pw, 16);
281 TALLOC_FREE(sampass);
283 return NT_STATUS_OK;
288 /*************************************************************************
289 _net_req_chal
290 *************************************************************************/
292 NTSTATUS _net_req_chal(pipes_struct *p, NET_Q_REQ_CHAL *q_u, NET_R_REQ_CHAL *r_u)
294 if (!p->dc) {
295 p->dc = TALLOC_ZERO_P(p->pipe_state_mem_ctx, struct dcinfo);
296 if (!p->dc) {
297 return NT_STATUS_NO_MEMORY;
299 } else {
300 DEBUG(10,("_net_req_chal: new challenge requested. Clearing old state.\n"));
301 ZERO_STRUCTP(p->dc);
304 rpcstr_pull(p->dc->remote_machine,
305 q_u->uni_logon_clnt.buffer,
306 sizeof(fstring),q_u->uni_logon_clnt.uni_str_len*2,0);
308 /* Save the client challenge to the server. */
309 memcpy(p->dc->clnt_chal.data, q_u->clnt_chal.data, sizeof(q_u->clnt_chal.data));
311 /* Create a server challenge for the client */
312 /* Set this to a random value. */
313 generate_random_buffer(p->dc->srv_chal.data, 8);
315 /* set up the LSA REQUEST CHALLENGE response */
316 init_net_r_req_chal(r_u, &p->dc->srv_chal, NT_STATUS_OK);
318 p->dc->challenge_sent = True;
320 return NT_STATUS_OK;
323 /*************************************************************************
324 init_net_r_auth:
325 *************************************************************************/
327 static void init_net_r_auth(NET_R_AUTH *r_a, DOM_CHAL *resp_cred, NTSTATUS status)
329 memcpy(r_a->srv_chal.data, resp_cred->data, sizeof(resp_cred->data));
330 r_a->status = status;
333 /*************************************************************************
334 _net_auth. Create the initial credentials.
335 *************************************************************************/
337 NTSTATUS _net_auth(pipes_struct *p, NET_Q_AUTH *q_u, NET_R_AUTH *r_u)
339 NTSTATUS status;
340 fstring mach_acct;
341 fstring remote_machine;
342 DOM_CHAL srv_chal_out;
344 if (!p->dc || !p->dc->challenge_sent) {
345 return NT_STATUS_ACCESS_DENIED;
348 rpcstr_pull(mach_acct, q_u->clnt_id.uni_acct_name.buffer,sizeof(fstring),
349 q_u->clnt_id.uni_acct_name.uni_str_len*2,0);
350 rpcstr_pull(remote_machine, q_u->clnt_id.uni_comp_name.buffer,sizeof(fstring),
351 q_u->clnt_id.uni_comp_name.uni_str_len*2,0);
353 status = get_md4pw((char *)p->dc->mach_pw, mach_acct, q_u->clnt_id.sec_chan);
354 if (!NT_STATUS_IS_OK(status)) {
355 DEBUG(0,("_net_auth: creds_server_check failed. Failed to "
356 "get password for machine account %s "
357 "from client %s: %s\n",
358 mach_acct, remote_machine, nt_errstr(status) ));
359 /* always return NT_STATUS_ACCESS_DENIED */
360 return NT_STATUS_ACCESS_DENIED;
363 /* From the client / server challenges and md4 password, generate sess key */
364 creds_server_init(0, /* No neg flags. */
365 p->dc,
366 &p->dc->clnt_chal, /* Stored client chal. */
367 &p->dc->srv_chal, /* Stored server chal. */
368 p->dc->mach_pw,
369 &srv_chal_out);
371 /* Check client credentials are valid. */
372 if (!creds_server_check(p->dc, &q_u->clnt_chal)) {
373 DEBUG(0,("_net_auth: creds_server_check failed. Rejecting auth "
374 "request from client %s machine account %s\n",
375 remote_machine, mach_acct ));
376 return NT_STATUS_ACCESS_DENIED;
379 fstrcpy(p->dc->mach_acct, mach_acct);
380 fstrcpy(p->dc->remote_machine, remote_machine);
381 p->dc->authenticated = True;
383 /* set up the LSA AUTH response */
384 /* Return the server credentials. */
385 init_net_r_auth(r_u, &srv_chal_out, NT_STATUS_OK);
387 return r_u->status;
390 /*************************************************************************
391 init_net_r_auth_2:
392 *************************************************************************/
394 static void init_net_r_auth_2(NET_R_AUTH_2 *r_a,
395 DOM_CHAL *resp_cred, NEG_FLAGS *flgs, NTSTATUS status)
397 memcpy(r_a->srv_chal.data, resp_cred->data, sizeof(resp_cred->data));
398 memcpy(&r_a->srv_flgs, flgs, sizeof(r_a->srv_flgs));
399 r_a->status = status;
402 /*************************************************************************
403 _net_auth_2
404 *************************************************************************/
406 NTSTATUS _net_auth_2(pipes_struct *p, NET_Q_AUTH_2 *q_u, NET_R_AUTH_2 *r_u)
408 NTSTATUS status;
409 NEG_FLAGS srv_flgs;
410 fstring mach_acct;
411 fstring remote_machine;
412 DOM_CHAL srv_chal_out;
414 rpcstr_pull(mach_acct, q_u->clnt_id.uni_acct_name.buffer,sizeof(fstring),
415 q_u->clnt_id.uni_acct_name.uni_str_len*2,0);
417 /* We use this as the key to store the creds. */
418 rpcstr_pull(remote_machine, q_u->clnt_id.uni_comp_name.buffer,sizeof(fstring),
419 q_u->clnt_id.uni_comp_name.uni_str_len*2,0);
421 if (!p->dc || !p->dc->challenge_sent) {
422 DEBUG(0,("_net_auth2: no challenge sent to client %s\n",
423 remote_machine ));
424 return NT_STATUS_ACCESS_DENIED;
427 if ( (lp_server_schannel() == True) &&
428 ((q_u->clnt_flgs.neg_flags & NETLOGON_NEG_SCHANNEL) == 0) ) {
430 /* schannel must be used, but client did not offer it. */
431 DEBUG(0,("_net_auth2: schannel required but client failed "
432 "to offer it. Client was %s\n",
433 mach_acct ));
434 return NT_STATUS_ACCESS_DENIED;
437 status = get_md4pw((char *)p->dc->mach_pw, mach_acct, q_u->clnt_id.sec_chan);
438 if (!NT_STATUS_IS_OK(status)) {
439 DEBUG(0,("_net_auth2: failed to get machine password for "
440 "account %s: %s\n",
441 mach_acct, nt_errstr(status) ));
442 /* always return NT_STATUS_ACCESS_DENIED */
443 return NT_STATUS_ACCESS_DENIED;
446 /* From the client / server challenges and md4 password, generate sess key */
447 creds_server_init(q_u->clnt_flgs.neg_flags,
448 p->dc,
449 &p->dc->clnt_chal, /* Stored client chal. */
450 &p->dc->srv_chal, /* Stored server chal. */
451 p->dc->mach_pw,
452 &srv_chal_out);
454 /* Check client credentials are valid. */
455 if (!creds_server_check(p->dc, &q_u->clnt_chal)) {
456 DEBUG(0,("_net_auth2: creds_server_check failed. Rejecting auth "
457 "request from client %s machine account %s\n",
458 remote_machine, mach_acct ));
459 return NT_STATUS_ACCESS_DENIED;
462 srv_flgs.neg_flags = 0x000001ff;
464 if (lp_server_schannel() != False) {
465 srv_flgs.neg_flags |= NETLOGON_NEG_SCHANNEL;
468 /* set up the LSA AUTH 2 response */
469 init_net_r_auth_2(r_u, &srv_chal_out, &srv_flgs, NT_STATUS_OK);
471 fstrcpy(p->dc->mach_acct, mach_acct);
472 fstrcpy(p->dc->remote_machine, remote_machine);
473 fstrcpy(p->dc->domain, lp_workgroup() );
475 p->dc->authenticated = True;
477 /* Store off the state so we can continue after client disconnect. */
478 become_root();
479 secrets_store_schannel_session_info(p->mem_ctx,
480 remote_machine,
481 p->dc);
482 unbecome_root();
484 return r_u->status;
487 /*************************************************************************
488 _net_srv_pwset
489 *************************************************************************/
491 NTSTATUS _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET *r_u)
493 fstring remote_machine;
494 struct samu *sampass=NULL;
495 bool ret = False;
496 unsigned char pwd[16];
497 int i;
498 uint32 acct_ctrl;
499 DOM_CRED cred_out;
500 const uchar *old_pw;
502 DEBUG(5,("_net_srv_pwset: %d\n", __LINE__));
504 /* We need the remote machine name for the creds lookup. */
505 rpcstr_pull(remote_machine,q_u->clnt_id.login.uni_comp_name.buffer,
506 sizeof(remote_machine),q_u->clnt_id.login.uni_comp_name.uni_str_len*2,0);
508 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
509 /* 'server schannel = yes' should enforce use of
510 schannel, the client did offer it in auth2, but
511 obviously did not use it. */
512 DEBUG(0,("_net_srv_pwset: client %s not using schannel for netlogon\n",
513 remote_machine ));
514 return NT_STATUS_ACCESS_DENIED;
517 if (!p->dc) {
518 /* Restore the saved state of the netlogon creds. */
519 become_root();
520 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
521 remote_machine,
522 &p->dc);
523 unbecome_root();
524 if (!ret) {
525 return NT_STATUS_INVALID_HANDLE;
529 if (!p->dc || !p->dc->authenticated) {
530 return NT_STATUS_INVALID_HANDLE;
533 DEBUG(3,("_net_srv_pwset: Server Password Set by remote machine:[%s] on account [%s]\n",
534 remote_machine, p->dc->mach_acct));
536 /* Step the creds chain forward. */
537 if (!creds_server_step(p->dc, &q_u->clnt_id.cred, &cred_out)) {
538 DEBUG(2,("_net_srv_pwset: creds_server_step failed. Rejecting auth "
539 "request from client %s machine account %s\n",
540 remote_machine, p->dc->mach_acct ));
541 return NT_STATUS_INVALID_PARAMETER;
544 /* We must store the creds state after an update. */
545 sampass = samu_new( NULL );
546 if (!sampass) {
547 return NT_STATUS_NO_MEMORY;
550 become_root();
551 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
552 remote_machine,
553 p->dc);
554 ret = pdb_getsampwnam(sampass, p->dc->mach_acct);
555 unbecome_root();
557 if (!ret) {
558 TALLOC_FREE(sampass);
559 return NT_STATUS_ACCESS_DENIED;
562 /* Ensure the account exists and is a machine account. */
564 acct_ctrl = pdb_get_acct_ctrl(sampass);
566 if (!(acct_ctrl & ACB_WSTRUST ||
567 acct_ctrl & ACB_SVRTRUST ||
568 acct_ctrl & ACB_DOMTRUST)) {
569 TALLOC_FREE(sampass);
570 return NT_STATUS_NO_SUCH_USER;
573 if (pdb_get_acct_ctrl(sampass) & ACB_DISABLED) {
574 TALLOC_FREE(sampass);
575 return NT_STATUS_ACCOUNT_DISABLED;
578 /* Woah - what does this to to the credential chain ? JRA */
579 cred_hash3( pwd, q_u->pwd, p->dc->sess_key, 0);
581 DEBUG(100,("Server password set : new given value was :\n"));
582 for(i = 0; i < sizeof(pwd); i++)
583 DEBUG(100,("%02X ", pwd[i]));
584 DEBUG(100,("\n"));
586 old_pw = pdb_get_nt_passwd(sampass);
588 if (old_pw && memcmp(pwd, old_pw, 16) == 0) {
589 /* Avoid backend modificiations and other fun if the
590 client changed the password to the *same thing* */
592 ret = True;
593 } else {
595 /* LM password should be NULL for machines */
596 if (!pdb_set_lanman_passwd(sampass, NULL, PDB_CHANGED)) {
597 TALLOC_FREE(sampass);
598 return NT_STATUS_NO_MEMORY;
601 if (!pdb_set_nt_passwd(sampass, pwd, PDB_CHANGED)) {
602 TALLOC_FREE(sampass);
603 return NT_STATUS_NO_MEMORY;
606 if (!pdb_set_pass_last_set_time(sampass, time(NULL), PDB_CHANGED)) {
607 TALLOC_FREE(sampass);
608 /* Not quite sure what this one qualifies as, but this will do */
609 return NT_STATUS_UNSUCCESSFUL;
612 become_root();
613 r_u->status = pdb_update_sam_account(sampass);
614 unbecome_root();
617 /* set up the LSA Server Password Set response */
618 init_net_r_srv_pwset(r_u, &cred_out, r_u->status);
620 TALLOC_FREE(sampass);
621 return r_u->status;
624 /*************************************************************************
625 _net_sam_logoff:
626 *************************************************************************/
628 NTSTATUS _net_sam_logoff(pipes_struct *p, NET_Q_SAM_LOGOFF *q_u, NET_R_SAM_LOGOFF *r_u)
630 fstring remote_machine;
632 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
633 /* 'server schannel = yes' should enforce use of
634 schannel, the client did offer it in auth2, but
635 obviously did not use it. */
636 DEBUG(0,("_net_sam_logoff: client %s not using schannel for netlogon\n",
637 get_remote_machine_name() ));
638 return NT_STATUS_ACCESS_DENIED;
642 if (!get_valid_user_struct(p->vuid))
643 return NT_STATUS_NO_SUCH_USER;
645 /* Get the remote machine name for the creds store. */
646 rpcstr_pull(remote_machine,q_u->sam_id.client.login.uni_comp_name.buffer,
647 sizeof(remote_machine),q_u->sam_id.client.login.uni_comp_name.uni_str_len*2,0);
649 if (!p->dc) {
650 /* Restore the saved state of the netlogon creds. */
651 bool ret;
653 become_root();
654 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
655 remote_machine,
656 &p->dc);
657 unbecome_root();
658 if (!ret) {
659 return NT_STATUS_INVALID_HANDLE;
663 if (!p->dc || !p->dc->authenticated) {
664 return NT_STATUS_INVALID_HANDLE;
667 r_u->buffer_creds = 1; /* yes, we have valid server credentials */
669 /* checks and updates credentials. creates reply credentials */
670 if (!creds_server_step(p->dc, &q_u->sam_id.client.cred, &r_u->srv_creds)) {
671 DEBUG(2,("_net_sam_logoff: creds_server_step failed. Rejecting auth "
672 "request from client %s machine account %s\n",
673 remote_machine, p->dc->mach_acct ));
674 return NT_STATUS_INVALID_PARAMETER;
677 /* We must store the creds state after an update. */
678 become_root();
679 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
680 remote_machine,
681 p->dc);
682 unbecome_root();
684 r_u->status = NT_STATUS_OK;
685 return r_u->status;
688 /*******************************************************************
689 gets a domain user's groups from their already-calculated NT_USER_TOKEN
690 ********************************************************************/
692 static NTSTATUS nt_token_to_group_list(TALLOC_CTX *mem_ctx,
693 const DOM_SID *domain_sid,
694 size_t num_sids,
695 const DOM_SID *sids,
696 int *numgroups, DOM_GID **pgids)
698 int i;
700 *numgroups=0;
701 *pgids = NULL;
703 for (i=0; i<num_sids; i++) {
704 DOM_GID gid;
705 if (!sid_peek_check_rid(domain_sid, &sids[i], &gid.g_rid)) {
706 continue;
708 gid.attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT|
709 SE_GROUP_ENABLED);
710 ADD_TO_ARRAY(mem_ctx, DOM_GID, gid, pgids, numgroups);
711 if (*pgids == NULL) {
712 return NT_STATUS_NO_MEMORY;
715 return NT_STATUS_OK;
718 /*************************************************************************
719 _net_sam_logon
720 *************************************************************************/
722 static NTSTATUS _net_sam_logon_internal(pipes_struct *p,
723 NET_Q_SAM_LOGON *q_u,
724 NET_R_SAM_LOGON *r_u,
725 bool process_creds)
727 NTSTATUS status = NT_STATUS_OK;
728 NET_USER_INFO_3 *usr_info = NULL;
729 NET_ID_INFO_CTR *ctr = q_u->sam_id.ctr;
730 UNISTR2 *uni_samlogon_user = NULL;
731 UNISTR2 *uni_samlogon_domain = NULL;
732 UNISTR2 *uni_samlogon_workstation = NULL;
733 fstring nt_username, nt_domain, nt_workstation;
734 auth_usersupplied_info *user_info = NULL;
735 auth_serversupplied_info *server_info = NULL;
736 struct samu *sampw;
737 struct auth_context *auth_context = NULL;
739 if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
740 /* 'server schannel = yes' should enforce use of
741 schannel, the client did offer it in auth2, but
742 obviously did not use it. */
743 DEBUG(0,("_net_sam_logon_internal: client %s not using schannel for netlogon\n",
744 get_remote_machine_name() ));
745 return NT_STATUS_ACCESS_DENIED;
748 usr_info = TALLOC_P(p->mem_ctx, NET_USER_INFO_3);
749 if (!usr_info) {
750 return NT_STATUS_NO_MEMORY;
753 ZERO_STRUCTP(usr_info);
755 /* store the user information, if there is any. */
756 r_u->user = usr_info;
757 r_u->auth_resp = 1; /* authoritative response */
758 if (q_u->validation_level != 2 && q_u->validation_level != 3) {
759 DEBUG(0,("_net_sam_logon: bad validation_level value %d.\n", (int)q_u->validation_level ));
760 return NT_STATUS_ACCESS_DENIED;
762 /* We handle the return of USER_INFO_2 instead of 3 in the parse return. Sucks, I know... */
763 r_u->switch_value = q_u->validation_level; /* indicates type of validation user info */
764 r_u->buffer_creds = 1; /* Ensure we always return server creds. */
766 if (!get_valid_user_struct(p->vuid))
767 return NT_STATUS_NO_SUCH_USER;
769 if (process_creds) {
770 fstring remote_machine;
772 /* Get the remote machine name for the creds store. */
773 /* Note this is the remote machine this request is coming from (member server),
774 not neccessarily the workstation name the user is logging onto.
776 rpcstr_pull(remote_machine,q_u->sam_id.client.login.uni_comp_name.buffer,
777 sizeof(remote_machine),q_u->sam_id.client.login.uni_comp_name.uni_str_len*2,0);
779 if (!p->dc) {
780 /* Restore the saved state of the netlogon creds. */
781 bool ret;
783 become_root();
784 ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
785 remote_machine,
786 &p->dc);
787 unbecome_root();
788 if (!ret) {
789 return NT_STATUS_INVALID_HANDLE;
793 if (!p->dc || !p->dc->authenticated) {
794 return NT_STATUS_INVALID_HANDLE;
797 /* checks and updates credentials. creates reply credentials */
798 if (!creds_server_step(p->dc, &q_u->sam_id.client.cred, &r_u->srv_creds)) {
799 DEBUG(2,("_net_sam_logon: creds_server_step failed. Rejecting auth "
800 "request from client %s machine account %s\n",
801 remote_machine, p->dc->mach_acct ));
802 return NT_STATUS_INVALID_PARAMETER;
805 /* We must store the creds state after an update. */
806 become_root();
807 secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
808 remote_machine,
809 p->dc);
810 unbecome_root();
813 switch (q_u->sam_id.logon_level) {
814 case INTERACTIVE_LOGON_TYPE:
815 uni_samlogon_user = &ctr->auth.id1.uni_user_name;
816 uni_samlogon_domain = &ctr->auth.id1.uni_domain_name;
818 uni_samlogon_workstation = &ctr->auth.id1.uni_wksta_name;
820 DEBUG(3,("SAM Logon (Interactive). Domain:[%s]. ", lp_workgroup()));
821 break;
822 case NET_LOGON_TYPE:
823 uni_samlogon_user = &ctr->auth.id2.uni_user_name;
824 uni_samlogon_domain = &ctr->auth.id2.uni_domain_name;
825 uni_samlogon_workstation = &ctr->auth.id2.uni_wksta_name;
827 DEBUG(3,("SAM Logon (Network). Domain:[%s]. ", lp_workgroup()));
828 break;
829 default:
830 DEBUG(2,("SAM Logon: unsupported switch value\n"));
831 return NT_STATUS_INVALID_INFO_CLASS;
832 } /* end switch */
834 rpcstr_pull(nt_username,uni_samlogon_user->buffer,sizeof(nt_username),uni_samlogon_user->uni_str_len*2,0);
835 rpcstr_pull(nt_domain,uni_samlogon_domain->buffer,sizeof(nt_domain),uni_samlogon_domain->uni_str_len*2,0);
836 rpcstr_pull(nt_workstation,uni_samlogon_workstation->buffer,sizeof(nt_workstation),uni_samlogon_workstation->uni_str_len*2,0);
838 DEBUG(3,("User:[%s@%s] Requested Domain:[%s]\n", nt_username, nt_workstation, nt_domain));
839 fstrcpy(current_user_info.smb_name, nt_username);
840 sub_set_smb_name(nt_username);
842 DEBUG(5,("Attempting validation level %d for unmapped username %s.\n", q_u->sam_id.ctr->switch_value, nt_username));
844 status = NT_STATUS_OK;
846 switch (ctr->switch_value) {
847 case NET_LOGON_TYPE:
849 const char *wksname = nt_workstation;
851 if (!NT_STATUS_IS_OK(status = make_auth_context_fixed(&auth_context, ctr->auth.id2.lm_chal))) {
852 return status;
855 /* For a network logon, the workstation name comes in with two
856 * backslashes in the front. Strip them if they are there. */
858 if (*wksname == '\\') wksname++;
859 if (*wksname == '\\') wksname++;
861 /* Standard challenge/response authenticaion */
862 if (!make_user_info_netlogon_network(&user_info,
863 nt_username, nt_domain,
864 wksname,
865 ctr->auth.id2.param_ctrl,
866 ctr->auth.id2.lm_chal_resp.buffer,
867 ctr->auth.id2.lm_chal_resp.str_str_len,
868 ctr->auth.id2.nt_chal_resp.buffer,
869 ctr->auth.id2.nt_chal_resp.str_str_len)) {
870 status = NT_STATUS_NO_MEMORY;
872 break;
874 case INTERACTIVE_LOGON_TYPE:
875 /* 'Interactive' authentication, supplies the password in its
876 MD4 form, encrypted with the session key. We will convert
877 this to challenge/response for the auth subsystem to chew
878 on */
880 const uint8 *chal;
882 if (!NT_STATUS_IS_OK(status = make_auth_context_subsystem(&auth_context))) {
883 return status;
886 chal = auth_context->get_ntlm_challenge(auth_context);
888 if (!make_user_info_netlogon_interactive(&user_info,
889 nt_username, nt_domain,
890 nt_workstation,
891 ctr->auth.id1.param_ctrl,
892 chal,
893 ctr->auth.id1.lm_owf.data,
894 ctr->auth.id1.nt_owf.data,
895 p->dc->sess_key)) {
896 status = NT_STATUS_NO_MEMORY;
898 break;
900 default:
901 DEBUG(2,("SAM Logon: unsupported switch value\n"));
902 return NT_STATUS_INVALID_INFO_CLASS;
903 } /* end switch */
905 if ( NT_STATUS_IS_OK(status) ) {
906 status = auth_context->check_ntlm_password(auth_context,
907 user_info, &server_info);
910 (auth_context->free)(&auth_context);
911 free_user_info(&user_info);
913 DEBUG(5, ("_net_sam_logon: check_password returned status %s\n",
914 nt_errstr(status)));
916 /* Check account and password */
918 if (!NT_STATUS_IS_OK(status)) {
919 /* If we don't know what this domain is, we need to
920 indicate that we are not authoritative. This
921 allows the client to decide if it needs to try
922 a local user. Fix by jpjanosi@us.ibm.com, #2976 */
923 if ( NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)
924 && !strequal(nt_domain, get_global_sam_name())
925 && !is_trusted_domain(nt_domain) )
926 r_u->auth_resp = 0; /* We are not authoritative */
928 TALLOC_FREE(server_info);
929 return status;
932 if (server_info->guest) {
933 /* We don't like guest domain logons... */
934 DEBUG(5,("_net_sam_logon: Attempted domain logon as GUEST "
935 "denied.\n"));
936 TALLOC_FREE(server_info);
937 return NT_STATUS_LOGON_FAILURE;
940 /* This is the point at which, if the login was successful, that
941 the SAM Local Security Authority should record that the user is
942 logged in to the domain. */
945 DOM_GID *gids = NULL;
946 const DOM_SID *user_sid = NULL;
947 const DOM_SID *group_sid = NULL;
948 DOM_SID domain_sid;
949 uint32 user_rid, group_rid;
951 int num_gids = 0;
952 const char *my_name;
953 unsigned char user_session_key[16];
954 unsigned char lm_session_key[16];
955 unsigned char pipe_session_key[16];
957 sampw = server_info->sam_account;
959 /* set up pointer indicating user/password failed to be
960 * found */
961 usr_info->ptr_user_info = 0;
963 user_sid = pdb_get_user_sid(sampw);
964 group_sid = pdb_get_group_sid(sampw);
966 if ((user_sid == NULL) || (group_sid == NULL)) {
967 DEBUG(1, ("_net_sam_logon: User without group or user SID\n"));
968 return NT_STATUS_UNSUCCESSFUL;
971 sid_copy(&domain_sid, user_sid);
972 sid_split_rid(&domain_sid, &user_rid);
974 if (!sid_peek_check_rid(&domain_sid, group_sid, &group_rid)) {
975 DEBUG(1, ("_net_sam_logon: user %s\\%s has user sid "
976 "%s\n but group sid %s.\n"
977 "The conflicting domain portions are not "
978 "supported for NETLOGON calls\n",
979 pdb_get_domain(sampw),
980 pdb_get_username(sampw),
981 sid_string_dbg(user_sid),
982 sid_string_dbg(group_sid)));
983 return NT_STATUS_UNSUCCESSFUL;
986 if(server_info->login_server) {
987 my_name = server_info->login_server;
988 } else {
989 my_name = global_myname();
992 status = nt_token_to_group_list(p->mem_ctx, &domain_sid,
993 server_info->num_sids,
994 server_info->sids,
995 &num_gids, &gids);
997 if (!NT_STATUS_IS_OK(status)) {
998 return status;
1001 if (server_info->user_session_key.length) {
1002 memcpy(user_session_key,
1003 server_info->user_session_key.data,
1004 MIN(sizeof(user_session_key),
1005 server_info->user_session_key.length));
1006 if (process_creds) {
1007 /* Get the pipe session key from the creds. */
1008 memcpy(pipe_session_key, p->dc->sess_key, 16);
1009 } else {
1010 /* Get the pipe session key from the schannel. */
1011 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL || p->auth.a_u.schannel_auth == NULL) {
1012 return NT_STATUS_INVALID_HANDLE;
1014 memcpy(pipe_session_key, p->auth.a_u.schannel_auth->sess_key, 16);
1016 SamOEMhash(user_session_key, pipe_session_key, 16);
1017 memset(pipe_session_key, '\0', 16);
1019 if (server_info->lm_session_key.length) {
1020 memcpy(lm_session_key,
1021 server_info->lm_session_key.data,
1022 MIN(sizeof(lm_session_key),
1023 server_info->lm_session_key.length));
1024 if (process_creds) {
1025 /* Get the pipe session key from the creds. */
1026 memcpy(pipe_session_key, p->dc->sess_key, 16);
1027 } else {
1028 /* Get the pipe session key from the schannel. */
1029 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL || p->auth.a_u.schannel_auth == NULL) {
1030 return NT_STATUS_INVALID_HANDLE;
1032 memcpy(pipe_session_key, p->auth.a_u.schannel_auth->sess_key, 16);
1034 SamOEMhash(lm_session_key, pipe_session_key, 16);
1035 memset(pipe_session_key, '\0', 16);
1038 init_net_user_info3(p->mem_ctx, usr_info,
1039 user_rid,
1040 group_rid,
1041 pdb_get_username(sampw),
1042 pdb_get_fullname(sampw),
1043 pdb_get_homedir(sampw),
1044 pdb_get_dir_drive(sampw),
1045 pdb_get_logon_script(sampw),
1046 pdb_get_profile_path(sampw),
1047 pdb_get_logon_time(sampw),
1048 get_time_t_max(),
1049 get_time_t_max(),
1050 pdb_get_pass_last_set_time(sampw),
1051 pdb_get_pass_can_change_time(sampw),
1052 pdb_get_pass_must_change_time(sampw),
1053 0, /* logon_count */
1054 0, /* bad_pw_count */
1055 num_gids, /* uint32 num_groups */
1056 gids , /* DOM_GID *gids */
1057 NETLOGON_EXTRA_SIDS, /* uint32 user_flgs (?) */
1058 pdb_get_acct_ctrl(sampw),
1059 server_info->user_session_key.length ? user_session_key : NULL,
1060 server_info->lm_session_key.length ? lm_session_key : NULL,
1061 my_name , /* char *logon_srv */
1062 pdb_get_domain(sampw),
1063 &domain_sid); /* DOM_SID *dom_sid */
1064 ZERO_STRUCT(user_session_key);
1065 ZERO_STRUCT(lm_session_key);
1067 TALLOC_FREE(server_info);
1068 return status;
1071 /*************************************************************************
1072 _net_sam_logon
1073 *************************************************************************/
1075 NTSTATUS _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *r_u)
1077 return _net_sam_logon_internal(p, q_u, r_u, True);
1080 /*************************************************************************
1081 _net_sam_logon_ex - no credential chaining. Map into net sam logon.
1082 *************************************************************************/
1084 NTSTATUS _net_sam_logon_ex(pipes_struct *p, NET_Q_SAM_LOGON_EX *q_u, NET_R_SAM_LOGON_EX *r_u)
1086 NET_Q_SAM_LOGON q;
1087 NET_R_SAM_LOGON r;
1089 ZERO_STRUCT(q);
1090 ZERO_STRUCT(r);
1092 /* Only allow this if the pipe is protected. */
1093 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1094 DEBUG(0,("_net_sam_logon_ex: client %s not using schannel for netlogon\n",
1095 get_remote_machine_name() ));
1096 return NT_STATUS_INVALID_PARAMETER;
1099 /* Map a NET_Q_SAM_LOGON_EX to NET_Q_SAM_LOGON. */
1100 q.validation_level = q_u->validation_level;
1102 /* Map a DOM_SAM_INFO_EX into a DOM_SAM_INFO with no creds. */
1103 q.sam_id.client.login = q_u->sam_id.client;
1104 q.sam_id.logon_level = q_u->sam_id.logon_level;
1105 q.sam_id.ctr = q_u->sam_id.ctr;
1107 r_u->status = _net_sam_logon_internal(p, &q, &r, False);
1109 if (!NT_STATUS_IS_OK(r_u->status)) {
1110 return r_u->status;
1113 /* Map the NET_R_SAM_LOGON to NET_R_SAM_LOGON_EX. */
1114 r_u->switch_value = r.switch_value;
1115 r_u->user = r.user;
1116 r_u->auth_resp = r.auth_resp;
1117 r_u->flags = 0; /* FIXME ! */
1118 return r_u->status;
1121 /*************************************************************************
1122 _ds_enum_dom_trusts
1123 *************************************************************************/
1124 #if 0 /* JERRY -- not correct */
1125 NTSTATUS _ds_enum_dom_trusts(pipes_struct *p, DS_Q_ENUM_DOM_TRUSTS *q_u,
1126 DS_R_ENUM_DOM_TRUSTS *r_u)
1128 NTSTATUS status = NT_STATUS_OK;
1130 /* TODO: According to MSDN, the can only be executed against a
1131 DC or domain member running Windows 2000 or later. Need
1132 to test against a standalone 2k server and see what it
1133 does. A windows 2000 DC includes its own domain in the
1134 list. --jerry */
1136 return status;
1138 #endif /* JERRY */
1141 /****************************************************************
1142 ****************************************************************/
1144 WERROR _netr_LogonUasLogon(pipes_struct *p,
1145 struct netr_LogonUasLogon *r)
1147 p->rng_fault_state = true;
1148 return WERR_NOT_SUPPORTED;
1151 /****************************************************************
1152 ****************************************************************/
1154 WERROR _netr_LogonUasLogoff(pipes_struct *p,
1155 struct netr_LogonUasLogoff *r)
1157 p->rng_fault_state = true;
1158 return WERR_NOT_SUPPORTED;
1161 /****************************************************************
1162 ****************************************************************/
1164 NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
1165 struct netr_LogonSamLogon *r)
1167 p->rng_fault_state = true;
1168 return NT_STATUS_NOT_IMPLEMENTED;
1171 /****************************************************************
1172 ****************************************************************/
1174 NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
1175 struct netr_LogonSamLogoff *r)
1177 p->rng_fault_state = true;
1178 return NT_STATUS_NOT_IMPLEMENTED;
1181 /****************************************************************
1182 ****************************************************************/
1184 NTSTATUS _netr_ServerReqChallenge(pipes_struct *p,
1185 struct netr_ServerReqChallenge *r)
1187 p->rng_fault_state = true;
1188 return NT_STATUS_NOT_IMPLEMENTED;
1191 /****************************************************************
1192 ****************************************************************/
1194 NTSTATUS _netr_ServerAuthenticate(pipes_struct *p,
1195 struct netr_ServerAuthenticate *r)
1197 p->rng_fault_state = true;
1198 return NT_STATUS_NOT_IMPLEMENTED;
1201 /****************************************************************
1202 ****************************************************************/
1204 NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
1205 struct netr_ServerPasswordSet *r)
1207 p->rng_fault_state = true;
1208 return NT_STATUS_NOT_IMPLEMENTED;
1211 /****************************************************************
1212 ****************************************************************/
1214 NTSTATUS _netr_DatabaseDeltas(pipes_struct *p,
1215 struct netr_DatabaseDeltas *r)
1217 p->rng_fault_state = true;
1218 return NT_STATUS_NOT_IMPLEMENTED;
1221 /****************************************************************
1222 ****************************************************************/
1224 NTSTATUS _netr_DatabaseSync(pipes_struct *p,
1225 struct netr_DatabaseSync *r)
1227 p->rng_fault_state = true;
1228 return NT_STATUS_NOT_IMPLEMENTED;
1231 /****************************************************************
1232 ****************************************************************/
1234 NTSTATUS _netr_AccountDeltas(pipes_struct *p,
1235 struct netr_AccountDeltas *r)
1237 p->rng_fault_state = true;
1238 return NT_STATUS_NOT_IMPLEMENTED;
1241 /****************************************************************
1242 ****************************************************************/
1244 NTSTATUS _netr_AccountSync(pipes_struct *p,
1245 struct netr_AccountSync *r)
1247 p->rng_fault_state = true;
1248 return NT_STATUS_NOT_IMPLEMENTED;
1251 /****************************************************************
1252 ****************************************************************/
1254 WERROR _netr_LogonControl(pipes_struct *p,
1255 struct netr_LogonControl *r)
1257 p->rng_fault_state = true;
1258 return WERR_NOT_SUPPORTED;
1261 /****************************************************************
1262 ****************************************************************/
1264 WERROR _netr_GetDcName(pipes_struct *p,
1265 struct netr_GetDcName *r)
1267 p->rng_fault_state = true;
1268 return WERR_NOT_SUPPORTED;
1271 /****************************************************************
1272 ****************************************************************/
1274 WERROR _netr_GetAnyDCName(pipes_struct *p,
1275 struct netr_GetAnyDCName *r)
1277 p->rng_fault_state = true;
1278 return WERR_NOT_SUPPORTED;
1281 /****************************************************************
1282 ****************************************************************/
1284 WERROR _netr_LogonControl2(pipes_struct *p,
1285 struct netr_LogonControl2 *r)
1287 p->rng_fault_state = true;
1288 return WERR_NOT_SUPPORTED;
1291 /****************************************************************
1292 ****************************************************************/
1294 NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p,
1295 struct netr_ServerAuthenticate2 *r)
1297 p->rng_fault_state = true;
1298 return NT_STATUS_NOT_IMPLEMENTED;
1301 /****************************************************************
1302 ****************************************************************/
1304 NTSTATUS _netr_DatabaseSync2(pipes_struct *p,
1305 struct netr_DatabaseSync2 *r)
1307 p->rng_fault_state = true;
1308 return NT_STATUS_NOT_IMPLEMENTED;
1311 /****************************************************************
1312 ****************************************************************/
1314 NTSTATUS _netr_DatabaseRedo(pipes_struct *p,
1315 struct netr_DatabaseRedo *r)
1317 p->rng_fault_state = true;
1318 return NT_STATUS_NOT_IMPLEMENTED;
1321 /****************************************************************
1322 ****************************************************************/
1324 WERROR _netr_LogonControl2Ex(pipes_struct *p,
1325 struct netr_LogonControl2Ex *r)
1327 p->rng_fault_state = true;
1328 return WERR_NOT_SUPPORTED;
1331 /****************************************************************
1332 ****************************************************************/
1334 WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
1335 struct netr_NetrEnumerateTrustedDomains *r)
1337 p->rng_fault_state = true;
1338 return WERR_NOT_SUPPORTED;
1341 /****************************************************************
1342 ****************************************************************/
1344 WERROR _netr_DsRGetDCName(pipes_struct *p,
1345 struct netr_DsRGetDCName *r)
1347 p->rng_fault_state = true;
1348 return WERR_NOT_SUPPORTED;
1351 /****************************************************************
1352 ****************************************************************/
1354 WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p,
1355 struct netr_NETRLOGONDUMMYROUTINE1 *r)
1357 p->rng_fault_state = true;
1358 return WERR_NOT_SUPPORTED;
1361 /****************************************************************
1362 ****************************************************************/
1364 WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p,
1365 struct netr_NETRLOGONSETSERVICEBITS *r)
1367 p->rng_fault_state = true;
1368 return WERR_NOT_SUPPORTED;
1371 /****************************************************************
1372 ****************************************************************/
1374 WERROR _netr_LogonGetTrustRid(pipes_struct *p,
1375 struct netr_LogonGetTrustRid *r)
1377 p->rng_fault_state = true;
1378 return WERR_NOT_SUPPORTED;
1381 /****************************************************************
1382 ****************************************************************/
1384 WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p,
1385 struct netr_NETRLOGONCOMPUTESERVERDIGEST *r)
1387 p->rng_fault_state = true;
1388 return WERR_NOT_SUPPORTED;
1391 /****************************************************************
1392 ****************************************************************/
1394 WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p,
1395 struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r)
1397 p->rng_fault_state = true;
1398 return WERR_NOT_SUPPORTED;
1401 /****************************************************************
1402 ****************************************************************/
1404 NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
1405 struct netr_ServerAuthenticate3 *r)
1407 p->rng_fault_state = true;
1408 return NT_STATUS_NOT_IMPLEMENTED;
1411 /****************************************************************
1412 ****************************************************************/
1414 WERROR _netr_DsRGetDCNameEx(pipes_struct *p,
1415 struct netr_DsRGetDCNameEx *r)
1417 p->rng_fault_state = true;
1418 return WERR_NOT_SUPPORTED;
1421 /****************************************************************
1422 ****************************************************************/
1424 WERROR _netr_DsRGetSiteName(pipes_struct *p,
1425 struct netr_DsRGetSiteName *r)
1427 p->rng_fault_state = true;
1428 return WERR_NOT_SUPPORTED;
1431 /****************************************************************
1432 ****************************************************************/
1434 NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p,
1435 struct netr_LogonGetDomainInfo *r)
1437 p->rng_fault_state = true;
1438 return NT_STATUS_NOT_IMPLEMENTED;
1441 /****************************************************************
1442 ****************************************************************/
1444 NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p,
1445 struct netr_ServerPasswordSet2 *r)
1447 p->rng_fault_state = true;
1448 return NT_STATUS_NOT_IMPLEMENTED;
1451 /****************************************************************
1452 ****************************************************************/
1454 WERROR _netr_ServerPasswordGet(pipes_struct *p,
1455 struct netr_ServerPasswordGet *r)
1457 p->rng_fault_state = true;
1458 return WERR_NOT_SUPPORTED;
1461 /****************************************************************
1462 ****************************************************************/
1464 WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p,
1465 struct netr_NETRLOGONSENDTOSAM *r)
1467 p->rng_fault_state = true;
1468 return WERR_NOT_SUPPORTED;
1471 /****************************************************************
1472 ****************************************************************/
1474 WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p,
1475 struct netr_DsRAddressToSitenamesW *r)
1477 p->rng_fault_state = true;
1478 return WERR_NOT_SUPPORTED;
1481 /****************************************************************
1482 ****************************************************************/
1484 WERROR _netr_DsRGetDCNameEx2(pipes_struct *p,
1485 struct netr_DsRGetDCNameEx2 *r)
1487 p->rng_fault_state = true;
1488 return WERR_NOT_SUPPORTED;
1491 /****************************************************************
1492 ****************************************************************/
1494 WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p,
1495 struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r)
1497 p->rng_fault_state = true;
1498 return WERR_NOT_SUPPORTED;
1501 /****************************************************************
1502 ****************************************************************/
1504 WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p,
1505 struct netr_NetrEnumerateTrustedDomainsEx *r)
1507 p->rng_fault_state = true;
1508 return WERR_NOT_SUPPORTED;
1511 /****************************************************************
1512 ****************************************************************/
1514 WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p,
1515 struct netr_DsRAddressToSitenamesExW *r)
1517 p->rng_fault_state = true;
1518 return WERR_NOT_SUPPORTED;
1521 /****************************************************************
1522 ****************************************************************/
1524 WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p,
1525 struct netr_DsrGetDcSiteCoverageW *r)
1527 p->rng_fault_state = true;
1528 return WERR_NOT_SUPPORTED;
1531 /****************************************************************
1532 ****************************************************************/
1534 NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p,
1535 struct netr_LogonSamLogonEx *r)
1537 p->rng_fault_state = true;
1538 return NT_STATUS_NOT_IMPLEMENTED;
1541 /****************************************************************
1542 ****************************************************************/
1544 WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p,
1545 struct netr_DsrEnumerateDomainTrusts *r)
1547 p->rng_fault_state = true;
1548 return WERR_NOT_SUPPORTED;
1551 /****************************************************************
1552 ****************************************************************/
1554 WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p,
1555 struct netr_DsrDeregisterDNSHostRecords *r)
1557 p->rng_fault_state = true;
1558 return WERR_NOT_SUPPORTED;
1561 /****************************************************************
1562 ****************************************************************/
1564 NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p,
1565 struct netr_ServerTrustPasswordsGet *r)
1567 p->rng_fault_state = true;
1568 return NT_STATUS_NOT_IMPLEMENTED;
1571 /****************************************************************
1572 ****************************************************************/
1574 WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p,
1575 struct netr_DsRGetForestTrustInformation *r)
1577 p->rng_fault_state = true;
1578 return WERR_NOT_SUPPORTED;
1581 /****************************************************************
1582 ****************************************************************/
1584 WERROR _netr_GetForestTrustInformation(pipes_struct *p,
1585 struct netr_GetForestTrustInformation *r)
1587 p->rng_fault_state = true;
1588 return WERR_NOT_SUPPORTED;
1591 /****************************************************************
1592 ****************************************************************/
1594 NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p,
1595 struct netr_LogonSamLogonWithFlags *r)
1597 p->rng_fault_state = true;
1598 return NT_STATUS_NOT_IMPLEMENTED;
1601 /****************************************************************
1602 ****************************************************************/
1604 WERROR _netr_NETRSERVERGETTRUSTINFO(pipes_struct *p,
1605 struct netr_NETRSERVERGETTRUSTINFO *r)
1607 p->rng_fault_state = true;
1608 return WERR_NOT_SUPPORTED;