/usr/include/sss_sifp.h is in libsss-simpleifp-dev 1.13.4-1ubuntu1.10.
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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | /*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2014 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_SIFP_H_
#define SSS_SIFP_H_
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <dhash.h>
/**
* @defgroup sss_simpleifp Simple interface to SSSD InfoPipe responder.
* Libsss_simpleifp provides a synchronous interface to simplify basic
* communication with SSSD InfoPipe responder.
*
* This interface is not a full replacement for the complete D-Bus API and it
* provides only access to the most common tasks like fetching attributes
* of SSSD objects.
*
* If there is a need for a more sophisticated communication with the SSSD
* InfoPipe responder a D-Bus API of your choice should be used.
*
* @{
*/
/** SSSD InfoPipe bus address */
#define SSS_SIFP_IFP "org.freedesktop.sssd.infopipe"
/** SSSD InfoPipe interface */
#define SSS_SIFP_IFACE_IFP SSS_SIFP_IFP
#define SSS_SIFP_IFACE_COMPONENTS "org.freedesktop.sssd.infopipe.Components"
#define SSS_SIFP_IFACE_SERVICES "org.freedesktop.sssd.infopipe.Services"
#define SSS_SIFP_IFACE_DOMAINS "org.freedesktop.sssd.infopipe.Domains"
#define SSS_SIFP_IFACE_USERS "org.freedesktop.sssd.infopipe.Users"
#define SSS_SIFP_IFACE_GROUPS "org.freedesktop.sssd.infopipe.Groups"
/**
* Opaque libsss_sifp context. One context shall not be used by multiple
* threads. Each thread needs to create and use its own context.
*
* @see sss_sifp_init
* @see sss_sifp_init_ex
*/
typedef struct sss_sifp_ctx sss_sifp_ctx;
/**
* Typedef for memory allocation functions
*/
typedef void (sss_sifp_free_func)(void *ptr, void *pvt);
typedef void *(sss_sifp_alloc_func)(size_t size, void *pvt);
/**
* Error codes used by libsss_sifp
*/
typedef enum sss_sifp_error {
/** Success */
SSS_SIFP_OK = 0,
/** Ran out of memory during processing */
SSS_SIFP_OUT_OF_MEMORY,
/** Invalid argument */
SSS_SIFP_INVALID_ARGUMENT,
/**
* Input/output error
*
* @see sss_sifp_get_last_io_error() to get more information
*/
SSS_SIFP_IO_ERROR,
/** Internal error */
SSS_SIFP_INTERNAL_ERROR,
/** Operation not supported */
SSS_SIFP_NOT_SUPPORTED,
/** Attribute does not exist */
SSS_SIFP_ATTR_MISSING,
/** Attribute does not have any value set */
SSS_SIFP_ATTR_NULL,
/** Incorrect attribute type */
SSS_SIFP_INCORRECT_TYPE,
/** Always last */
SSS_SIFP_ERROR_SENTINEL
} sss_sifp_error;
/**
* D-Bus object attribute
*/
typedef struct sss_sifp_attr sss_sifp_attr;
/**
* D-Bus object
*/
typedef struct sss_sifp_object {
char *name;
char *object_path;
char *interface;
sss_sifp_attr **attrs;
} sss_sifp_object;
/**
* @brief Initialize sss_sifp context using default allocator (malloc)
*
* @param[out] _ctx sss_sifp context
*/
sss_sifp_error
sss_sifp_init(sss_sifp_ctx **_ctx);
/**
* @brief Initialize sss_sifp context
*
* @param[in] alloc_pvt Private data for allocation routine
* @param[in] alloc_func Function to allocate memory for the context, if
* NULL malloc() is used
* @param[in] free_func Function to free the memory of the context, if
* NULL free() is used
* @param[out] _ctx sss_sifp context
*/
sss_sifp_error
sss_sifp_init_ex(void *alloc_pvt,
sss_sifp_alloc_func *alloc_func,
sss_sifp_free_func *free_func,
sss_sifp_ctx **_ctx);
/**
* @brief Return last error name from underlying D-Bus communication
*
* @param[in] ctx sss_sifp context
* @return Error message or NULL if no error occurred during last D-Bus call.
*/
const char *
sss_sifp_get_last_io_error_name(sss_sifp_ctx *ctx);
/**
* @brief Return last error message from underlying D-Bus communication
*
* @param[in] ctx sss_sifp context
* @return Error message or NULL if no error occurred during last D-Bus call.
*/
const char *
sss_sifp_get_last_io_error_message(sss_sifp_ctx *ctx);
/**
* @brief Fetch selected attributes of given object.
*
* @param[in] ctx sss_sifp context
* @param[in] object_path D-Bus object path
* @param[in] interface D-Bus interface
* @param[in] name Name of desired attribute
* @param[out] _attrs List of acquired attributes
*/
sss_sifp_error
sss_sifp_fetch_attr(sss_sifp_ctx *ctx,
const char *object_path,
const char *interface,
const char *name,
sss_sifp_attr ***_attrs);
/**
* @brief Fetch all attributes of given object.
*
* @param[in] ctx sss_sifp context
* @param[in] object_path D-Bus object path
* @param[in] interface D-Bus interface
* @param[out] _attrs Acquired attributes
*/
sss_sifp_error
sss_sifp_fetch_all_attrs(sss_sifp_ctx *ctx,
const char *object_path,
const char *interface,
sss_sifp_attr ***_attrs);
/**
* @brief Fetch D-Bus object.
*
* @param[in] ctx sss_sifp context
* @param[in] object_path D-Bus object path
* @param[in] interface D-Bus interface
* @param[out] _object Object and its attributes
*/
sss_sifp_error
sss_sifp_fetch_object(sss_sifp_ctx *ctx,
const char *object_path,
const char *interface,
sss_sifp_object **_object);
/**
* @brief Find attribute in list and return its value.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_bool(sss_sifp_attr **attrs,
const char *name,
bool *_value);
/**
* @brief Find attribute in list and return its value.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_int16(sss_sifp_attr **attrs,
const char *name,
int16_t *_value);
/**
* @brief Find attribute in list and return its value.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_uint16(sss_sifp_attr **attrs,
const char *name,
uint16_t *_value);
/**
* @brief Find attribute in list and return its value.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_int32(sss_sifp_attr **attrs,
const char *name,
int32_t *_value);
/**
* @brief Find attribute in list and return its value.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_uint32(sss_sifp_attr **attrs,
const char *name,
uint32_t *_value);
/**
* @brief Find attribute in list and return its value.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_int64(sss_sifp_attr **attrs,
const char *name,
int64_t *_value);
/**
* @brief Find attribute in list and return its value.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_uint64(sss_sifp_attr **attrs,
const char *name,
uint64_t *_value);
/**
* @brief Find attribute in list and return its value.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_string(sss_sifp_attr **attrs,
const char *name,
const char **_value);
/**
* @brief Find attribute in list and return its value.
*
* The dictionary is stored in dhash table, the values
* are pointers to NULL-terminated string array.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _value Output value
*/
sss_sifp_error
sss_sifp_find_attr_as_string_dict(sss_sifp_attr **attrs,
const char *name,
hash_table_t **_value);
/**
* @brief Find attribute in list and return its values.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _num_values Number of values in the array
* @param[out] _value Output array
*/
sss_sifp_error
sss_sifp_find_attr_as_bool_array(sss_sifp_attr **attrs,
const char *name,
unsigned int *_num_values,
bool **_value);
/**
* @brief Find attribute in list and return its values.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _num_values Number of values in the array
* @param[out] _value Output array
*/
sss_sifp_error
sss_sifp_find_attr_as_int16_array(sss_sifp_attr **attrs,
const char *name,
unsigned int *_num_values,
int16_t **_value);
/**
* @brief Find attribute in list and return its values.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _num_values Number of values in the array
* @param[out] _value Output array
*/
sss_sifp_error
sss_sifp_find_attr_as_uint16_array(sss_sifp_attr **attrs,
const char *name,
unsigned int *_num_values,
uint16_t **_value);
/**
* @brief Find attribute in list and return its values.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _num_values Number of values in the array
* @param[out] _value Output array
*/
sss_sifp_error
sss_sifp_find_attr_as_int32_array(sss_sifp_attr **attrs,
const char *name,
unsigned int *_num_values,
int32_t **_value);
/**
* @brief Find attribute in list and return its values.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _num_values Number of values in the array
* @param[out] _value Output array
*/
sss_sifp_error
sss_sifp_find_attr_as_uint32_array(sss_sifp_attr **attrs,
const char *name,
unsigned int *_num_values,
uint32_t **_value);
/**
* @brief Find attribute in list and return its values.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _num_values Number of values in the array
* @param[out] _value Output array
*/
sss_sifp_error
sss_sifp_find_attr_as_int64_array(sss_sifp_attr **attrs,
const char *name,
unsigned int *_num_values,
int64_t **_value);
/**
* @brief Find attribute in list and return its values.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _num_values Number of values in the array
* @param[out] _value Output array
*/
sss_sifp_error
sss_sifp_find_attr_as_uint64_array(sss_sifp_attr **attrs,
const char *name,
unsigned int *_num_values,
uint64_t **_value);
/**
* @brief Find attribute in list and return its values.
*
* @param[in] attrs Attributes
* @param[in] name Name of the attribute to find
* @param[out] _num_values Number of values in the array
* @param[out] _value Output array
*/
sss_sifp_error
sss_sifp_find_attr_as_string_array(sss_sifp_attr **attrs,
const char *name,
unsigned int *_num_values,
const char * const **_value);
/**
* @brief Free sss_sifp context and set it to NULL.
*
* @param[in,out] _ctx sss_sifp context
*/
void
sss_sifp_free(sss_sifp_ctx **_ctx);
/**
* @brief Free attribute list and set it to NULL.
*
* @param[in] ctx sss_sifp context
* @param[in,out] _attrs Attributes
*/
void
sss_sifp_free_attrs(sss_sifp_ctx *ctx,
sss_sifp_attr ***_attrs);
/**
* @brief Free sss_sifp object and set it to NULL.
*
* @param[in] ctx sss_sifp context
* @param[in,out] _object Object
*/
void
sss_sifp_free_object(sss_sifp_ctx *ctx,
sss_sifp_object **_object);
/**
* @brief Free string and set it to NULL.
*
* @param[in] ctx sss_sifp context
* @param[in,out] _str String
*/
void
sss_sifp_free_string(sss_sifp_ctx *ctx,
char **_str);
/**
* @brief Free array of strings and set it to NULL.
*
* @param[in] ctx sss_sifp context
* @param[in,out] _str_array Array of strings
*/
void
sss_sifp_free_string_array(sss_sifp_ctx *ctx,
char ***_str_array);
/**
* @}
*/
/**
* @defgroup common Most common use cases of SSSD InfoPipe responder.
* @{
*/
/**
* @brief List names of available domains.
*
* @param[in] ctx sss_sifp context
* @param[out] _domains List of domain names
*/
sss_sifp_error
sss_sifp_list_domains(sss_sifp_ctx *ctx,
char ***_domains);
/**
* @brief Fetch all information about domain by name.
*
* @param[in] ctx sss_sifp context
* @param[in] name Domain name
* @param[out] _domain Domain object
*/
sss_sifp_error
sss_sifp_fetch_domain_by_name(sss_sifp_ctx *ctx,
const char *name,
sss_sifp_object **_domain);
/**
* @brief Fetch all information about user by uid.
*
* @param[in] ctx sss_sifp context
* @param[in] uid User ID
* @param[out] _user User object
*/
sss_sifp_error
sss_sifp_fetch_user_by_uid(sss_sifp_ctx *ctx,
uid_t uid,
sss_sifp_object **_user);
/**
* @brief Fetch all information about user by name.
*
* @param[in] ctx sss_sifp context
* @param[in] name User name
* @param[out] _user User object
*/
sss_sifp_error
sss_sifp_fetch_user_by_name(sss_sifp_ctx *ctx,
const char *name,
sss_sifp_object **_user);
/**
* @}
*/
#endif /* SSS_SIFP_H_ */
|