diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-11-04 15:35:00 -0500 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-11-06 17:26:09 -0500 |
commit | a281b662f3634d15928d2757f6ea03c963ffbe32 (patch) | |
tree | 4c1260da3e62c0f08b469ef6a2905aabaf5cb1f1 /server | |
parent | eda1d66399659430f372c342fbcbd10e34a3d75c (diff) | |
download | sssd-a281b662f3634d15928d2757f6ea03c963ffbe32.tar.gz sssd-a281b662f3634d15928d2757f6ea03c963ffbe32.tar.bz2 sssd-a281b662f3634d15928d2757f6ea03c963ffbe32.zip |
Make useful function more broadly available.
Diffstat (limited to 'server')
-rw-r--r-- | server/providers/ldap/ldap_id.c | 30 | ||||
-rw-r--r-- | server/providers/ldap/sdap.c | 27 | ||||
-rw-r--r-- | server/providers/ldap/sdap.h | 3 |
3 files changed, 30 insertions, 30 deletions
diff --git a/server/providers/ldap/ldap_id.c b/server/providers/ldap/ldap_id.c index b7e29e61..ba7cdab4 100644 --- a/server/providers/ldap/ldap_id.c +++ b/server/providers/ldap/ldap_id.c @@ -32,36 +32,6 @@ #include "providers/ldap/ldap_common.h" #include "providers/ldap/sdap_async.h" -static int build_attrs_from_map(TALLOC_CTX *memctx, - struct sdap_attr_map *map, - size_t size, - const char ***_attrs) -{ - char **attrs; - int i, j; - - attrs = talloc_array(memctx, char *, size + 1); - if (!attrs) return ENOMEM; - - /* first attribute is "objectclass" not the specifc one */ - attrs[0] = talloc_strdup(memctx, "objectClass"); - if (!attrs[0]) return ENOMEM; - - /* add the others */ - for (i = j = 1; i < size; i++) { - if (map[i].name) { - attrs[j] = map[i].name; - j++; - } - } - attrs[j] = NULL; - - *_attrs = (const char **)attrs; - - return EOK; -} - - /* =Connection-handling-functions========================================= */ static bool connected(struct sdap_id_ctx *ctx) diff --git a/server/providers/ldap/sdap.c b/server/providers/ldap/sdap.c index 5da698a1..d9bb323e 100644 --- a/server/providers/ldap/sdap.c +++ b/server/providers/ldap/sdap.c @@ -421,4 +421,31 @@ bool sdap_rootdse_sasl_mech_is_supported(struct sysdb_attrs *rootdse, return false; } +int build_attrs_from_map(TALLOC_CTX *memctx, + struct sdap_attr_map *map, + size_t size, const char ***_attrs) +{ + char **attrs; + int i, j; + + attrs = talloc_array(memctx, char *, size + 1); + if (!attrs) return ENOMEM; + + /* first attribute is "objectclass" not the specifc one */ + attrs[0] = talloc_strdup(memctx, "objectClass"); + if (!attrs[0]) return ENOMEM; + + /* add the others */ + for (i = j = 1; i < size; i++) { + if (map[i].name) { + attrs[j] = map[i].name; + j++; + } + } + attrs[j] = NULL; + + *_attrs = (const char **)attrs; + + return EOK; +} diff --git a/server/providers/ldap/sdap.h b/server/providers/ldap/sdap.h index 03dab304..7e5c4b7b 100644 --- a/server/providers/ldap/sdap.h +++ b/server/providers/ldap/sdap.h @@ -226,4 +226,7 @@ errno_t setup_tls_config(struct dp_option *basic_opts); bool sdap_rootdse_sasl_mech_is_supported(struct sysdb_attrs *rootdse, const char *sasl_mech); +int build_attrs_from_map(TALLOC_CTX *memctx, + struct sdap_attr_map *map, + size_t size, const char ***_attrs); #endif /* _SDAP_H_ */ |