Move new_member_all to ldap_util.c, it is only used by ldap/sssd.
This commit is contained in:
@@ -3421,16 +3421,6 @@ new_member(char *name, int type)
|
||||
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 *
|
||||
new_command(char *cmnd, char *args)
|
||||
{
|
||||
|
@@ -1270,16 +1270,6 @@ new_member(char *name, int type)
|
||||
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 *
|
||||
new_command(char *cmnd, char *args)
|
||||
{
|
||||
|
@@ -1258,7 +1258,7 @@ ldap_to_sudoers(LDAP *ld, struct ldap_result *lres,
|
||||
TAILQ_INSERT_TAIL(ldap_userspecs, us, entries);
|
||||
|
||||
/* The user has already matched, use ALL as wildcard. */
|
||||
if ((m = new_member_all(NULL)) == NULL)
|
||||
if ((m = sudo_ldap_new_member_all()) == NULL)
|
||||
goto oom;
|
||||
TAILQ_INSERT_TAIL(&us->users, m, entries);
|
||||
|
||||
|
@@ -409,7 +409,7 @@ sudo_ldap_role_to_priv(const char *cn, void *hosts, void *runasusers,
|
||||
|
||||
if (hosts == NULL) {
|
||||
/* The host has already matched, use ALL as wildcard. */
|
||||
if ((m = new_member_all(NULL)) == NULL)
|
||||
if ((m = sudo_ldap_new_member_all()) == NULL)
|
||||
goto oom;
|
||||
TAILQ_INSERT_TAIL(&priv->hostlist, m, entries);
|
||||
} else {
|
||||
@@ -653,3 +653,15 @@ oom:
|
||||
}
|
||||
debug_return_ptr(NULL);
|
||||
}
|
||||
|
||||
/* So ldap.c and sssd.c don't need to include gram.h */
|
||||
struct member *
|
||||
sudo_ldap_new_member_all(void)
|
||||
{
|
||||
struct member *m;
|
||||
debug_decl(sudo_ldap_new_member_all, SUDOERS_DEBUG_LDAP);
|
||||
|
||||
if ((m = calloc(1, sizeof(*m))) != NULL)
|
||||
m->type = ALL;
|
||||
debug_return_ptr(m);
|
||||
}
|
||||
|
@@ -341,7 +341,6 @@ void alias_put(struct alias *a);
|
||||
/* gram.c */
|
||||
extern struct sudoers_parse_tree parsed_policy;
|
||||
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_members(struct member_list *members);
|
||||
void free_cmndspecs(struct cmndspec_list *csl);
|
||||
|
@@ -370,7 +370,7 @@ sss_to_sudoers(struct sudo_sss_handle *handle,
|
||||
TAILQ_INSERT_TAIL(&handle->parse_tree.userspecs, us, entries);
|
||||
|
||||
/* We only include rules where the user matches. */
|
||||
if ((m = new_member_all(NULL)) == NULL)
|
||||
if ((m = sudo_ldap_new_member_all()) == NULL)
|
||||
goto oom;
|
||||
TAILQ_INSERT_TAIL(&us->users, m, entries);
|
||||
|
||||
|
@@ -27,5 +27,6 @@ bool sudo_ldap_is_negated(char **valp);
|
||||
bool sudo_ldap_add_default(const char *var, const char *val, int op, char *source, struct defaults_list *defs);
|
||||
int sudo_ldap_parse_option(char *optstr, char **varp, char **valp);
|
||||
struct privilege *sudo_ldap_role_to_priv(const char *cn, void *hosts, void *runasusers, void *runasgroups, void *cmnds, void *opts, const char *notbefore, const char *notafter, bool warnings, bool store_options, sudo_ldap_iter_t iter);
|
||||
struct member *sudo_ldap_new_member_all(void);
|
||||
|
||||
#endif /* SUDOERS_LDAP_H */
|
||||
|
Reference in New Issue
Block a user