2 Unix SMB/CIFS implementation.
6 Copyright (C) Gerald (Jerry) Carter 2007
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 3 of the License, or (at your option) any later version.
13 This library 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 GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 /* Required Headers */
24 #include "libwbclient.h"
26 /** @brief Authenticate a username/password pair
28 * @param username Name of user to authenticate
29 * @param password Clear text password os user
34 wbcErr wbcAuthenticateUser(const char *username,
37 wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
38 struct winbindd_request request;
39 struct winbindd_response response;
42 wbc_status = WBC_ERR_INVALID_PARAM;
43 BAIL_ON_WBC_ERROR(wbc_status);
46 /* Initialize request */
49 ZERO_STRUCT(response);
51 /* dst is already null terminated from the memset above */
53 strncpy(request.data.auth.user, username,
54 sizeof(request.data.auth.user)-1);
55 strncpy(request.data.auth.pass, password,
56 sizeof(request.data.auth.user)-1);
58 wbc_status = wbcRequestResponse(WINBINDD_PAM_AUTH,
61 BAIL_ON_WBC_ERROR(wbc_status);