pamsrv_cmd.c revision 544a20de7667f05c1a406c4dea0706b0ab507430
45e9809aff7304721fddb95654901b32195c9c7avboxsync PAM Responder
45e9809aff7304721fddb95654901b32195c9c7avboxsync Copyright (C) Simo Sorce <ssorce@redhat.com> 2009
45e9809aff7304721fddb95654901b32195c9c7avboxsync Copyright (C) Sumit Bose <sbose@redhat.com> 2009
45e9809aff7304721fddb95654901b32195c9c7avboxsync This program is free software; you can redistribute it and/or modify
45e9809aff7304721fddb95654901b32195c9c7avboxsync it under the terms of the GNU General Public License as published by
45e9809aff7304721fddb95654901b32195c9c7avboxsync the Free Software Foundation; either version 3 of the License, or
45e9809aff7304721fddb95654901b32195c9c7avboxsync (at your option) any later version.
45e9809aff7304721fddb95654901b32195c9c7avboxsync This program is distributed in the hope that it will be useful,
45e9809aff7304721fddb95654901b32195c9c7avboxsync but WITHOUT ANY WARRANTY; without even the implied warranty of
45e9809aff7304721fddb95654901b32195c9c7avboxsync MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45e9809aff7304721fddb95654901b32195c9c7avboxsync GNU General Public License for more details.
45e9809aff7304721fddb95654901b32195c9c7avboxsync You should have received a copy of the GNU General Public License
45e9809aff7304721fddb95654901b32195c9c7avboxsync along with this program. If not, see <http://www.gnu.org/licenses/>.
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DEFAULT_PAM_VERBOSITY PAM_VERBOSITY_IMPORTANT
45e9809aff7304721fddb95654901b32195c9c7avboxsyncpam_null_last_online_auth_with_curr_token(struct sss_domain_info *domain,
45e9809aff7304721fddb95654901b32195c9c7avboxsync const char *username);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncpam_get_last_online_auth_with_curr_token(struct sss_domain_info *domain,
45e9809aff7304721fddb95654901b32195c9c7avboxsync const char *name,
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic errno_t pack_user_info_account_expired(TALLOC_CTX *mem_ctx,
size_t p;
return ENOMEM;
if (p != *resp_len) {
return EOK;
const char *pam_message)
size_t *c)
switch (auth_token_type) {
case SSS_AUTHTOK_TYPE_EMPTY:
if (auth_token_length == 0) {
case SSS_AUTHTOK_TYPE_2FA:
case SSS_AUTHTOK_TYPE_SC_PIN:
return EINVAL;
*c += auth_token_length;
return ret;
size_t *c) {
return EINVAL;
*c += size;
return EOK;
return EINVAL;
return EOK;
const char *name;
if (!name) {
return EIO;
return EOK;
size_t c;
int ret;
char *requested_domains;
return EINVAL;
return EINVAL;
c = sizeof(uint32_t);
return EINVAL;
switch(type) {
case SSS_PAM_ITEM_USER:
case SSS_PAM_ITEM_SERVICE:
case SSS_PAM_ITEM_TTY:
case SSS_PAM_ITEM_RUSER:
case SSS_PAM_ITEM_RHOST:
NULL);
return ret;
case SSS_PAM_ITEM_CLI_PID:
case SSS_PAM_ITEM_AUTHTOK:
case SSS_PAM_ITEM_NEWAUTHTOK:
c += size;
} while(c < blen);
return EOK;
int ret;
return ret;
return EINVAL;
return EOK;
switch (auth_token_type) {
case SSS_AUTHTOK_TYPE_EMPTY:
return EINVAL;
*c += auth_token_length;
return ret;
int ret;
end = 0;
if (ret) {
return ret;
if (ret) {
return ret;
return EOK;
if (!attrs) {
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
return EOK;
fail:
return ret;
int ret;
int pam_verbosity;
return EINVAL;
switch (user_info_type) {
return EINVAL;
sizeof(int64_t));
if ((expire_date == 0 &&
(expire_date > 0 &&
return EOK;
const char **password)
int ret;
const char *fa2;
case SSS_AUTHTOK_TYPE_2FA:
return ret;
return EOK;
int ret;
char* pam_account_expired_message;
int pam_verbosity;
case SSS_PAM_AUTHENTICATE:
bool use_cached_auth;
goto done;
goto done;
case SSS_PAM_CHAUTHTOK_PRELIM:
case SSS_PAM_CHAUTHTOK:
goto done;
case SSS_PAM_SETCRED:
case SSS_PAM_ACCT_MGMT:
case SSS_PAM_OPEN_SESSION:
case SSS_PAM_CLOSE_SESSION:
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
resp_c = 0;
resp_size = 0;
resp_c++;
sizeof(int32_t) +
goto done;
p += sizeof(int32_t);
p += sizeof(int32_t);
p += sizeof(int32_t);
p += sizeof(int32_t);
done:
bool use_cached_auth)
case PAM_SUCCESS:
case PAM_PERM_DENIED:
if (delayed_until >= 0) {
case PAM_AUTH_ERR:
if (use_cached_auth) {
NULL);
goto done;
goto done;
goto done;
done:
return ret;
size_t i;
if (uid == 0) {
if (trusted_uids_count == 0) {
for(i = 0; i < trusted_uids_count; i++) {
char **public_dom_names,
size_t i;
for(i=0; i < public_dom_names_count; i++) {
int p11_child_timeout;
char *cert_verification_opts;
return ret;
return ret;
return ENOMEM;
return EAGAIN;
int ret;
if (!preq) {
return ENOMEM;
return ENOMEM;
goto done;
goto done;
goto done;
goto done;
dom;
if (!dom) {
goto done;
goto done;
goto done;
done:
struct pam_auth_req);
char *cert;
goto done;
goto done;
goto done;
done:
int ret;
struct pam_auth_req);
const char *cert_user;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
struct pam_auth_req);
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
int ret;
while (dom) {
if (!dom) break;
if (!name) {
return ENOMEM;
return ENOMEM;
return EIO;
return EFAULT;
return ENOENT;
return EIO;
return ENOENT;
SYSDB_CACHE_EXPIRE, 0);
return ret;
return EOK;
if (!dom) {
if (!dpreq) {
return ENOMEM;
if(!cb_ctx) {
return ENOMEM;
return EAGAIN;
return ENOENT;
char *err_msg;
&err_msg);
switch (ret) {
case EOK:
case EAGAIN:
case ENOENT:
case ERR_NO_CREDS:
return EOK;
int ret;
if (err_maj) {
if (ret) {
const char* user,
int cached_auth_timeout,
bool *_result)
bool result;
goto done;
done:
return ret;
bool is_cachable;
switch(cmd) {
case SSS_PAM_AUTHENTICATE:
is_cachable = true;
is_cachable = false;
return is_cachable;
bool cachable = false;
cachable = true;
return cachable;
int pam_cmd,
const char* user,
bool cached_auth_failed)
bool result = false;
&result);
return result;
int ret;
const char *cert_user;
NULL);
return pam_cli_protocol_version;
return sss_cmds;
const char *username,
int ret;
goto done;
goto done;
value);
done:
return ret;
static errno_t
const char *username)
static errno_t
const char *name,
goto done;
goto done;
goto done;
goto done;
done:
return ret;