Do not print Broken Pipe error messages when requesting a large group
This commit is contained in:
parent
6fed55d7da
commit
0ae6295014
143
nss-pam-ldapd-0.7.x-epipe.patch
Normal file
143
nss-pam-ldapd-0.7.x-epipe.patch
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
diff -up nss-pam-ldapd-0.7.15/common/tio.c.epipe nss-pam-ldapd-0.7.15/common/tio.c
|
||||||
|
--- nss-pam-ldapd-0.7.15/common/tio.c.epipe 2010-09-24 09:07:17.000000000 +0200
|
||||||
|
+++ nss-pam-ldapd-0.7.15/common/tio.c 2012-03-15 11:39:00.945065541 +0100
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
tio.c - timed io functions
|
||||||
|
This file is part of the nss-pam-ldapd library.
|
||||||
|
|
||||||
|
- Copyright (C) 2007, 2008 Arthur de Jong
|
||||||
|
+ Copyright (C) 2007, 2008, 2010, 2011, 2012 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
|
||||||
|
@@ -34,6 +34,7 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
+#include <limits.h>
|
||||||
|
|
||||||
|
#include "tio.h"
|
||||||
|
|
||||||
|
@@ -229,6 +230,7 @@ int tio_read(TFILE *fp, void *buf, size_
|
||||||
|
int rv;
|
||||||
|
uint8_t *tmp;
|
||||||
|
size_t newsz;
|
||||||
|
+ size_t len;
|
||||||
|
/* have a more convenient storage type for the buffer */
|
||||||
|
uint8_t *ptr=(uint8_t *)buf;
|
||||||
|
/* build a time by which we should be finished */
|
||||||
|
@@ -293,7 +295,12 @@ int tio_read(TFILE *fp, void *buf, size_
|
||||||
|
if (tio_select(fp,1,&deadline))
|
||||||
|
return -1;
|
||||||
|
/* read the input in the buffer */
|
||||||
|
- rv=read(fp->fd,fp->readbuffer.buffer+fp->readbuffer.start,fp->readbuffer.size-fp->readbuffer.start);
|
||||||
|
+ len=fp->readbuffer.size-fp->readbuffer.start;
|
||||||
|
+#ifdef SSIZE_MAX
|
||||||
|
+ if (len>SSIZE_MAX)
|
||||||
|
+ len=SSIZE_MAX;
|
||||||
|
+#endif /* SSIZE_MAX */
|
||||||
|
+ rv=read(fp->fd,fp->readbuffer.buffer+fp->readbuffer.start,len);
|
||||||
|
/* check for errors */
|
||||||
|
if ((rv==0)||((rv<0)&&(errno!=EINTR)&&(errno!=EAGAIN)))
|
||||||
|
return -1; /* something went wrong with the read */
|
||||||
|
@@ -305,10 +312,39 @@ int tio_read(TFILE *fp, void *buf, size_
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Read and discard the specified number of bytes from the stream. */
|
||||||
|
+/* Read and discard the specified number of bytes from the stream.
|
||||||
|
+ If count is 0 reads and discards any data that can be read and empties
|
||||||
|
+ the read buffer. */
|
||||||
|
int tio_skip(TFILE *fp, size_t count)
|
||||||
|
{
|
||||||
|
- return tio_read(fp,NULL,count);
|
||||||
|
+ int rv;
|
||||||
|
+ size_t len;
|
||||||
|
+ /* for simple cases just read */
|
||||||
|
+ if (count>0)
|
||||||
|
+ {
|
||||||
|
+ return tio_read(fp,NULL,count);
|
||||||
|
+ }
|
||||||
|
+ /* clear the read buffer */
|
||||||
|
+ fp->readbuffer.start=0;
|
||||||
|
+ fp->readbuffer.len=0;
|
||||||
|
+ fp->read_resettable=0;
|
||||||
|
+ /* read until we can't read no more */
|
||||||
|
+ len=fp->readbuffer.size;
|
||||||
|
+#ifdef SSIZE_MAX
|
||||||
|
+ if (len>SSIZE_MAX)
|
||||||
|
+ len=SSIZE_MAX;
|
||||||
|
+#endif /* SSIZE_MAX */
|
||||||
|
+ while (1)
|
||||||
|
+ {
|
||||||
|
+ rv=read(fp->fd,fp->readbuffer.buffer,len);
|
||||||
|
+ /* check for errors */
|
||||||
|
+ if (rv==0)
|
||||||
|
+ return 0; /* end-of-file */
|
||||||
|
+ if ((rv<0)&&(errno==EWOULDBLOCK))
|
||||||
|
+ return 0; /* we've ready everything we can without blocking */
|
||||||
|
+ if ((rv<0)&&(errno!=EINTR)&&(errno!=EAGAIN))
|
||||||
|
+ return -1; /* something went wrong with the read */
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the caller has assured us that we can write to the file descriptor
|
||||||
|
diff -up nss-pam-ldapd-0.7.15/common/tio.h.epipe nss-pam-ldapd-0.7.15/common/tio.h
|
||||||
|
--- nss-pam-ldapd-0.7.15/common/tio.h.epipe 2010-09-24 09:07:17.000000000 +0200
|
||||||
|
+++ nss-pam-ldapd-0.7.15/common/tio.h 2012-03-15 11:39:00.945065541 +0100
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
tio.h - timed io functions
|
||||||
|
This file is part of the nss-pam-ldapd library.
|
||||||
|
|
||||||
|
- Copyright (C) 2007, 2008 Arthur de Jong
|
||||||
|
+ Copyright (C) 2007, 2008, 2010, 2012 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
|
||||||
|
@@ -56,7 +56,9 @@ TFILE *tio_fdopen(int fd,struct timeval
|
||||||
|
/* Read the specified number of bytes from the stream. */
|
||||||
|
int tio_read(TFILE *fp,void *buf,size_t count);
|
||||||
|
|
||||||
|
-/* Read and discard the specified number of bytes from the stream. */
|
||||||
|
+/* Read and discard the specified number of bytes from the stream.
|
||||||
|
+ If count is 0 reads and discards any data that can be read and empties
|
||||||
|
+ the read buffer. */
|
||||||
|
int tio_skip(TFILE *fp,size_t count);
|
||||||
|
|
||||||
|
/* Write the specified buffer to the stream. */
|
||||||
|
diff -up nss-pam-ldapd-0.7.15/nss/common.h.epipe nss-pam-ldapd-0.7.15/nss/common.h
|
||||||
|
--- nss-pam-ldapd-0.7.15/nss/common.h.epipe 2010-09-24 09:07:18.000000000 +0200
|
||||||
|
+++ nss-pam-ldapd-0.7.15/nss/common.h 2012-03-15 11:40:13.106390324 +0100
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
common.h - common functions for NSS lookups
|
||||||
|
|
||||||
|
Copyright (C) 2006 West Consulting
|
||||||
|
- Copyright (C) 2006, 2007, 2008, 2009, 2010 Arthur de Jong
|
||||||
|
+ Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 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
|
||||||
|
@@ -98,6 +98,7 @@
|
||||||
|
retv=readfn; \
|
||||||
|
/* close socket and we're done */ \
|
||||||
|
if ((retv==NSS_STATUS_SUCCESS)||(retv==NSS_STATUS_TRYAGAIN)) \
|
||||||
|
+ (void)tio_skip(fp,0); /* read any buffered data */ \
|
||||||
|
(void)tio_close(fp); \
|
||||||
|
return retv;
|
||||||
|
|
||||||
|
@@ -177,13 +178,14 @@
|
||||||
|
fp=NULL; /* file should be closed by now */ \
|
||||||
|
return retv;
|
||||||
|
|
||||||
|
-/* This macro generates a endent() function body. This just closes
|
||||||
|
+/* This macro generates an endent() function body. This just closes
|
||||||
|
the stream. */
|
||||||
|
#define NSS_ENDENT(fp) \
|
||||||
|
if (!_nss_ldap_enablelookups) \
|
||||||
|
return NSS_STATUS_UNAVAIL; \
|
||||||
|
if (fp!=NULL) \
|
||||||
|
{ \
|
||||||
|
+ (void)tio_skip(fp,0); /* read any buffered data */ \
|
||||||
|
(void)tio_close(fp); \
|
||||||
|
fp=NULL; \
|
||||||
|
} \
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
Name: nss-pam-ldapd
|
Name: nss-pam-ldapd
|
||||||
Version: 0.7.15
|
Version: 0.7.15
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: An nsswitch module which uses directory servers
|
Summary: An nsswitch module which uses directory servers
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
@ -27,6 +27,7 @@ Source4: nslcd.service
|
|||||||
Patch1: nss-pam-ldapd-0.7.13-validname.patch
|
Patch1: nss-pam-ldapd-0.7.13-validname.patch
|
||||||
Patch2: nss-pam-ldapd-0.7.x-dnssrv.patch
|
Patch2: nss-pam-ldapd-0.7.x-dnssrv.patch
|
||||||
Patch3: nss-pam-ldapd-0.7.x-uid-overflow.patch
|
Patch3: nss-pam-ldapd-0.7.x-uid-overflow.patch
|
||||||
|
Patch4: nss-pam-ldapd-0.7.x-epipe.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
BuildRequires: openldap-devel, krb5-devel
|
BuildRequires: openldap-devel, krb5-devel
|
||||||
BuildRequires: autoconf, automake
|
BuildRequires: autoconf, automake
|
||||||
@ -62,6 +63,7 @@ nsswitch module.
|
|||||||
%patch1 -p0 -b .validname
|
%patch1 -p0 -b .validname
|
||||||
%patch2 -p1 -b .dnssrv
|
%patch2 -p1 -b .dnssrv
|
||||||
%patch3 -p1 -b .overflow
|
%patch3 -p1 -b .overflow
|
||||||
|
%patch4 -p1 -b .epipe
|
||||||
autoreconf -f -i
|
autoreconf -f -i
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
Loading…
Reference in New Issue
Block a user