diff options
author | Simo Sorce <simo@redhat.com> | 2016-01-20 10:33:39 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-06-29 21:46:12 +0200 |
commit | 052f8aa2034f7b091097dc5fdafc201b7d684525 (patch) | |
tree | 5421bad602bbab546c9704e049873c6cab4c8c2d /src/confdb/confdb.h | |
parent | e5911e72198df96ec7cfe486ff66363c2297a5f7 (diff) | |
download | sssd-052f8aa2034f7b091097dc5fdafc201b7d684525.tar.gz sssd-052f8aa2034f7b091097dc5fdafc201b7d684525.tar.xz sssd-052f8aa2034f7b091097dc5fdafc201b7d684525.zip |
ConfDB: Add helper function to get "subsections"
The secrets database will have "subsections", ie sections that are in the
"secrets" namespace and look like this: [secrets/<path>]
This function allows to source any section under secrets/ or under any
arbitrary sub-path.
Related:
https://fedorahosted.org/sssd/ticket/2913
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/confdb/confdb.h')
-rw-r--r-- | src/confdb/confdb.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h index eb5764c2e..9490e3e38 100644 --- a/src/confdb/confdb.h +++ b/src/confdb/confdb.h @@ -564,6 +564,32 @@ int confdb_set_string(struct confdb_ctx *cdb, int confdb_get_string_as_list(struct confdb_ctx *cdb, TALLOC_CTX *ctx, const char *section, const char *attribute, char ***result); + +/** + * @brief Convenience function to retrieve a list of subsections given a + * configuration section name + * + * @param[in] memctx The parent memory context for the returned list + * @param[in] cdb The connection object to the confdb + * @param[in] section The ConfDB section to look for. + * All sections should start with 'config/'. + * Subsections are separated by slashes. + * @param[out] sections Names of the subsections realtive to the section + * requested. If "a/b" is requested then "c/d" is + * returned for the section named [a/b/c/d] + * @param[out] num_sections Number of section names returned + * + * @return 0 - Successfully retrieved the entry (or used the default) + * @return ENOMEM - There was insufficient memory to complete the operation + * @return EINVAL - The section could not be parsed. + * @return ENOENT - No section was found. + * @return EIO - An I/O error occurred while communicating with the ConfDB + */ +int confdb_get_sub_sections(TALLOC_CTX *mem_ctx, + struct confdb_ctx *cdb, + const char *section, + char ***sections, + int *num_sections); /** * @} */ |