sdap_access.c revision 57cd3443dcb7c073c5a00a9f2c3c3a3030ae2d3e
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen Stephen Gallagher <sgallagh@redhat.com>
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen Copyright (C) 2010 Red Hat
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen This program is free software; you can redistribute it and/or modify
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen it under the terms of the GNU General Public License as published by
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen the Free Software Foundation; either version 3 of the License, or
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen (at your option) any later version.
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen This program is distributed in the hope that it will be useful,
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen but WITHOUT ANY WARRANTY; without even the implied warranty of
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen GNU General Public License for more details.
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen 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 <talloc.h>
#include <tevent.h>
#include <errno.h>
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_access.h"
#include "providers/ldap/sdap_async.h"
#include "providers/data_provider.h"
#include "providers/dp_backend.h"
const char *username,
struct sdap_access_req_ctx {
struct tevent_req *
return NULL;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
return req;
done:
return req;
case LDAP_ACCESS_EMPTY:
return EOK;
case LDAP_ACCESS_FILTER:
return ENOMEM;
return EAGAIN;
case LDAP_ACCESS_EXPIRE:
case LDAP_ACCESS_SERVICE:
case LDAP_ACCESS_HOST:
return ret;
switch (ret) {
case EAGAIN:
case EOK:
return EOK;
int ret;
const char *val;
long sp_expire;
long today;
return EOK;
return ret;
sizeof(SHADOW_EXPIRE_MSG),
return ERR_ACCOUNT_EXPIRED;
return EOK;
int err;
int ret;
sizeof(AD_DISABLE_MESSAGE),
return ERR_ACCESS_DENIED;
sizeof(AD_EXPIRED_MESSAGE),
return ERR_ACCOUNT_EXPIRED;
return EOK;
bool locked;
int ret;
if (locked) {
sizeof(RHDS_LOCK_MSG),
return ERR_ACCESS_DENIED;
return EOK;
char *end;
exp_time_str));
tzset();
div_t q;
if (q.rem > 0) {
bool locked = true;
int ret;
const char *exp_time_str;
if (locked) {
sizeof(NDS_DISABLE_MSG),
return ERR_ACCESS_DENIED;
NULL);
if (locked) {
sizeof(NDS_EXPIRED_MSG),
return ERR_ACCESS_DENIED;
if (locked) {
sizeof(NDS_TIME_MAP_MSG),
return ERR_ACCESS_DENIED;
return EOK;
const char *expire;
int ret;
return ERR_ACCESS_DENIED;
return ret;
struct sdap_access_filter_req_ctx {
const char *username;
const char *filter;
bool cached_access;
char *basedn;
const char *username,
const char *basedn;
char *clean_username;
return NULL;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
return req;
done:
return req;
return EOK;
return ERR_ACCESS_DENIED;
int ret;
if (!subreq) {
return ret;
return EOK;
struct tevent_req);
NULL, 0,
bool found = false;
goto done;
found = false;
goto done;
goto done;
found = true;
if (found) {
goto done;
goto done;
goto done;
done:
return EOK;
char *service;
sizeof(AUTHR_SRV_MISSING_MSG),
return ERR_ACCESS_DENIED;
sizeof(AUTHR_SRV_DENY_MSG),
return ERR_ACCESS_DENIED;
sizeof(AUTHR_SRV_NO_MATCH_MSG),
return ret;
char *host;
return ERR_ACCESS_DENIED;
return ERR_ACCESS_DENIED;
return ERR_ACCESS_DENIED;
return ret;