1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2015 */
6 /* See the file NOTICE for conditions of use and distribution. */
8 /* This module contains interface functions to the two Cyrus authentication
9 daemons. The original one was "pwcheck", which gives its name to the source
10 file. This is now deprecated in favour of "saslauthd". */
17 /*************************************************
18 * External entry point for pwcheck *
19 *************************************************/
21 /* This function calls the now-deprecated "pwcheck" Cyrus-SASL authentication
22 daemon, passing over a colon-separated user name and password. As this is
23 called from the string expander, the string will always be in dynamic store and
27 s a colon-separated username:password string
28 errptr where to point an error message
30 Returns: OK if authentication succeeded
31 FAIL if authentication failed
32 ERROR some other error condition
36 auth_call_pwcheck(uschar *s, uschar **errptr)
39 uschar *pw = Ustrrchr(s, ':');
43 *errptr = US"pwcheck: malformed input - missing colon";
47 *pw++ = 0; /* Separate user and password */
50 debug_printf("Running pwcheck authentication for user \"%s\"\n", s);
52 switch (pwcheck_verify_password(CS s, CS pw, CCSS &reply))
55 DEBUG(D_auth) debug_printf("pwcheck: success (%s)\n", reply);
59 DEBUG(D_auth) debug_printf("pwcheck: access denied (%s)\n", reply);
63 DEBUG(D_auth) debug_printf("pwcheck: query failed (%s)\n", reply);
70 /*************************************************
71 * External entry point for pwauthd *
72 *************************************************/
74 /* This function calls the "saslauthd" Cyrus-SASL authentication daemon,
75 saslauthd, As this is called from the string expander, all the strings will
76 always be in dynamic store and can be overwritten.
81 service optional service
83 errptr where to point an error message
85 Returns: OK if authentication succeeded
86 FAIL if authentication failed
87 ERROR some other error condition
91 auth_call_saslauthd(const uschar *username, const uschar *password,
92 const uschar *service, const uschar *realm, uschar **errptr)
96 if (service == NULL) service = US"";
97 if (realm == NULL) realm = US"";
100 debug_printf("Running saslauthd authentication for user \"%s\" \n", username);
102 switch (saslauthd_verify_password(username, password, service,
103 realm, (const uschar **)(&reply)))
106 DEBUG(D_auth) debug_printf("saslauthd: success (%s)\n", reply);
110 DEBUG(D_auth) debug_printf("saslauthd: access denied (%s)\n", reply);
114 DEBUG(D_auth) debug_printf("saslauthd: query failed (%s)\n", reply);
120 /* End of call_pwcheck.c */