sysdb_sudo.c revision db419c61035cb262010cc8d5a4047191c2b60f05
/*
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2011 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/>.
*/
#define _XOPEN_SOURCE
#include <talloc.h>
#include <time.h>
#include "db/sysdb_private.h"
#include "db/sysdb_sudo.h"
if (!val) { \
goto label; \
} \
} while(0)
/* ==================== Utility functions ==================== */
bool *result)
{
int i;
*result = false;
name = "<missing>";
goto done;
}
/*
* From man sudoers.ldap:
*
* A timestamp is in the form yyyymmddHHMMSSZ.
* If multiple sudoNotBefore entries are present, the *earliest* is used.
* If multiple sudoNotAfter entries are present, the *last one* is used.
*
* From sudo sources, ldap.c:
* If either the sudoNotAfter or sudoNotBefore attributes are missing,
* no time restriction shall be imposed.
*/
/* check for sudoNotBefore */
("notBefore attribute is missing, the rule [%s] is valid\n",
name));
*result = true;
goto done;
goto done;
}
for (i=0; values[i] ; i++) {
name));
goto done;
}
/* Grab the earliest */
if (!notBefore) {
}
}
/* check for sudoNotAfter */
("notAfter attribute is missing, the rule [%s] is valid\n",
name));
*result = true;
goto done;
goto done;
}
for (i=0; values[i] ; i++) {
name));
goto done;
}
/* Grab the latest */
if (!notAfter) {
}
}
*result = true;
}
done:
return ret;
}
struct sysdb_attrs **in_rules,
struct sysdb_attrs ***_rules)
{
bool allowed = false;
int i;
if (now == 0) {
}
for (i = 0; i < in_num_rules; i++) {
num_rules++;
}
}
*_num_rules = num_rules;
done:
return ret;
}
char **_filter)
{
char *specific_filter = NULL;
int i;
/* build specific filter */
if (flags & SYSDB_SUDO_FILTER_INCLUDE_ALL) {
}
if (flags & SYSDB_SUDO_FILTER_INCLUDE_DFL) {
}
username);
}
(unsigned long long) uid);
}
for (i=0; groupnames[i] != NULL; i++) {
groupnames[i]);
}
}
if (flags & SYSDB_SUDO_FILTER_NGRS) {
}
/* build global filter */
if (specific_filter[0] != '\0') {
}
done:
return ret;
}
char ***groupnames)
{
const char *attrs[3];
struct ldb_message *msg;
char **sysdb_groupnames = NULL;
struct ldb_message_element *groups;
int i;
attrs[0] = SYSDB_MEMBEROF;
goto done;
}
if (!uid) {
goto done;
}
/* No groups for this user in sysdb currently */
} else {
/* Get a list of the groups by groupname only */
for (i = 0; i < groups->num_values; i++) {
&sysdb_groupnames[i]);
goto done;
}
}
}
done:
return EOK;
}
static errno_t
struct sss_domain_info *domain,
const char *subdir)
{
goto done;
}
done:
return EOK;
}
const char *rule_name,
struct sysdb_attrs *attrs)
{
return ret;
}
return ret;
}
return ret;
}
return EOK;
}
struct sss_domain_info *domain,
const char *filter)
{
struct ldb_message **msgs;
const char *name;
int i;
const char *attrs[] = { SYSDB_OBJECTCLASS,
NULL };
/* just purge all if there's no filter */
if (!filter) {
}
/* match entries based on the filter and remove them one by one */
goto done;
goto done;
}
for (i = 0; i < count; i++) {
/* skip this one but still delete other entries */
continue;
}
goto done;
}
}
done:
return ret;
}
bool refreshed)
{
if (!tmp_ctx) {
goto done;
}
if (!dn) {
goto done;
}
done:
return ret;
}
bool *refreshed)
{
if (!tmp_ctx) {
goto done;
}
if (!dn) {
goto done;
}
done:
return ret;
}