Introduce new_member_all() for code that doesn't include gram.h.
The ldap and sssd back-ends no longer require gram.h which fixes a compilation issue with IBM LDAP.
This commit is contained in:
@@ -3216,6 +3216,16 @@ new_member(char *name, int type)
|
|||||||
debug_return_ptr(m);
|
debug_return_ptr(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Like new_member() but uses ALL for the type.
|
||||||
|
* Used by the ldap and sssd back-ends, which don't include gram.h.
|
||||||
|
*/
|
||||||
|
struct member *
|
||||||
|
new_member_all(char *name)
|
||||||
|
{
|
||||||
|
return new_member(name, ALL);
|
||||||
|
}
|
||||||
|
|
||||||
static struct sudo_command *
|
static struct sudo_command *
|
||||||
new_command(char *cmnd, char *args)
|
new_command(char *cmnd, char *args)
|
||||||
{
|
{
|
||||||
|
@@ -1136,6 +1136,16 @@ new_member(char *name, int type)
|
|||||||
debug_return_ptr(m);
|
debug_return_ptr(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Like new_member() but uses ALL for the type.
|
||||||
|
* Used by the ldap and sssd back-ends, which don't include gram.h.
|
||||||
|
*/
|
||||||
|
struct member *
|
||||||
|
new_member_all(char *name)
|
||||||
|
{
|
||||||
|
return new_member(name, ALL);
|
||||||
|
}
|
||||||
|
|
||||||
static struct sudo_command *
|
static struct sudo_command *
|
||||||
new_command(char *cmnd, char *args)
|
new_command(char *cmnd, char *args)
|
||||||
{
|
{
|
||||||
|
@@ -66,7 +66,6 @@
|
|||||||
#include "sudo_ldap.h"
|
#include "sudo_ldap.h"
|
||||||
#include "sudo_ldap_conf.h"
|
#include "sudo_ldap_conf.h"
|
||||||
#include "sudo_dso.h"
|
#include "sudo_dso.h"
|
||||||
#include <gram.h>
|
|
||||||
|
|
||||||
#ifndef LDAP_OPT_RESULT_CODE
|
#ifndef LDAP_OPT_RESULT_CODE
|
||||||
# define LDAP_OPT_RESULT_CODE LDAP_OPT_ERROR_NUMBER
|
# define LDAP_OPT_RESULT_CODE LDAP_OPT_ERROR_NUMBER
|
||||||
@@ -1257,9 +1256,8 @@ ldap_to_sudoers(LDAP *ld, struct ldap_result *lres,
|
|||||||
TAILQ_INSERT_TAIL(ldap_userspecs, us, entries);
|
TAILQ_INSERT_TAIL(ldap_userspecs, us, entries);
|
||||||
|
|
||||||
/* The user has already matched, use ALL as wildcard. */
|
/* The user has already matched, use ALL as wildcard. */
|
||||||
if ((m = calloc(1, sizeof(*m))) == NULL)
|
if ((m = new_member_all(NULL)) == NULL)
|
||||||
goto oom;
|
goto oom;
|
||||||
m->type = ALL;
|
|
||||||
TAILQ_INSERT_TAIL(&us->users, m, entries);
|
TAILQ_INSERT_TAIL(&us->users, m, entries);
|
||||||
|
|
||||||
/* Treat each entry as a separate privilege. */
|
/* Treat each entry as a separate privilege. */
|
||||||
|
@@ -409,9 +409,8 @@ sudo_ldap_role_to_priv(const char *cn, void *hosts, void *runasusers,
|
|||||||
|
|
||||||
if (hosts == NULL) {
|
if (hosts == NULL) {
|
||||||
/* The host has already matched, use ALL as wildcard. */
|
/* The host has already matched, use ALL as wildcard. */
|
||||||
if ((m = calloc(1, sizeof(*m))) == NULL)
|
if ((m = new_member_all(NULL)) == NULL)
|
||||||
goto oom;
|
goto oom;
|
||||||
m->type = ALL;
|
|
||||||
TAILQ_INSERT_TAIL(&priv->hostlist, m, entries);
|
TAILQ_INSERT_TAIL(&priv->hostlist, m, entries);
|
||||||
} else {
|
} else {
|
||||||
char *host;
|
char *host;
|
||||||
|
@@ -310,6 +310,7 @@ void alias_put(struct alias *a);
|
|||||||
/* gram.c */
|
/* gram.c */
|
||||||
extern struct sudoers_parse_tree parsed_policy;
|
extern struct sudoers_parse_tree parsed_policy;
|
||||||
bool init_parser(const char *path, bool quiet, bool strict);
|
bool init_parser(const char *path, bool quiet, bool strict);
|
||||||
|
struct member *new_member_all(char *name);
|
||||||
void free_member(struct member *m);
|
void free_member(struct member *m);
|
||||||
void free_members(struct member_list *members);
|
void free_members(struct member_list *members);
|
||||||
void free_privilege(struct privilege *priv);
|
void free_privilege(struct privilege *priv);
|
||||||
|
@@ -43,7 +43,6 @@
|
|||||||
#include "sudo_lbuf.h"
|
#include "sudo_lbuf.h"
|
||||||
#include "sudo_ldap.h"
|
#include "sudo_ldap.h"
|
||||||
#include "sudo_dso.h"
|
#include "sudo_dso.h"
|
||||||
#include <gram.h>
|
|
||||||
|
|
||||||
/* SSSD <--> SUDO interface - do not change */
|
/* SSSD <--> SUDO interface - do not change */
|
||||||
struct sss_sudo_attr {
|
struct sss_sudo_attr {
|
||||||
@@ -371,9 +370,8 @@ sss_to_sudoers(struct sudo_sss_handle *handle,
|
|||||||
TAILQ_INSERT_TAIL(&handle->parse_tree.userspecs, us, entries);
|
TAILQ_INSERT_TAIL(&handle->parse_tree.userspecs, us, entries);
|
||||||
|
|
||||||
/* We only include rules where the user matches. */
|
/* We only include rules where the user matches. */
|
||||||
if ((m = calloc(1, sizeof(*m))) == NULL)
|
if ((m = new_member_all(NULL)) == NULL)
|
||||||
goto oom;
|
goto oom;
|
||||||
m->type = ALL;
|
|
||||||
TAILQ_INSERT_TAIL(&us->users, m, entries);
|
TAILQ_INSERT_TAIL(&us->users, m, entries);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user