Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:as_python3_module
adcli
0009-library-add-_adcli_ldap_parse_sid.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0009-library-add-_adcli_ldap_parse_sid.patch of Package adcli
From 3c48f8c054990712faf76f12c95897e19c9c6f25 Mon Sep 17 00:00:00 2001 From: Sumit Bose <sbose@redhat.com> Date: Tue, 30 Jan 2018 14:44:45 +0100 Subject: [PATCH 09/25] library: add _adcli_ldap_parse_sid() Get a binary SID from a LDAP message and return it in the string representation. https://bugs.freedesktop.org/show_bug.cgi?id=100118 https://gitlab.freedesktop.org/realmd/adcli/issues/6 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> --- library/adldap.c | 24 ++++++++++++++++++++++++ library/adprivate.h | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/library/adldap.c b/library/adldap.c index 7c7a01b..07dc373 100644 --- a/library/adldap.c +++ b/library/adldap.c @@ -67,6 +67,30 @@ _adcli_ldap_handle_failure (LDAP *ldap, return defres; } +char * +_adcli_ldap_parse_sid (LDAP *ldap, + LDAPMessage *results, + const char *attr_name) +{ + LDAPMessage *entry; + struct berval **bvs; + char *val = NULL; + + entry = ldap_first_entry (ldap, results); + if (entry != NULL) { + bvs = ldap_get_values_len (ldap, entry, attr_name); + if (bvs != NULL) { + if (bvs[0]) { + val = _adcli_bin_sid_to_str ( (uint8_t *) bvs[0]->bv_val, + bvs[0]->bv_len); + return_val_if_fail (val != NULL, NULL); + } + ldap_value_free_len (bvs); + } + } + + return val; +} char * _adcli_ldap_parse_value (LDAP *ldap, diff --git a/library/adprivate.h b/library/adprivate.h index 7257c93..83a88f6 100644 --- a/library/adprivate.h +++ b/library/adprivate.h @@ -174,6 +174,10 @@ adcli_result _adcli_ldap_handle_failure (LDAP *ldap, const char *desc, ...) GNUC_PRINTF(3, 4); +char * _adcli_ldap_parse_sid (LDAP *ldap, + LDAPMessage *results, + const char *attr_name); + char * _adcli_ldap_parse_value (LDAP *ldap, LDAPMessage *results, const char *attr_name); -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor