2 Unix SMB/Netbios implementation.
4 Authenticate against a remote domain
5 Copyright (C) Andrew Tridgell 1992-1998
6 Copyright (C) Andrew Bartlett 2001
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 extern int DEBUGLEVEL;
27 BOOL global_machine_password_needs_changing = False;
29 /****************************************************************************
30 Check for a valid username and password in security=domain mode.
31 ****************************************************************************/
33 uint32 check_domain_security(const auth_usersupplied_info *user_info,
34 auth_serversupplied_info *server_info)
36 uint32 nt_status = NT_STATUS_LOGON_FAILURE;
38 unsigned char trust_passwd[16];
39 time_t last_change_time;
41 if(lp_security() != SEC_DOMAIN)
42 return NT_STATUS_LOGON_FAILURE;
47 * Get the machine account password for our primary domain
50 if (!secrets_fetch_trust_account_password(lp_workgroup(), trust_passwd, &last_change_time))
52 DEBUG(0, ("check_domain_security: could not fetch trust account password for domain %s\n", lp_workgroup()));
54 return NT_STATUS_LOGON_FAILURE;
59 /* Test if machine password is expired and need to be changed */
60 if (time(NULL) > last_change_time + lp_machine_password_timeout())
62 global_machine_password_needs_changing = True;
66 * Treat each name in the 'password server =' line as a potential
67 * PDC/BDC. Contact each in turn and try and authenticate.
70 pserver = lp_passwordserver();
71 if (! *pserver) pserver = "*";
74 nt_status = domain_client_validate(user_info, server_info,
75 p, trust_passwd, last_change_time);