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

« back to all changes in this revision

Viewing changes to nslcd/ether.c

  • Committer: Package Import Robot
  • Author(s): Arthur de Jong
  • Date: 2011-12-31 13:30:00 UTC
  • Revision ID: package-import@ubuntu.com-20111231133000-c2lpa27xp5s6q481
Tags: 0.8.5
* support larger gecos values (closes: #640781)
* updated Swedish debconf translation by Martin Bagge (closes: #640623)
* consistently handle whitespace in configuration file during package
  configuration (thanks Nick) (closes: #641619)
* add a versioned dependency on libpam0g to ensure the PAM libraries are
  multiarch-aware
* in debconf, treat the "hard" value for tls_reqcert as if it was "demand"
  (closes: #642347)
* reduce loglevel of user not found messages to avoid spamming the logs
  with useless information (thanks Wakko Warner) (closes: #641820)
* other logging improvements
* keep nslcd running during package upgrades (closes: #644892)
* explicitly parse numbers as base 10 (thanks Jakub Hrozek)
* implement FreeBSD group membership NSS function (thanks Tom Judge)
* fix an issue where changes in /etc/nsswitch.conf were not correctly
  picked up and could lead to lookups being disabled on upgrade
  (closes: #645599)
* fix an issue with detecting the uid of the calling process and log
  denied shadow requests in debug mode
* fix a typo in the disconnect logic code (thanks Martin Poole)
* enable hardening options during build
* implement configuration file handling in pynslcd and other pynslcd
  improvements (pynslcd is not in a Debian package yet)
* update debian/copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
   Copyright (C) 1997-2005 Luke Howard
7
7
   Copyright (C) 2006 West Consulting
8
 
   Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong
 
8
   Copyright (C) 2006, 2007, 2009, 2010, 2011 Arthur de Jong
9
9
 
10
10
   This library is free software; you can redistribute it and/or
11
11
   modify it under the terms of the GNU Lesser General Public
77
77
                   attmap_ether_cn,safename);
78
78
}
79
79
 
80
 
static int mkfilter_ether_byether(const struct ether_addr *addr,
 
80
static int mkfilter_ether_byether(const char *addrstr,
81
81
                                  char *buffer,size_t buflen)
82
82
{
83
 
  char ethername[20];
84
 
  /* transform into string */
85
 
  if (ether_ntoa_r(addr,ethername)==NULL)
86
 
    return -1;
87
83
  /* FIXME: this has a bug when the directory has 01:00:0e:...
88
84
            and we're looking for 1:0:e:... (leading zeros) */
89
85
  /* there should be no characters that need escaping */
91
87
  return mysnprintf(buffer,buflen,
92
88
                   "(&%s(%s=%s))",
93
89
                   ether_filter,
94
 
                   attmap_ether_macAddress,ethername);
 
90
                   attmap_ether_macAddress,addrstr);
95
91
}
96
92
 
97
93
void ether_init(void)
127
123
  names=myldap_get_values(entry,attmap_ether_cn);
128
124
  if ((names==NULL)||(names[0]==NULL))
129
125
  {
130
 
    log_log(LOG_WARNING,"ether entry %s does not contain %s value",
 
126
    log_log(LOG_WARNING,"%s: %s: missing",
131
127
                        myldap_get_dn(entry),attmap_ether_cn);
132
128
    return 0;
133
129
  }
143
139
    ethers=myldap_get_values(entry,attmap_ether_macAddress);
144
140
    if ((ethers==NULL)||(ethers[0]==NULL))
145
141
    {
146
 
      log_log(LOG_WARNING,"ether entry %s does not contain %s value",
 
142
      log_log(LOG_WARNING,"%s: %s: missing",
147
143
                          myldap_get_dn(entry),attmap_ether_macAddress);
148
144
      return 0;
149
145
    }
175
171
NSLCD_HANDLE(
176
172
  ether,byether,
177
173
  struct ether_addr addr;
178
 
  char ether[20];
 
174
  char addrstr[20];
179
175
  char filter[1024];
180
176
  READ_TYPE(fp,addr,uint8_t[6]);
181
 
  if (ether_ntoa_r(&addr,ether)==NULL)
 
177
  if (ether_ntoa_r(&addr,addrstr)==NULL)
182
178
    return -1;
183
 
  log_setrequest("ether=%s",ether);,
 
179
  log_setrequest("ether=%s",addrstr);,
184
180
  NSLCD_ACTION_ETHER_BYETHER,
185
 
  mkfilter_ether_byether(&addr,filter,sizeof(filter)),
186
 
  write_ether(fp,entry,NULL,ether)
 
181
  mkfilter_ether_byether(addrstr,filter,sizeof(filter)),
 
182
  write_ether(fp,entry,NULL,addrstr)
187
183
)
188
184
 
189
185
NSLCD_HANDLE(