pam_LOCAL_domain.c revision 63be61852bd7ad1f74569843fb90629d63adb591
/*
SSSD
PAM e credentials
Copyright (C) Sumit Bose <sbose@redhat.com> 2009
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 <time.h>
#include <security/pam_modules.h>
#include "util/sha512crypt.h"
#include "providers/data_provider.h"
goto label; \
} \
} while(0)
goto label; \
} \
} while(0)
struct LOCAL_request {
struct tevent_context *ev;
struct sysdb_attrs *mod_attrs;
struct sysdb_handle *handle;
struct ldb_result *res;
int error;
struct pam_auth_req *preq;
};
{
}
{
struct LOCAL_request *lreq;
int ret;
if (ret) {
}
}
{
struct LOCAL_request);
struct tevent_req *subreq;
int ret;
if (ret) {
return prepare_reply(lreq);
}
if (!subreq) {
/* cancel transaction */
return prepare_reply(lreq);
}
}
{
struct LOCAL_request);
struct tevent_req *req;
int ret;
if (ret) {
goto fail;
}
if (!req) {
goto fail;
}
return;
fail:
/* cancel transaction */
}
{
struct tevent_req *req;
int ret;
if (!req) {
goto done;
}
return;
done:
}
{
struct tevent_req *req;
int ret;
int failedLoginAttempts;
/* TODO: maybe add more inteligent delay calculation */
0);
(long)failedLoginAttempts);
if (!req) {
goto done;
}
return;
done:
}
{
const char *disabled;
}
}
{
struct tevent_req *req;
int ret;
char *newauthtok;
char *salt;
char *new_hash;
if (strlen(newauthtok) == 0) {
/* TODO: should we allow null passwords via a config option ? */
goto done;
}
if (!req) {
goto done;
}
return;
done:
}
struct ldb_result *res)
{
struct LOCAL_request *lreq;
char *newauthtok = NULL;
int ret;
ldb_status));
goto done;
goto done;
}
goto done;
}
case SSS_PAM_AUTHENTICATE:
case SSS_PAM_CHAUTHTOK:
case SSS_PAM_CHAUTHTOK_PRELIM:
/* TODO: maybe this is a candiate for an explicit audit message. */
break;
}
pd->authtok_size);
return;
}
break;
}
case SSS_PAM_AUTHENTICATE:
return;
break;
case SSS_PAM_CHAUTHTOK:
return;
break;
case SSS_PAM_ACCT_MGMT:
return;
break;
case SSS_PAM_SETCRED:
break;
case SSS_PAM_OPEN_SESSION:
break;
case SSS_PAM_CLOSE_SESSION:
break;
case SSS_PAM_CHAUTHTOK_PRELIM:
break;
default:
}
done:
if (newauthtok != NULL)
}
{
int ret;
struct LOCAL_request *lreq;
static const char *attrs[] = {SYSDB_NAME,
"lastPasswordChange",
"accountExpires",
"passwordHint",
"passwordHistory",
NULL};
if (!lreq) {
return ENOMEM;
}
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return ret;
}
return ret;
}
return EOK;
}