Changeset 745 for trunk/server/source3/libads/ldap_schema.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/libads/ldap_schema.c
r414 r745 20 20 21 21 #include "includes.h" 22 #include "ads.h" 23 #include "libads/ldap_schema.h" 24 #include "../libcli/ldap/ldap_ndr.h" 22 25 23 26 #ifdef HAVE_LDAP 24 27 25 ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, 26 const char *schema_path, 27 const char **OIDs, size_t num_OIDs, 28 char ***OIDs_out, char ***names, size_t *count) 28 static ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, 29 TALLOC_CTX *mem_ctx, 30 const char *schema_path, 31 const char **OIDs, 32 size_t num_OIDs, 33 char ***OIDs_out, char ***names, 34 size_t *count) 29 35 { 30 36 ADS_STATUS status; … … 123 129 } 124 130 125 guid_bin = guid_binstring(mem_ctx, schema_guid);131 guid_bin = ldap_encode_ndr_GUID(mem_ctx, schema_guid); 126 132 if (!guid_bin) { 127 133 goto done; … … 152 158 } 153 159 154 const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID)155 {156 ADS_STATUS rc;157 int count = 0;158 LDAPMessage *res = NULL;159 char *expr = NULL;160 const char *attrs[] = { "lDAPDisplayName", NULL };161 char *result;162 163 if (ads == NULL || mem_ctx == NULL || OID == NULL) {164 goto failed;165 }166 167 expr = talloc_asprintf(mem_ctx, "(attributeId=%s)", OID);168 if (expr == NULL) {169 goto failed;170 }171 172 rc = ads_do_search_retry(ads, schema_path, LDAP_SCOPE_SUBTREE,173 expr, attrs, &res);174 if (!ADS_ERR_OK(rc)) {175 goto failed;176 }177 178 count = ads_count_replies(ads, res);179 if (count == 0 || !res) {180 goto failed;181 }182 183 result = ads_pull_string(ads, mem_ctx, res, "lDAPDisplayName");184 ads_msgfree(ads, res);185 186 return result;187 188 failed:189 DEBUG(0,("ads_get_attrname_by_oid: failed to retrieve name for oid: %s\n",190 OID));191 192 ads_msgfree(ads, res);193 return NULL;194 }195 160 /********************************************************************* 196 161 *********************************************************************/
Note:
See TracChangeset
for help on using the changeset viewer.