ipa_auth.c revision a530a96721d8106a6839b6b643b0abc5d7a7b9e0
/*
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_common.h"
#define IPA_CONFIG_MIRATION_ENABLED "ipaMigrationEnabled"
#define IPA_CONFIG_SEARCH_BASE_TEMPLATE "cn=etc,%s"
#define IPA_CONFIG_FILTER "(&(cn=ipaConfig)(objectClass=ipaGuiConfig))"
{
}
struct get_password_migration_flag_state {
struct tevent_context *ev;
struct sdap_auth_ctx *sdap_auth_ctx;
struct sdap_handle *sh;
enum sdap_result result;
char *ipa_domain;
bool password_migration;
};
struct tevent_context *ev,
struct sdap_auth_ctx *sdap_auth_ctx,
char *ipa_domain)
{
int ret;
struct get_password_migration_flag_state *state;
return NULL;
}
struct get_password_migration_flag_state);
return NULL;
}
state->password_migration = false;
/* We request to use StartTLS here, because if password migration is
* enabled we will use this connection for authentication, too. */
goto fail;
}
true);
goto fail;
}
req);
return req;
fail:
return NULL;
}
{
struct tevent_req);
struct get_password_migration_flag_state);
int ret;
char *ldap_basedn;
char *search_base;
const char **attrs;
if (ret) {
return;
}
return;
}
if (search_base == NULL) {
return;
}
return;
}
if (!subreq) {
return;
}
}
{
struct tevent_req);
struct get_password_migration_flag_state);
int ret;
if (ret) {
return;
}
if (reply_count != 1) {
reply_count));
return;
}
state->password_migration = true;
}
}
bool *password_migration,
struct sdap_handle **sh)
{
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;
}
IPA_DOMAIN));
goto done;
}
return;
}
done:
}
{
struct ipa_auth_state);
int ret;
int dp_err = DP_ERR_FATAL;
const char **attrs;
struct ldb_message *user_msg;
const char *dn;
struct dp_opt_blob password;
goto done;
}
if (state->password_migration) {
"starting password migration.\n"));
goto done;
}
attrs[0] = SYSDB_ORIG_DN;
goto done;
}
goto done;
}
"password", password);
goto done;
}
return;
} else {
}
done:
}
{
struct ipa_auth_state);
int ret;
int dp_err = DP_ERR_FATAL;
enum sdap_result result;
goto done;
}
/* TODO: do we need to handle expired passwords? */
if (result != SDAP_AUTH_SUCCESS) {
"Password migration not possible.\n"));
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:
}