2 Unix SMB/Netbios implementation.
5 Winbind daemon - pam auuth funcions
7 Copyright (C) Andrew Tridgell 2000
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /* Return a password structure from a username. Specify whether cached data
29 enum winbindd_result
winbindd_pam_auth(struct winbindd_cli_state
*state
)
31 NET_USER_INFO_3 info3
;
34 uint8 trust_passwd
[16];
37 fstring name_domain
, name_user
;
38 extern pstring global_myname
;
40 DEBUG(1,("winbindd_pam_auth user=%s\n",
41 state
->request
.data
.auth
.user
));
43 /* Parse domain and username */
44 parse_domain_user(state
->request
.data
.auth
.user
, name_domain
, name_user
);
46 /* don't allow the null domain */
47 if (strcmp(name_domain
,"") == 0) return WINBINDD_ERROR
;
51 if (!secrets_fetch_trust_account_password(lp_workgroup(),
52 trust_passwd
, NULL
)) {
53 return WINBINDD_ERROR
;
56 nt_lm_owf_gen(state
->request
.data
.auth
.pass
, ntpw
, lmpw
);
58 slprintf(server
, sizeof(server
), "\\\\%s", server_state
.controller
);
60 status
= domain_client_validate_backend(server
,
61 name_user
, name_domain
,
62 global_myname
, SEC_CHAN_WKSTA
,
66 ntpw
, sizeof(ntpw
), &info3
);
68 if (status
!= NT_STATUS_NOPROBLEMO
) return WINBINDD_ERROR
;