nss-pam-ldapd commit: r1539 - nss-pam-ldapd/nslcd
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1539 - nss-pam-ldapd/nslcd
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1539 - nss-pam-ldapd/nslcd
- Date: Thu, 8 Sep 2011 22:52:55 +0200 (CEST)
Author: arthur
Date: Thu Sep 8 22:52:51 2011
New Revision: 1539
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1539&view=revision
Log:
give string representations of addresses more logical names
Modified:
nss-pam-ldapd/nslcd/ether.c
nss-pam-ldapd/nslcd/host.c
nss-pam-ldapd/nslcd/network.c
Modified: nss-pam-ldapd/nslcd/ether.c
==============================================================================
--- nss-pam-ldapd/nslcd/ether.c Wed Sep 7 22:04:38 2011 (r1538)
+++ nss-pam-ldapd/nslcd/ether.c Thu Sep 8 22:52:51 2011 (r1539)
@@ -5,7 +5,7 @@
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong
+ Copyright (C) 2006, 2007, 2009, 2010, 2011 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -77,13 +77,9 @@
attmap_ether_cn,safename);
}
-static int mkfilter_ether_byether(const struct ether_addr *addr,
+static int mkfilter_ether_byether(const char *addrstr,
char *buffer,size_t buflen)
{
- char ethername[20];
- /* transform into string */
- if (ether_ntoa_r(addr,ethername)==NULL)
- return -1;
/* FIXME: this has a bug when the directory has 01:00:0e:...
and we're looking for 1:0:e:... (leading zeros) */
/* there should be no characters that need escaping */
@@ -91,7 +87,7 @@
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
ether_filter,
- attmap_ether_macAddress,ethername);
+ attmap_ether_macAddress,addrstr);
}
void ether_init(void)
@@ -175,15 +171,15 @@
NSLCD_HANDLE(
ether,byether,
struct ether_addr addr;
- char ether[20];
+ char addrstr[20];
char filter[1024];
READ_TYPE(fp,addr,uint8_t[6]);
- if (ether_ntoa_r(&addr,ether)==NULL)
+ if (ether_ntoa_r(&addr,addrstr)==NULL)
return -1;
- log_setrequest("ether=%s",ether);,
+ log_setrequest("ether=%s",addrstr);,
NSLCD_ACTION_ETHER_BYETHER,
- mkfilter_ether_byether(&addr,filter,sizeof(filter)),
- write_ether(fp,entry,NULL,ether)
+ mkfilter_ether_byether(addrstr,filter,sizeof(filter)),
+ write_ether(fp,entry,NULL,addrstr)
)
NSLCD_HANDLE(
Modified: nss-pam-ldapd/nslcd/host.c
==============================================================================
--- nss-pam-ldapd/nslcd/host.c Wed Sep 7 22:04:38 2011 (r1538)
+++ nss-pam-ldapd/nslcd/host.c Thu Sep 8 22:52:51 2011 (r1539)
@@ -78,12 +78,12 @@
attmap_host_cn,safename);
}
-static int mkfilter_host_byaddr(const char *addrname,
+static int mkfilter_host_byaddr(const char *addrstr,
char *buffer,size_t buflen)
{
char safeaddr[64];
/* escape attribute */
- if (myldap_escape(addrname,safeaddr,sizeof(safeaddr)))
+ if (myldap_escape(addrstr,safeaddr,sizeof(safeaddr)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
@@ -167,18 +167,18 @@
int af;
char addr[64];
int len=sizeof(addr);
- char addrname[64];
+ char addrstr[64];
char filter[1024];
READ_ADDRESS(fp,addr,len,af);
/* translate the address to a string */
- if (inet_ntop(af,addr,addrname,sizeof(addrname))==NULL)
+ if (inet_ntop(af,addr,addrstr,sizeof(addrstr))==NULL)
{
log_log(LOG_WARNING,"unable to convert address to string");
return -1;
}
- log_setrequest("host=%s",addrname);,
+ log_setrequest("host=%s",addrstr);,
NSLCD_ACTION_HOST_BYADDR,
- mkfilter_host_byaddr(addrname,filter,sizeof(filter)),
+ mkfilter_host_byaddr(addrstr,filter,sizeof(filter)),
write_host(fp,entry)
)
Modified: nss-pam-ldapd/nslcd/network.c
==============================================================================
--- nss-pam-ldapd/nslcd/network.c Wed Sep 7 22:04:38 2011 (r1538)
+++ nss-pam-ldapd/nslcd/network.c Thu Sep 8 22:52:51 2011 (r1539)
@@ -76,12 +76,12 @@
attmap_network_cn,safename);
}
-static int mkfilter_network_byaddr(const char *addrname,
+static int mkfilter_network_byaddr(const char *addrstr,
char *buffer,size_t buflen)
{
char safeaddr[64];
/* escape attribute */
- if (myldap_escape(addrname,safeaddr,sizeof(safeaddr)))
+ if (myldap_escape(addrstr,safeaddr,sizeof(safeaddr)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
@@ -165,18 +165,18 @@
int af;
char addr[64];
int len=sizeof(addr);
- char addrname[64];
+ char addrstr[64];
char filter[1024];
READ_ADDRESS(fp,addr,len,af);
/* translate the address to a string */
- if (inet_ntop(af,addr,addrname,sizeof(addrname))==NULL)
+ if (inet_ntop(af,addr,addrstr,sizeof(addrstr))==NULL)
{
log_log(LOG_WARNING,"unable to convert address to string");
return -1;
}
- log_setrequest("network=%s",addrname);,
+ log_setrequest("network=%s",addrstr);,
NSLCD_ACTION_NETWORK_BYADDR,
- mkfilter_network_byaddr(addrname,filter,sizeof(filter)),
+ mkfilter_network_byaddr(addrstr,filter,sizeof(filter)),
write_network(fp,entry)
)
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/
- nss-pam-ldapd commit: r1539 - nss-pam-ldapd/nslcd,
Commits of the nss-pam-ldapd project