Go to the documentation of this file.
44 #include <sasl/sasl.h>
49 #define APP_NAME_SASL "basic_sasl_auth"
55 char *username, *password;
56 #if SASL_VERSION_MAJOR < 2
61 sasl_conn_t *conn =
nullptr;
64 setvbuf(stdout,
nullptr, _IOLBF, 0);
68 if ( rc != SASL_OK ) {
69 fprintf(stderr,
"FATAL: %d %s\n", rc, sasl_errstring(rc,
nullptr,
nullptr ));
73 #if SASL_VERSION_MAJOR < 2
74 rc = sasl_server_new(
APP_NAME_SASL,
nullptr,
nullptr,
nullptr, 0, &conn );
76 rc = sasl_server_new(
APP_NAME_SASL,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, 0, &conn );
79 if ( rc != SASL_OK ) {
80 fprintf(stderr,
"FATAL: %d %s\n", rc, sasl_errstring(rc,
nullptr,
nullptr ));
86 password = strchr( line,
'\n' );
88 debug(
"ERROR: %s: Unexpected input '%s'\n", argv[0], line);
93 password = strchr ( line,
' ' );
95 debug(
"ERROR: %s: Unexpected input '%s' (no password)\n", argv[0], line );
105 #if SASL_VERSION_MAJOR < 2
106 rc = sasl_checkpass(conn, username, strlen(username), password, strlen(password), &
errstr);
108 rc = sasl_checkpass(conn, username, strlen(username), password, strlen(password));
111 if ( rc != SASL_OK ) {
112 #if SASL_VERSION_MAJOR < 2
116 if ( rc != SASL_BADAUTH ) {
117 debug(
"ERROR: %d %s\n", rc, sasl_errstring(rc,
nullptr,
nullptr));
118 SEND_ERR(sasl_errstring(rc,
nullptr,
nullptr));
void debug(const char *format,...)
void rfc1738_unescape(char *url)
#define HELPER_INPUT_BUFFER
int main(int, char *argv[])