summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlennart <lennart@bf9bc1cc-28ce-0310-abfb-9041aa761afb>2005-11-19 18:50:07 +0000
committerlennart <lennart@bf9bc1cc-28ce-0310-abfb-9041aa761afb>2005-11-19 18:50:07 +0000
commitafbb33b5242fa09ef6097ba921113ebee92d9780 (patch)
treeb365dc30e1b49cc87e292a88865d6113dfee58de
parent6b21f0cf45ea2a8cd5926393a4c056b3a716c8af (diff)
update nss-myhostname
git-svn-id: svn+ssh://rootserver/home/lennart/svn/private/projects/nss-myhostname@84 bf9bc1cc-28ce-0310-abfb-9041aa761afb
-rw-r--r--Makefile4
-rw-r--r--nss-myhostname.c12
2 files changed, 8 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 9301fab..6b129df 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
CFLAGS=-Wall -pipe -W -O2 -Wextra -Wno-unused-parameter
libnss_myhostname.so.2: nss-myhostname.o
- $(CC) -shared -o $@ -Wl,-soname,$@ $^
+ $(CC) $(CFLAGS) -shared -o $@ -Wl,-soname,$@ $^
strip $@
install:
- install -D -g root -m 644 -o root -s -v libnss_myhostname.so.2 /usr/lib/libnss_myhostname.so.2
+ install -D -g root -m 644 -o root -v libnss_myhostname.so.2 /lib/libnss_myhostname.so.2
clean:
rm -f *.o *~ libnss_myhostname.so.2
diff --git a/nss-myhostname.c b/nss-myhostname.c
index a459fd0..22eddd8 100644
--- a/nss-myhostname.c
+++ b/nss-myhostname.c
@@ -27,7 +27,7 @@
#include <assert.h>
#include <unistd.h>
-#define LOCALADDRESS (htonl(0x7F0002))
+#define LOCALADDRESS (htonl(0x7F000002))
static enum nss_status fill_in_hostent(
const char *hn,
@@ -73,7 +73,7 @@ static enum nss_status fill_in_hostent(
return NSS_STATUS_SUCCESS;
}
-enum nss_status _nss_hostname_gethostbyname2_r(
+enum nss_status _nss_myhostname_gethostbyname2_r(
const char *name,
int af,
struct hostent * result,
@@ -113,7 +113,7 @@ enum nss_status _nss_hostname_gethostbyname2_r(
return fill_in_hostent(hn, result, buffer, buflen, errnop, h_errnop);
}
-enum nss_status _nss_hostname_gethostbyname_r (
+enum nss_status _nss_myhostname_gethostbyname_r (
const char *name,
struct hostent *result,
char *buffer,
@@ -121,7 +121,7 @@ enum nss_status _nss_hostname_gethostbyname_r (
int *errnop,
int *h_errnop) {
- return _nss_hostname_gethostbyname2_r(
+ return _nss_myhostname_gethostbyname2_r(
name,
AF_UNSPEC,
result,
@@ -131,7 +131,7 @@ enum nss_status _nss_hostname_gethostbyname_r (
h_errnop);
}
-enum nss_status _nss_hostname_gethostbyaddr_r(
+enum nss_status _nss_myhostname_gethostbyaddr_r(
const void* addr,
int len,
int af,
@@ -146,7 +146,7 @@ enum nss_status _nss_hostname_gethostbyaddr_r(
assert(errnop);
assert(h_errnop);
- if (af != AF_INET || len != 4 || (*(uint32_t*) addr) != LOCALADDRESS) {
+ if (af != AF_INET || len < 4 || (*(uint32_t*) addr) != LOCALADDRESS) {
*errnop = ENOENT;
*h_errnop = HOST_NOT_FOUND;
return NSS_STATUS_NOTFOUND;