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. */
9 /* This module contains interface functions to the two Cyrus authentication
10 daemons. The original one was "pwcheck", which gives its name to the source
11 file. This is now deprecated in favour of "saslauthd". */
18 /*************************************************
19 * External entry point for pwcheck *
20 *************************************************/
22 /* This function calls the now-deprecated "pwcheck" Cyrus-SASL authentication
23 daemon, passing over a colon-separated user name and password. As this is
24 called from the string expander, the string will always be in dynamic store and
28 s a colon-separated username:password string
29 errptr where to point an error message
31 Returns: OK if authentication succeeded
32 FAIL if authentication failed
33 ERROR some other error condition
37 auth_call_pwcheck(uschar *s, uschar **errptr)
40 uschar *pw = Ustrrchr(s, ':');
44 *errptr = US"pwcheck: malformed input - missing colon";
48 *pw++ = 0; /* Separate user and password */
51 debug_printf("Running pwcheck authentication for user \"%s\"\n", s);
53 switch (pwcheck_verify_password(CS s, CS pw, CCSS &reply))
56 DEBUG(D_auth) debug_printf("pwcheck: success (%s)\n", reply);
60 DEBUG(D_auth) debug_printf("pwcheck: access denied (%s)\n", reply);
64 DEBUG(D_auth) debug_printf("pwcheck: query failed (%s)\n", reply);
71 /*************************************************
72 * External entry point for pwauthd *
73 *************************************************/
75 /* This function calls the "saslauthd" Cyrus-SASL authentication daemon,
76 saslauthd, As this is called from the string expander, all the strings will
77 always be in dynamic store and can be overwritten.
82 service optional service
84 errptr where to point an error message
86 Returns: OK if authentication succeeded
87 FAIL if authentication failed
88 ERROR some other error condition
92 auth_call_saslauthd(const uschar *username, const uschar *password,
93 const uschar *service, const uschar *realm, uschar **errptr)
97 if (service == NULL) service = US"";
98 if (realm == NULL) realm = US"";
101 debug_printf("Running saslauthd authentication for user \"%s\" \n", username);
103 switch (saslauthd_verify_password(username, password, service,
104 realm, (const uschar **)(&reply)))
107 DEBUG(D_auth) debug_printf("saslauthd: success (%s)\n", reply);
111 DEBUG(D_auth) debug_printf("saslauthd: access denied (%s)\n", reply);
115 DEBUG(D_auth) debug_printf("saslauthd: query failed (%s)\n", reply);
121 /* End of call_pwcheck.c */