passdb.c revision ba3a54872528db0eae3f36e45592219965b9faf8
76b43e4417bab52e913da39b5f5bc2a130d3f149Timo Sirainen/* Copyright (C) 2002-2003 Timo Sirainen */
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainenextern struct passdb_module passdb_passwd_file;
7ca2a9f1cca63cbc2ebffc185c7e5a2b32bc2780Timo Sirainenextern struct passdb_module passdb_checkpassword;
b87436ebb957a9eb182be72ba00e2c8eae59a2e4Timo Sirainenstatic const char *
b87436ebb957a9eb182be72ba00e2c8eae59a2e4Timo Sirainenpassdb_credentials_to_str(enum passdb_credentials credentials)
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen return "PLAIN";
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainen return "CRYPT";
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainen return "HMAC-MD5";
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen return "DIGEST-MD5";
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen return "LANMAN";
8a1c866a4c429f26c8746525f82024bc387f1407Timo Sirainen return "NTLM";
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen return "RPA";
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainenvoid passdb_handle_credentials(enum passdb_result result,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen if (credentials == PASSDB_CREDENTIALS_CRYPT) {
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen /* anything goes */
3fe44a0df5a0bdd80c495f79cbf0e384441d6fccTimo Sirainen password = t_strdup_printf("{%s}%s", scheme, password);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen wanted_scheme = passdb_credentials_to_str(credentials);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen "scheme, but we have only %s",
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen /* we can generate anything out of plaintext passwords */
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen password = password_generate(password, auth_request->user,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen callback(PASSDB_RESULT_OK, password, auth_request);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainenvoid passdb_preinit(struct auth *auth, const char *data)
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen auth->passdb_module = auth->passdb != NULL ? NULL :