Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/libads/ldap_schema.c

    r414 r745  
    2020
    2121#include "includes.h"
     22#include "ads.h"
     23#include "libads/ldap_schema.h"
     24#include "../libcli/ldap/ldap_ndr.h"
    2225
    2326#ifdef HAVE_LDAP
    2427
    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)
     28static 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)
    2935{
    3036        ADS_STATUS status;
     
    123129        }
    124130
    125         guid_bin = guid_binstring(mem_ctx, schema_guid);
     131        guid_bin = ldap_encode_ndr_GUID(mem_ctx, schema_guid);
    126132        if (!guid_bin) {
    127133                goto done;
     
    152158}
    153159
    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 }
    195160/*********************************************************************
    196161*********************************************************************/
Note: See TracChangeset for help on using the changeset viewer.