summaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2013-12-20 09:29:29 +0100
committerThomas Schwinge <thomas@codesourcery.com>2013-12-20 09:29:29 +0100
commita65dd355fb80a05215e15ae97649de52aec885e3 (patch)
tree81701bb0c6b648630f2bf1729a85d7f5eb49e67b /nscd
parent296a5732f94abe4d5699dc981e4ccfb950b48cee (diff)
parentb4578bab30f72cddd2cf38abfb39f9c8dc892249 (diff)
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Diffstat (limited to 'nscd')
-rw-r--r--nscd/Makefile2
-rw-r--r--nscd/aicache.c15
-rw-r--r--nscd/initgrcache.c15
-rw-r--r--nscd/netgroupcache.c4
-rw-r--r--nscd/nscd.service18
-rw-r--r--nscd/nscd.tmpfiles4
-rw-r--r--nscd/nscd_getserv_r.c2
7 files changed, 40 insertions, 20 deletions
diff --git a/nscd/Makefile b/nscd/Makefile
index 7b36cc9820..b8498da886 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -60,7 +60,7 @@ endif
nscd-modules += selinux
selinux-LIBS := -lselinux $(libaudit) $(libcap)
-# The configure.in check for libselinux and its headers did not use
+# The configure.ac check for libselinux and its headers did not use
# $SYSINCLUDES. The directory specified by --with-headers usually
# contains only the basic kernel interface headers, not something like
# libselinux. So the simplest thing is to presume that the standard
diff --git a/nscd/aicache.c b/nscd/aicache.c
index fd55852ed8..713e41a2e8 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -86,20 +86,19 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
}
static service_user *hosts_database;
- service_user *nip = NULL;
+ service_user *nip;
int no_more;
int rc6 = 0;
int rc4 = 0;
int herrno = 0;
- if (hosts_database != NULL)
- {
- nip = hosts_database;
- no_more = 0;
- }
- else
+ if (hosts_database == NULL)
no_more = __nss_database_lookup ("hosts", NULL,
- "dns [!UNAVAIL=return] files", &nip);
+ "dns [!UNAVAIL=return] files",
+ &hosts_database);
+ else
+ no_more = 0;
+ nip = hosts_database;
/* Initialize configurations. */
if (__glibc_unlikely (!_res_hconf.initialized))
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index 462780e624..4580884ead 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -80,17 +80,16 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
}
static service_user *group_database;
- service_user *nip = NULL;
+ service_user *nip;
int no_more;
- if (group_database != NULL)
- {
- nip = group_database;
- no_more = 0;
- }
- else
+ if (group_database == NULL)
no_more = __nss_database_lookup ("group", NULL,
- "compat [NOTFOUND=return] files", &nip);
+ "compat [NOTFOUND=return] files",
+ &group_database);
+ else
+ no_more = 0;
+ nip = group_database;
/* We always use sysconf even if NGROUPS_MAX is defined. That way, the
limit can be raised in the kernel configuration without having to
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
index dd06ce4fae..a607dda0a5 100644
--- a/nscd/netgroupcache.c
+++ b/nscd/netgroupcache.c
@@ -591,10 +591,10 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
# endif
}
else
+#endif
{
-# ifndef __ASSUME_SENDFILE
+#if defined HAVE_SENDFILE && !defined __ASSUME_SENDFILE
use_write:
-# endif
#endif
writeall (fd, &dataset->resp, sizeof (innetgroup_response_header));
}
diff --git a/nscd/nscd.service b/nscd/nscd.service
new file mode 100644
index 0000000000..99c7563990
--- /dev/null
+++ b/nscd/nscd.service
@@ -0,0 +1,18 @@
+# systemd service file for nscd
+
+[Unit]
+Description=Name Service Cache Daemon
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/nscd --foreground
+ExecStop=/usr/sbin/nscd --shutdown
+ExecReload=/usr/sbin/nscd -i passwd
+ExecReload=/usr/sbin/nscd -i group
+ExecReload=/usr/sbin/nscd -i hosts
+ExecReload=/usr/sbin/nscd -i services
+Restart=always
+PIDFile=/run/nscd/nscd.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/nscd/nscd.tmpfiles b/nscd/nscd.tmpfiles
new file mode 100644
index 0000000000..52edbba673
--- /dev/null
+++ b/nscd/nscd.tmpfiles
@@ -0,0 +1,4 @@
+# Configuration to create /run/nscd directory
+# Used as part of systemd's tmpfiles
+
+d /run/nscd 0755 root root
diff --git a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c
index c9c890c63c..772825854d 100644
--- a/nscd/nscd_getserv_r.c
+++ b/nscd/nscd_getserv_r.c
@@ -54,7 +54,7 @@ __nscd_getservbyport_r (int port, const char *proto,
portstr[sizeof (portstr) - 1] = '\0';
char *cp = _itoa_word (port, portstr + sizeof (portstr) - 1, 10, 0);
- return nscd_getserv_r (cp, portstr + sizeof (portstr) - cp, proto,
+ return nscd_getserv_r (cp, portstr + sizeof (portstr) - 1 - cp, proto,
GETSERVBYPORT, result_buf, buf, buflen, result);
}