diff options
author | Sumit Bose <sbose@redhat.com> | 2010-02-08 09:25:53 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-02-10 08:46:48 -0500 |
commit | 3a4aa5e5006decc100a2d8f2db54c46b482afd7c (patch) | |
tree | 273e3e311e04aa7b090dd51db264b130deba34af /server/responder/pam | |
parent | c56dde8fd199071ef2674d287162404b4f1b545e (diff) | |
download | sssd-3a4aa5e5006decc100a2d8f2db54c46b482afd7c.tar.gz sssd-3a4aa5e5006decc100a2d8f2db54c46b482afd7c.tar.bz2 sssd-3a4aa5e5006decc100a2d8f2db54c46b482afd7c.zip |
Send a message to the user if the login is delayed
Diffstat (limited to 'server/responder/pam')
-rw-r--r-- | server/responder/pam/pamsrv_cmd.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/server/responder/pam/pamsrv_cmd.c b/server/responder/pam/pamsrv_cmd.c index a4573e60..3172a97d 100644 --- a/server/responder/pam/pamsrv_cmd.c +++ b/server/responder/pam/pamsrv_cmd.c @@ -626,18 +626,22 @@ static void pam_cache_auth_done(struct tevent_req *req) int ret; struct pam_auth_req *preq = tevent_req_callback_data(req, struct pam_auth_req); - const uint32_t resp_type = SSS_PAM_USER_INFO_OFFLINE_AUTH; - const size_t resp_len = sizeof(uint32_t) + sizeof(long long); + uint32_t resp_type; + size_t resp_len; uint8_t *resp; time_t expire_date = 0; + time_t delayed_until = -1; long long dummy; - ret = sysdb_cache_auth_recv(req, &expire_date); + ret = sysdb_cache_auth_recv(req, &expire_date, &delayed_until); talloc_zfree(req); switch (ret) { case EOK: preq->pd->pam_status = PAM_SUCCESS; + + resp_type = SSS_PAM_USER_INFO_OFFLINE_AUTH; + resp_len = sizeof(uint32_t) + sizeof(long long); resp = talloc_size(preq->pd, resp_len); if (resp == NULL) { DEBUG(1, ("talloc_size failed, cannot prepare user info.\n")); @@ -660,6 +664,23 @@ static void pam_cache_auth_done(struct tevent_req *req) break; case EACCES: preq->pd->pam_status = PAM_PERM_DENIED; + if (delayed_until >= 0) { + resp_type = SSS_PAM_USER_INFO_OFFLINE_AUTH_DELAYED; + resp_len = sizeof(uint32_t) + sizeof(long long); + resp = talloc_size(preq->pd, resp_len); + if (resp == NULL) { + DEBUG(1, ("talloc_size failed, cannot prepare user info.\n")); + } else { + memcpy(resp, &resp_type, sizeof(uint32_t)); + dummy = (long long) delayed_until; + memcpy(resp+sizeof(uint32_t), &dummy, sizeof(long long)); + ret = pam_add_response(preq->pd, SSS_PAM_USER_INFO, resp_len, + (const uint8_t *) resp); + if (ret != EOK) { + DEBUG(1, ("pam_add_response failed.\n")); + } + } + } break; default: preq->pd->pam_status = PAM_SYSTEM_ERR; |