~ubuntu-branches/ubuntu/edgy/curl/edgy

« back to all changes in this revision

Viewing changes to lib/ldap.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-06-29 15:04:24 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060629150424-pn00qumt9sml8p4m
Tags: 7.15.4-1ubuntu1
Synchronize to Debian. Only change left: Removal of stunnel and
libdb4.2-dev build dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: ldap.c,v 1.51 2005/11/01 16:27:27 giva Exp $
 
21
 * $Id: ldap.c,v 1.55 2006-04-26 17:23:28 giva Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
36
36
#ifdef HAVE_SYS_STAT_H
37
37
#include <sys/stat.h>
38
38
#endif
 
39
#ifdef HAVE_MALLOC_H
 
40
#include <malloc.h>
 
41
#endif
39
42
#include <errno.h>
40
43
 
41
44
#if defined(WIN32)
42
 
# include <windows.h>
43
 
# include <malloc.h>
44
45
# include <winldap.h>
45
46
#endif
46
47
 
499
500
/*
500
501
 * Unescape the LDAP-URL components
501
502
 */
502
 
static bool unescape_elements (LDAPURLDesc *ludp)
 
503
static bool unescape_elements (void *data, LDAPURLDesc *ludp)
503
504
{
504
505
  int i;
505
506
 
506
507
  if (ludp->lud_filter) {
507
 
    ludp->lud_filter = curl_unescape(ludp->lud_filter, 0);
 
508
    ludp->lud_filter = curl_easy_unescape(data, ludp->lud_filter, 0, NULL);
508
509
    if (!ludp->lud_filter)
509
510
       return (FALSE);
510
511
  }
511
512
 
512
513
  for (i = 0; ludp->lud_attrs && ludp->lud_attrs[i]; i++) {
513
 
    ludp->lud_attrs[i] = curl_unescape(ludp->lud_attrs[i], 0);
 
514
    ludp->lud_attrs[i] = curl_easy_unescape(data, ludp->lud_attrs[i], 0, NULL);
514
515
    if (!ludp->lud_attrs[i])
515
516
       return (FALSE);
516
517
  }
517
518
 
518
519
  for (i = 0; ludp->lud_exts && ludp->lud_exts[i]; i++) {
519
 
    ludp->lud_exts[i] = curl_unescape(ludp->lud_exts[i], 0);
 
520
    ludp->lud_exts[i] = curl_easy_unescape(data, ludp->lud_exts[i], 0, NULL);
520
521
    if (!ludp->lud_exts[i])
521
522
       return (FALSE);
522
523
  }
523
524
 
524
525
  if (ludp->lud_dn) {
525
526
    char *dn = ludp->lud_dn;
526
 
    char *new_dn = curl_unescape(dn, 0);
 
527
    char *new_dn = curl_easy_unescape(data, dn, 0, NULL);
527
528
 
528
529
    free(dn);
529
530
    ludp->lud_dn = new_dn;
634
635
      LDAP_TRACE (("exts[%d] '%s'\n", i, ludp->lud_exts[i]));
635
636
 
636
637
success:
637
 
  if (!unescape_elements(ludp))
 
638
  if (!unescape_elements(conn->data, ludp))
638
639
     return LDAP_NO_MEMORY;
639
640
  return LDAP_SUCCESS;
640
641
}