~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to contrib/slapd-modules/nssov/nss-ldapd/tests/test_ethers.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short, Adam Sommer
  • Date: 2010-07-28 11:35:16 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100728113516-x69n6g84l50ty1o9
Tags: 2.4.23-0ubuntu1
* New release, features include:
  + Fixed libldap to return server's error code (ITS#6569)
  + Fixed libldap memleaks (ITS#6568)
  + Fixed liblutil off-by-one with delta (ITS#6541)
  + Fixed slapd acls with glued databases (ITS#6468)
  + Fixed slapd syncrepl rid logging (ITS#6533)
  + Fixed slapd modrdn handling of invalid values (ITS#6570)
  + Fixed slapd-bdb hasSubordinates computation (ITS#6549)
  + Fixed slapd-bdb to use memcpy instead for strcpy (ITS#6474)
  + Fixed slapd-bdb entry cache delete failure (ITS#6577)
  + Fixed slapd-ldap to return control responses (ITS#6530)
  + Fixed slapo-ppolicy to use Debug (ITS#6566)
  + Fixed slapo-refint to zero out freed DN vals (ITS#6572)
  + Fixed slapo-rwm to use Debug (ITS#6566)
  + Fixed slapo-sssvlv to use Debug (ITS#6566)
  + Fixed slapo-syncprov lost deletes in refresh phase (ITS#6555)
  + Fixed slapo-valsort to use Debug (ITS#6566)
  + Fixed contrib/nssov network.c missing patch (ITS#6562)
  + Fixed test043 attribute sorting (ITS#6553)
  + slapd-config(5) note default rootdn (ITS#6546)
* Rebased patches debian/patches/dropped nssov-build
* Resynchronize with Debian:
  + debian/control:
    - Bump standards-version to 3.9.0
    - Use libdb4.8-dev (LP: #572489)
  + Added debian/patches/issue-6534-patch
  + Added debian/patches/ldap-conf-tls-cacertdir
* Add ufw support, thanks to  PatRiehecky (LP: #423246)

 [Adam Sommer]
 * debian/rules, debian/slapd.py: Add apport hook. (LP: #610544)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
   test_ethers.c - simple tests of developed nss code
3
 
 
4
 
   Copyright (C) 2006 West Consulting
5
 
   Copyright (C) 2006 Arthur de Jong
6
 
 
7
 
   This library is free software; you can redistribute it and/or
8
 
   modify it under the terms of the GNU Lesser General Public
9
 
   License as published by the Free Software Foundation; either
10
 
   version 2.1 of the License, or (at your option) any later version.
11
 
 
12
 
   This library is distributed in the hope that it will be useful,
13
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
   Lesser General Public License for more details.
16
 
 
17
 
   You should have received a copy of the GNU Lesser General Public
18
 
   License along with this library; if not, write to the Free Software
19
 
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
 
   02110-1301 USA
21
 
*/
22
 
 
23
 
#include "config.h"
24
 
 
25
 
#include <string.h>
26
 
#include <stdio.h>
27
 
#include <errno.h>
28
 
#include <sys/types.h>
29
 
#include <sys/socket.h>
30
 
#include <arpa/inet.h>
31
 
 
32
 
#include "nss/prototypes.h"
33
 
 
34
 
static char *nssstatus(enum nss_status retv)
35
 
{
36
 
  switch(retv)
37
 
  {
38
 
    case NSS_STATUS_TRYAGAIN: return "NSS_STATUS_TRYAGAIN";
39
 
    case NSS_STATUS_UNAVAIL:  return "NSS_STATUS_UNAVAIL";
40
 
    case NSS_STATUS_NOTFOUND: return "NSS_STATUS_NOTFOUND";
41
 
    case NSS_STATUS_SUCCESS:  return "NSS_STATUS_SUCCESS";
42
 
    case NSS_STATUS_RETURN:   return "NSS_STATUS_RETURN";
43
 
    default:                  return "NSS_STATUS_**ILLEGAL**";
44
 
  }
45
 
}
46
 
 
47
 
static void printether(struct etherent *ether)
48
 
{
49
 
  printf("struct etherent {\n"
50
 
         "  e_name=\"%s\",\n"
51
 
         "  e_addr=%s\n"
52
 
         "}\n",
53
 
         ether->e_name,ether_ntoa(&(ether->e_addr)));
54
 
}
55
 
 
56
 
/* the main program... */
57
 
int main(int argc,char *argv[])
58
 
{
59
 
  struct etherent etherresult;
60
 
  char buffer[1024];
61
 
  enum nss_status res;
62
 
  int errnocp;
63
 
 
64
 
  /* test ether_hostton() */
65
 
  printf("\nTEST ether_hostton()\n");
66
 
  res=_nss_ldap_gethostton_r("spiritus",&etherresult,buffer,1024,&errnocp);
67
 
  printf("status=%s\n",nssstatus(res));
68
 
  if (res==NSS_STATUS_SUCCESS)
69
 
    printether(&etherresult);
70
 
  else
71
 
    printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp));
72
 
 
73
 
  /* test ether_ntohost() */
74
 
  printf("\nTEST ether_ntohost()\n");
75
 
  res=_nss_ldap_getntohost_r(ether_aton("00:E0:4C:39:D3:6A"),
76
 
                             &etherresult,buffer,1024,&errnocp);
77
 
  printf("status=%s\n",nssstatus(res));
78
 
  if (res==NSS_STATUS_SUCCESS)
79
 
    printether(&etherresult);
80
 
  else
81
 
    printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp));
82
 
 
83
 
  /* test {set,get,end}etherent() */
84
 
  printf("\nTEST {set,get,end}etherent()\n");
85
 
  res=_nss_ldap_setetherent(1);
86
 
  printf("status=%s\n",nssstatus(res));
87
 
  while ((res=_nss_ldap_getetherent_r(&etherresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS)
88
 
  {
89
 
    printf("status=%s\n",nssstatus(res));
90
 
    printether(&etherresult);
91
 
  }
92
 
  printf("status=%s\n",nssstatus(res));
93
 
  printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp));
94
 
  res=_nss_ldap_endetherent();
95
 
  printf("status=%s\n",nssstatus(res));
96
 
 
97
 
  return 0;
98
 
}