sysdb_sudo.c revision 3f98cdc011bb4e8cd22c088f288b0bcdb6452492
/*
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/>.
*/
#include <talloc.h>
#include "db/sysdb_sudo.h"
if (!val) { \
goto label; \
} \
} while(0)
/* ==================== Utility functions ==================== */
static char *
{
char timebuffer[64];
/* Make sure we have a formatted timestamp for __now__. */
return NULL;
}
/* Format the timestamp according to the RFC. */
return NULL;
}
"(|(!(%s=*))(%s<=%s)))",
}
char **_filter)
{
char *filter;
char *t;
int i;
/* AND with objectclass */
/* And with the timed rules if requested */
if (flags & SYSDB_SUDO_FILTER_TIMED) {
t = get_sudo_time_filter(filter);
talloc_free(t);
}
/* Add global OR and the username */
username);
if (uid) {
(unsigned long long) uid);
}
if (groupnames) {
for (i=0; groupnames[i]; i++) {
groupnames[i]);
}
}
if (flags & SYSDB_SUDO_FILTER_NGRS) {
}
if (flags & SYSDB_SUDO_FILTER_INCLUDE_ALL) {
}
if (flags & SYSDB_SUDO_FILTER_INCLUDE_DFL) {
}
/* end the global AND and OR filters */
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 {
if (!sysdb_groupnames) {
goto done;
}
/* 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;
}
goto done;
}
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
/* 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++) {
goto done;
}
goto done;
}
}
done:
return ret;
}