1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2015 */
6 /* Copyright (c) The Exim Maintainers 2020 */
7 /* See the file NOTICE for conditions of use and distribution. */
8 /* SPDX-License-Identifier: GPL-2.0-only */
10 /* This module contains interface functions to the two Cyrus authentication
11 daemons. The original one was "pwcheck", which gives its name to the source
12 file. This is now deprecated in favour of "saslauthd". */
19 /*************************************************
20 * External entry point for pwcheck *
21 *************************************************/
23 /* This function calls the now-deprecated "pwcheck" Cyrus-SASL authentication
24 daemon, passing over a colon-separated user name and password. As this is
25 called from the string expander, the string will always be in dynamic store and
29 s a colon-separated username:password string
30 errptr where to point an error message
32 Returns: OK if authentication succeeded
33 FAIL if authentication failed
34 ERROR some other error condition
38 auth_call_pwcheck(uschar *s, uschar **errptr)
41 uschar *pw = Ustrrchr(s, ':');
45 *errptr = US"pwcheck: malformed input - missing colon";
49 *pw++ = 0; /* Separate user and password */
52 debug_printf("Running pwcheck authentication for user \"%s\"\n", s);
54 switch (pwcheck_verify_password(CS s, CS pw, CCSS &reply))
57 DEBUG(D_auth) debug_printf("pwcheck: success (%s)\n", reply);
61 DEBUG(D_auth) debug_printf("pwcheck: access denied (%s)\n", reply);
65 DEBUG(D_auth) debug_printf("pwcheck: query failed (%s)\n", reply);
72 /*************************************************
73 * External entry point for pwauthd *
74 *************************************************/
76 /* This function calls the "saslauthd" Cyrus-SASL authentication daemon,
77 saslauthd, As this is called from the string expander, all the strings will
78 always be in dynamic store and can be overwritten.
83 service optional service
85 errptr where to point an error message
87 Returns: OK if authentication succeeded
88 FAIL if authentication failed
89 ERROR some other error condition
93 auth_call_saslauthd(const uschar *username, const uschar *password,
94 const uschar *service, const uschar *realm, uschar **errptr)
98 if (service == NULL) service = US"";
99 if (realm == NULL) realm = US"";
102 debug_printf("Running saslauthd authentication for user \"%s\" \n", username);
104 switch (saslauthd_verify_password(username, password, service,
105 realm, (const uschar **)(&reply)))
108 DEBUG(D_auth) debug_printf("saslauthd: success (%s)\n", reply);
112 DEBUG(D_auth) debug_printf("saslauthd: access denied (%s)\n", reply);
116 DEBUG(D_auth) debug_printf("saslauthd: query failed (%s)\n", reply);
122 /* End of call_pwcheck.c */