~ubuntu-branches/ubuntu/precise/nss-pam-ldapd/precise-proposed

« back to all changes in this revision

Viewing changes to tests/test_set.c

  • Committer: Bazaar Package Importer
  • Author(s): Arthur de Jong
  • Date: 2009-12-28 13:30:00 UTC
  • Revision ID: james.westby@ubuntu.com-20091228133000-n0hyju3c5tmo8bjq
Tags: 0.7.2
* some attributes may be mapped to a shell-like expression that expand
  attributes from LDAP entries; this allows attributes overrides, defaults
  and much more (as a result the passwd cn attribute mapping has been
  removed because the gecos mapping is now "${gecos:-$cn}" by default)
* update the NSS module to follow the change in Glibc where the addr 
  parameter of getnetbyaddr_r() was changed from network-byte-order to
  host-byte-order
* properly escape searches for uniqueMember attributes for DN with a comma
  in an attribute value
* miscellaneous improvements to the configure script implementing better
  (and simpler) library detection
* some general refactoring and other miscellaneous improvements
* make configure check if we need to explicitly link to -llber
  (closes: #555779)
* libnss-ldapd: recommend libpam-krb5 as an alternative to libpam-ldapd for
  Kerberos environments
* updated Italian debconf translation by Vincenzo Campanella
  (closes: #556107)
* fix nslcd postrm to remove old config file (thanks piuparts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
   test_set.c - simple test for the set module
3
3
   This file is part of the nss-pam-ldapd library.
4
4
 
5
 
   Copyright (C) 2008 Arthur de Jong
 
5
   Copyright (C) 2008, 2009 Arthur de Jong
6
6
 
7
7
   This library is free software; you can redistribute it and/or
8
8
   modify it under the terms of the GNU Lesser General Public
25
25
#include <stdio.h>
26
26
#include <string.h>
27
27
#include <assert.h>
 
28
#include <stdlib.h>
28
29
 
29
30
#include "common/set.h"
30
31
#include "compat/attrs.h"
33
34
int main(int UNUSED(argc),char UNUSED(*argv[]))
34
35
{
35
36
  SET *set;
36
 
  const char *val;
 
37
  const char **list;
 
38
  int i;
37
39
 
38
40
  /* initialize */
39
41
  set=set_new();
51
53
  assert(!set_contains(set,"key4"));
52
54
 
53
55
  /* loop over set contents */
54
 
  set_loop_first(set);
55
 
  while ((val=set_loop_next(set))!=NULL)
 
56
  list=set_tolist(set);
 
57
  for (i=0;list[i]!=NULL;i++)
56
58
  {
57
 
    assert( (strcasecmp(val,"key1")==0) ||
58
 
            (strcasecmp(val,"key2")==0) ||
59
 
            (strcasecmp(val,"key3")==0) );
 
59
    assert( (strcasecmp(list[i],"key1")==0) ||
 
60
            (strcasecmp(list[i],"key2")==0) ||
 
61
            (strcasecmp(list[i],"key3")==0) );
60
62
  }
61
63
 
62
64
  /* free set */
63
65
  set_free(set);
 
66
  free(list);
64
67
 
65
68
  return 0;
66
69
}