[svn-upgrade] Integrating new upstream version, shadow (4.0.11)

This commit is contained in:
nekral-guest
2007-10-07 11:46:34 +00:00
parent 8c50e06102
commit b48129fcbb
153 changed files with 8441 additions and 6643 deletions

View File

@@ -13,7 +13,8 @@
/* Version number of the daemon interface */
#define NSCD_VERSION 2
/* Path for the Unix domain socket. */
#define _PATH_NSCDSOCKET "/var/run/.nscd_socket"
#define _PATH_NSCDSOCKET "/var/run/nscd/socket"
#define _PATH_NSCDSOCKET_OLD "/var/run/.nscd_socket"
/* Available services. */
typedef enum {
@@ -57,8 +58,15 @@ static int nscd_open_socket (void)
assert (sizeof (addr.sun_path) >= sizeof (_PATH_NSCDSOCKET));
strcpy (addr.sun_path, _PATH_NSCDSOCKET);
if (connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
close (sock);
return -1;
addr.sun_family = AF_UNIX;
assert (sizeof (addr.sun_path) >=
sizeof (_PATH_NSCDSOCKET_OLD));
strcpy (addr.sun_path, _PATH_NSCDSOCKET_OLD);
if (connect (sock, (struct sockaddr *) &addr, sizeof (addr)) <
0) {
close (sock);
return -1;
}
}
return sock;
@@ -71,6 +79,7 @@ int nscd_flush_cache (char *service)
{
int sock = nscd_open_socket ();
request_header req;
struct iovec iov[2];
ssize_t nbytes;
if (sock == -1)
@@ -78,15 +87,15 @@ int nscd_flush_cache (char *service)
req.version = NSCD_VERSION;
req.type = INVALIDATE;
req.key_len = strlen (service) + 1;
nbytes = write (sock, &req, sizeof (request_header));
if (nbytes != sizeof (request_header)) {
close (sock);
return -1;
}
req.key_len = strlen (service);
nbytes = write (sock, (void *) service, req.key_len);
iov[0].iov_base = &req;
iov[0].iov_len = sizeof (req);
iov[1].iov_base = service;
iov[1].iov_len = req.key_len;
nbytes = writev (sock, iov, 2);
close (sock);
return (nbytes != req.key_len ? (-1) : 0);
return (nbytes != iov[0].iov_len + iov[1].iov_len ? (-1) : 0);
}