ipa_auth.c revision 5cd4414fce1e0eb4133dfc6fc828bf25c8a959f9
/*
SSSD
IPA Backend Module -- Authentication
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <security/pam_modules.h>
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async.h"
#include "providers/krb5/krb5_auth.h"
#include "providers/ipa/ipa_auth.h"
#include "providers/ipa/ipa_common.h"
#include "providers/ipa/ipa_config.h"
struct get_password_migration_flag_state {
struct tevent_context *ev;
struct sdap_id_op *sdap_op;
struct sdap_id_ctx *sdap_id_ctx;
char *ipa_realm;
bool password_migration;
};
struct tevent_context *ev,
struct sdap_id_ctx *sdap_id_ctx,
char *ipa_realm)
{
int ret;
struct get_password_migration_flag_state *state;
return NULL;
}
struct get_password_migration_flag_state);
return NULL;
}
state->password_migration = false;
goto fail;
}
if (!subreq) {
goto fail;
}
return req;
fail:
return NULL;
}
{
struct tevent_req);
struct get_password_migration_flag_state);
if (ret) {
if (dp_error == DP_ERR_OFFLINE) {
("No IPA server is available, cannot get the "
"migration flag while offline\n"));
} else {
("Failed to connect to IPA server: [%d](%s)\n",
}
return;
}
}
{
struct tevent_req);
struct get_password_migration_flag_state);
int ret;
if (ret) {
goto done;
}
state->password_migration = true;
}
done:
} else {
}
}
bool *password_migration)
{
struct get_password_migration_flag_state);
return EOK;
}
struct ipa_auth_state {
struct tevent_context *ev;
struct ipa_auth_ctx *ipa_auth_ctx;
bool password_migration;
struct sdap_handle *sh;
};
{
struct tevent_req *req;
struct ipa_auth_state *state;
goto fail;
}
state->password_migration = false;
case SSS_PAM_AUTHENTICATE:
struct ipa_auth_ctx);
break;
case SSS_PAM_CHAUTHTOK:
case SSS_PAM_CHAUTHTOK_PRELIM:
struct ipa_auth_ctx);
break;
default:
goto fail;
}
goto fail;
}
return;
fail:
}
{
struct ipa_auth_state);
int ret;
int pam_status = PAM_SYSTEM_ERR;
int dp_err;
goto done;
}
goto done;
}
("get_password_migration_flag failed.\n"));
goto done;
}
return;
}
done:
}
{
struct ipa_auth_state);
int ret;
int dp_err = DP_ERR_FATAL;
"request failed.\n"));
goto done;
}
if (state->password_migration) {
true, CON_TLS_ON, true);
goto done;
}
return;
}
done:
}
{
struct ipa_auth_state);
const char **attrs;
struct ldb_message *user_msg;
const char *dn;
int dp_err = DP_ERR_FATAL;
int ret;
("Cannot connect to LDAP server to perform migration\n"));
goto done;
}
"starting password migration.\n"));
goto done;
}
attrs[0] = SYSDB_ORIG_DN;
goto done;
}
goto done;
}
goto done;
}
return;
done:
}
{
struct ipa_auth_state);
int ret;
int dp_err = DP_ERR_FATAL;
switch (ret) {
case EOK:
break;
case ERR_AUTH_DENIED:
case ERR_AUTH_FAILED:
case ERR_PASSWORD_EXPIRED:
/* TODO: do we need to handle expired passwords? */
"Password migration not possible.\n"));
goto done;
default:
goto done;
}
"trying Kerberos authentication again.\n"));
goto done;
}
return;
done:
}
{
struct ipa_auth_state);
int ret;
int pam_status;
int dp_err;
goto done;
}
done:
}