Branch: Tag:

2005-03-29

2005-03-29 17:40:00 by Martin Stjernholm <mast@lysator.liu.se>

Extended the get_attr_decoder nowarn kludge for M$ AD to cover the
case when the root DSE is fetched with a normal query.

Rev: lib/modules/Protocols.pmod/LDAP.pmod/client.pike:1.89

2:      // LDAP client protocol implementation for Pike.   // - // $Id: client.pike,v 1.88 2005/03/24 14:57:12 mast Exp $ + // $Id: client.pike,v 1.89 2005/03/29 17:40:00 mast Exp $   //   // Honza Petrous, hop@unibase.cz   //
181:    foreach (rawres, string rawent) { \    object derent = .ldap_privates.ldap_der_decode (rawent)->elements[1]; \    if (array(object) derattribs = ASN1_GET_ATTR_ARRAY (derent)) { \ -  mapping(string:array) attrs = (["dn": ({SET_DN})]); \ +  string dn = (SET_DN); \ +  mapping(string:array) attrs = (["dn": ({dn})]); \    foreach (derattribs, object derattr) \    {SET_ATTR;} \    res += ({attrs}); \
211:    if (flags & SEARCH_LOWER_ATTRS)    DECODE_ENTRIES (utf8_to_string (ASN1_GET_DN (derent)), {    string attr = lower_case (ASN1_GET_ATTR_NAME (derattr)); -  if (function(string:string) decoder = get_attr_decoder (attr)) +  if (function(string:string) decoder = +  // Microsoft AD has several attributes in its root DSE +  // that they have not bothered to include in their +  // schema. So if this is the root being fetched then +  // send the nowarn flag to get_attr_encoder to avoid +  // complaints about that. +  get_attr_decoder (attr, DO_IF_DEBUG (dn == "")))    attrs[attr] = map (ASN1_GET_ATTR_VALUES (derattr), decoder);    else    attrs[attr] = ASN1_GET_ATTR_VALUES (derattr);
219:    else    DECODE_ENTRIES (utf8_to_string (ASN1_GET_DN (derent)), {    string attr = ASN1_GET_ATTR_NAME (derattr); -  if (function(string:string) decoder = get_attr_decoder (attr)) +  if (function(string:string) decoder = +  get_attr_decoder (attr, DO_IF_DEBUG (dn == "")))    attrs[attr] = map (ASN1_GET_ATTR_VALUES (derattr), decoder);    else    attrs[attr] = ASN1_GET_ATTR_VALUES (derattr);
487: Inside #if undefined(PARSE_RFCS)
   void create(string|void url, object|void context)    {    -  info = ([ "code_revision" : ("$Revision: 1.88 $"/" ")[1] ]); +  info = ([ "code_revision" : ("$Revision: 1.89 $"/" ")[1] ]);       if(!url || !sizeof(url))    url = LDAP_DEFAULT_URL;