Page MenuHomeFreeBSD

D55400.diff
No OneTemporary

D55400.diff

diff --git a/usr.sbin/lpr/lpd/lpd.8 b/usr.sbin/lpr/lpd/lpd.8
--- a/usr.sbin/lpr/lpd/lpd.8
+++ b/usr.sbin/lpr/lpd/lpd.8
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd April 15, 2021
+.Dd February 19, 2026
.Dt LPD 8
.Os
.Sh NAME
@@ -34,6 +34,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl cdlpsFW46
+.Op Fl t Ar timeout
.Op Ar port#
.Sh DEPRECATION NOTICE
This facility is scheduled for removal prior to the release of
@@ -108,6 +109,11 @@
will not accept any connections from any remote
hosts, although it will still accept print requests
from all local users.
+.It Fl t Ar timeout
+Set the network receive timeout for client connections to
+.Ar timeout
+seconds.
+The default is 120.
.It Fl F
By default,
.Nm
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -61,28 +61,28 @@
*/
#include <sys/param.h>
-#include <sys/wait.h>
-#include <sys/types.h>
+#include <sys/file.h>
#include <sys/socket.h>
-#include <sys/un.h>
#include <sys/stat.h>
-#include <sys/file.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <syslog.h>
-#include <signal.h>
+#include <ctype.h>
+#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
-#include <dirent.h>
+#include <netdb.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
-#include <ctype.h>
+#include <syslog.h>
+#include <unistd.h>
#include "lp.h"
#include "lp.local.h"
#include "pathnames.h"
@@ -117,6 +117,7 @@
int
main(int argc, char **argv)
{
+ struct timeval tv = { .tv_sec = 120 };
int ch_options, errs, f, funix, *finet, i, lfd, socket_debug;
fd_set defreadfds;
struct sockaddr_un un, fromunix;
@@ -139,7 +140,7 @@
errx(EX_NOPERM,"must run as root");
errs = 0;
- while ((i = getopt(argc, argv, "cdlpswFW46")) != -1)
+ while ((i = getopt(argc, argv, "cdlpst:wFW46")) != -1)
switch (i) {
case 'c':
/* log all kinds of connection-errors to syslog */
@@ -159,6 +160,9 @@
case 's': /* secure (no inet) */
sflag++;
break;
+ case 't':
+ tv.tv_sec = atol(optarg);
+ break;
case 'w': /* netbsd uses -w for maxwait */
/*
* This will be removed after the release of 4.4, as
@@ -386,6 +390,10 @@
syslog(LOG_WARNING, "accept: %m");
continue;
}
+ if (tv.tv_sec > 0) {
+ (void) setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv,
+ sizeof(tv));
+ }
if (fork() == 0) {
/*
* Note that printjob() also plays around with

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 25, 4:57 PM (7 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28992198
Default Alt Text
D55400.diff (2 KB)

Event Timeline