This file is indexed.

/usr/include/sss_sudo.h is in libsss-sudo-dev 1.8.2-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
    Authors:
        Pavel Březina <pbrezina@redhat.com>

    Copyright (C) 2011 Red Hat

    This program is free software; you can redistribute it and/or modify
    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/>.
*/

#ifndef SSS_SUDO_H_
#define SSS_SUDO_H_

/**
 * @defgroup libsss_sudo A library for communication between SUDO and SSSD
 * libsss_sudo provides a mechanism to for a SUDO plugin
 * to communicate with the sudo responder of SSSD.
 *
 * @{
 */

#include <stdint.h>

/** The sss_sudo* functions in general return EOK on success */
#ifndef EOK
#define EOK 0
#endif

/** The value returned when the communication with SUDO is successful and
 *  the user was found in one of the domains
 */
#define SSS_SUDO_ERROR_OK   0

/**
 * Component of a sss_rule structure. The component
 * has exactly one name and one or more values.
 *
 */
struct sss_sudo_attr {
    /** The attribute name */
    char *name;
    /** A string array that contains all the attribute values */
    char **values;

    /** The number of values the attribute contains.
     *
     * Attributes are multivalued in general.
     */
    unsigned int num_values;
};

/**
 * One sudo rule. The rule consists of one or more
 * attributes of sss_attr type
 */
struct sss_sudo_rule {
    /** The number of attributes in the rule */
    unsigned int num_attrs;

    /** List of rule attributes */
    struct sss_sudo_attr *attrs;
};

/**
 * A result object returned from SSSD.
 *
 * The result consists of zero or more sss_rule elements.
 */
struct sss_sudo_result {
    /**
     * The number of rules for the user
     *
     * In case the user exists in one of SSSD domains
     * but no rules match for him, the num_rules element
     * is 0.
     */
    unsigned int num_rules;

    /** List of rules found */
    struct sss_sudo_rule *rules;
};

/**
 * @brief Send a request to SSSD to retreive all SUDO rules for a given
 * user.
 *
 * @param[in] username    The username to retreive the rules for
 * @param[out] _error     The result of the search in SSSD's domains. If the
 *                        user was present in the domain, the _error code is
 *                        SSS_SUDO_ERROR_OK and the _result structure is
 *                        returned even if it was empty (in other words
 *                        _result->num_rules == 0). Other problems are returned
 *                        as errno codes. Most prominently these are ENOENT
 *                        (the user was not found with SSSD), EIO (SSSD
 *                        encountered an internal problem) and EINVAL
 *                        (malformed query).
 * @param[out] _result    Newly allocated structure sss_result that contains
 *                        the rules for the user. If no rules were found but
 *                        the user was valid, this structure is "empty", which
 *                        means that the num_rules member is 0.
 *
 * @return The return value denotes whether communication with SSSD was
 * successful. It does not tell whether the result contains any rules or
 * whether SSSD knew the user at all. That information is transferred in the
 * _error parameter.
 */
int sss_sudo_send_recv(const char *username,
                       uint32_t *_error,
                       struct sss_sudo_result **_result);

/**
 * @brief Send a request to SSSD to retrieve the default options, commonly
 * stored in the "cn=defaults" record,
 *
 * @param[out] _error     The result of the search in SSSD's domains. If the
 *                        options were present in the domain, the _error code
 *                        is SSS_SUDO_ERROR_OK and the _result structure is
 *                        returned even if it was empty (in other words
 *                        _result->num_rules == 0). Other problems are returned
 *                        as errno codes.
 *
 * @param[out] _result    Newly allocated structure sss_result that contains
 *                        the options. If no options were found this structure
 *                        is "empty", which means that the num_rules member
 *                        is 0.
 *
 * @return The return value denotes whether communication with SSSD was
 * successful. It does not tell whether the result contains any options,
 * That information is transferred in the _error parameter.
 */
int sss_sudo_send_recv_defaults(uint32_t *_error,
                                struct sss_sudo_result **_result);

/**
 * @brief Free the sss_result structure returned by sss_sudo_send_recv
 *
 * @param[in] result    The sss_result structure to free. The structure was
 *                      previously returned by sss_sudo_get_values().
 */
void sss_sudo_free_result(struct sss_sudo_result *result);

/**
 * @brief Get all values for a given attribute in a sss_rule
 *
 * @param[in] e           The sss_rule to get values from
 * @param[in] attrname    The name of the attribute to query from the rule
 * @param[out] values     A newly allocated list of values the attribute has in
 *                        rule. On success, this parameter is an array of
 *                        NULL-terminated strings, the last element is a NULL
 *                        pointer. On failure (including when the attribute is
 *                        not found), the pointer address is not changed.
 *
 * @return EOK on success, ENOENT in case the attribute is not found and other
 * errno values on failure.
 *
 * @note the returned values should be freed using sss_sudo_free_values()
 */
int sss_sudo_get_values(struct sss_sudo_rule *e,
                        const char *attrname,
                        char ***values);

/**
 * @brief Free the values returned by sss_sudo_get_values
 *
 * @param[in] values    The list of values to free. The values were previously
 *                      returned by sss_sudo_get_values()
 */
void sss_sudo_free_values(char **values);

/**
 * @}
 */
#endif /* SSS_SUDO_H_ */