summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr
diff options
context:
space:
mode:
authornaddy <naddy@openbsd.org>2013-12-10 16:38:04 +0000
committernaddy <naddy@openbsd.org>2013-12-10 16:38:04 +0000
commitcf85265f962132658a079732ee151b937707ed16 (patch)
tree3791c3ef5298241e4323ff4abd07437f98fbbf32 /usr.sbin/lpr
parentUnset fuse_mnt in fusefs_unmount after vflushing and freeing fbufs in use. (diff)
downloadwireguard-openbsd-cf85265f962132658a079732ee151b937707ed16.tar.xz
wireguard-openbsd-cf85265f962132658a079732ee151b937707ed16.zip
Remove the printcap fc, fs, xc, xs capabilities from lpd that were used
to configure a tty by poking magic numbers into sgtty. If needed, the ms capability, which uses symbolic stty modes, can be used instead. Better description of ms from FreeBSD. ok beck@, deraadt@, jmc@ (man page)
Diffstat (limited to 'usr.sbin/lpr')
-rw-r--r--usr.sbin/lpr/common_source/common.c6
-rw-r--r--usr.sbin/lpr/common_source/lp.h6
-rw-r--r--usr.sbin/lpr/lpd/Makefile4
-rw-r--r--usr.sbin/lpr/lpd/extern.h6
-rw-r--r--usr.sbin/lpr/lpd/printjob.c27
-rw-r--r--usr.sbin/lpr/lpd/ttcompat.c302
6 files changed, 6 insertions, 345 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index bdf5691dccd..10b293d75fb 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.34 2012/03/04 04:05:15 fgsch Exp $ */
+/* $OpenBSD: common.c,v 1.35 2013/12/10 16:38:04 naddy Exp $ */
/* $NetBSD: common.c,v 1.21 2000/08/09 14:28:50 itojun Exp $ */
/*
@@ -66,9 +66,7 @@ long BR; /* baud rate if lp is a tty */
char *CF; /* name of cifplot filter (per job) */
char *DF; /* name of tex filter (per job) */
long DU; /* daemon user-id */
-long FC; /* flags to clear if lp is a tty */
char *FF; /* form feed string */
-long FS; /* flags to set if lp is a tty */
char *GF; /* name of graph(1G) filter (per job) */
long HL; /* print header last */
char *IF; /* name of input filter (created per job) */
@@ -99,8 +97,6 @@ char *ST; /* status file name */
char *TF; /* name of troff filter (per job) */
char *TR; /* trailer string to be output when Q empties */
char *VF; /* name of vplot filter (per job) */
-long XC; /* flags to clear for local mode */
-long XS; /* flags to set for local mode */
char line[BUFSIZ];
int remote; /* true if sending files to a remote host */
diff --git a/usr.sbin/lpr/common_source/lp.h b/usr.sbin/lpr/common_source/lp.h
index bb70128e5bb..1c3307daba0 100644
--- a/usr.sbin/lpr/common_source/lp.h
+++ b/usr.sbin/lpr/common_source/lp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lp.h,v 1.17 2012/12/05 23:20:26 deraadt Exp $ */
+/* $OpenBSD: lp.h,v 1.18 2013/12/10 16:38:04 naddy Exp $ */
/* $NetBSD: lp.h,v 1.14 2000/04/16 14:43:58 mrg Exp $ */
/*
@@ -42,9 +42,7 @@ extern long BR; /* baud rate if lp is a tty */
extern char *CF; /* name of cifplot filter (per job) */
extern char *DF; /* name of tex filter (per job) */
extern long DU; /* daemon user-id */
-extern long FC; /* flags to clear if lp is a tty */
extern char *FF; /* form feed string */
-extern long FS; /* flags to set if lp is a tty */
extern char *GF; /* name of graph(1G) filter (per job) */
extern long HL; /* print header last */
extern char *IF; /* name of input filter (created per job) */
@@ -75,8 +73,6 @@ extern char *ST; /* status file name */
extern char *TF; /* name of troff(1) filter (per job) */
extern char *TR; /* trailer string to be output when Q empties */
extern char *VF; /* name of raster filter (per job) */
-extern long XC; /* flags to clear for local mode */
-extern long XS; /* flags to set for local mode */
extern char line[BUFSIZ];
extern char *bp; /* pointer into printcap buffer */
diff --git a/usr.sbin/lpr/lpd/Makefile b/usr.sbin/lpr/lpd/Makefile
index 5d64e87885e..1ac4092dfaa 100644
--- a/usr.sbin/lpr/lpd/Makefile
+++ b/usr.sbin/lpr/lpd/Makefile
@@ -1,11 +1,11 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $OpenBSD: Makefile,v 1.4 2002/06/08 01:53:43 millert Exp $
+# $OpenBSD: Makefile,v 1.5 2013/12/10 16:38:04 naddy Exp $
PROG= lpd
CFLAGS+=-I${.CURDIR}/../common_source
MAN= lpd.8
SRCS= lpd.c printjob.c recvjob.c displayq.c rmjob.c startdaemon.c \
- lpdchar.c common.c key.c modes.c ttcompat.c common_vars.c
+ lpdchar.c common.c key.c modes.c common_vars.c
BINGRP= daemon
BINMODE=2550
.PATH: ${.CURDIR}/../common_source
diff --git a/usr.sbin/lpr/lpd/extern.h b/usr.sbin/lpr/lpd/extern.h
index b2d0d64bebf..3b2c86f5094 100644
--- a/usr.sbin/lpr/lpd/extern.h
+++ b/usr.sbin/lpr/lpd/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.7 2012/12/05 23:20:26 deraadt Exp $ */
+/* $OpenBSD: extern.h,v 1.8 2013/12/10 16:38:04 naddy Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -52,7 +52,3 @@ int ksearch(char ***, struct info *);
int msearch(char ***, struct info *);
void printjob(void);
void recvjob(void);
-void sttyclearflags(struct termios *tp, int flags);
-void sttysetflags(struct termios *tp, int flags);
-void sttyclearlflags(struct termios *tp, int flags);
-void sttysetlflags(struct termios *tp, int flags);
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c
index d3cb8dc4782..33cde8db42c 100644
--- a/usr.sbin/lpr/lpd/printjob.c
+++ b/usr.sbin/lpr/lpd/printjob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printjob.c,v 1.48 2013/11/24 21:32:32 deraadt Exp $ */
+/* $OpenBSD: printjob.c,v 1.49 2013/12/10 16:38:04 naddy Exp $ */
/* $NetBSD: printjob.c,v 1.31 2002/01/21 14:42:30 wiz Exp $ */
/*
@@ -1302,14 +1302,6 @@ init(void)
RW = (cgetcap(bp, "rw", ':') != NULL);
cgetnum(bp, "br", &BR);
- if (cgetnum(bp, "fc", &FC) < 0)
- FC = 0;
- if (cgetnum(bp, "fs", &FS) < 0)
- FS = 0;
- if (cgetnum(bp, "xc", &XC) < 0)
- XC = 0;
- if (cgetnum(bp, "xs", &XS) < 0)
- XS = 0;
cgetstr(bp, "ms", &MS);
tof = (cgetcap(bp, "fo", ':') == NULL);
@@ -1582,23 +1574,6 @@ setty(void)
syslog(LOG_INFO, "%s: unknown stty flag: %s",
printer, *argv);
}
- } else {
- if (FC) {
- sttyclearflags(&i.t, FC);
- i.set = 1;
- }
- if (FS) {
- sttysetflags(&i.t, FS);
- i.set = 1;
- }
- if (XC) {
- sttyclearlflags(&i.t, XC);
- i.set = 1;
- }
- if (XS) {
- sttysetlflags(&i.t, XS);
- i.set = 1;
- }
}
if (i.set && tcsetattr(i.fd, TCSANOW, &i.t) < 0) {
diff --git a/usr.sbin/lpr/lpd/ttcompat.c b/usr.sbin/lpr/lpd/ttcompat.c
deleted file mode 100644
index ad5ac839f35..00000000000
--- a/usr.sbin/lpr/lpd/ttcompat.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* $OpenBSD: ttcompat.c,v 1.7 2009/10/27 23:59:52 deraadt Exp $ */
-/* $NetBSD: ttcompat.c,v 1.9 1995/11/15 22:50:00 pk Exp $ */
-
-/*
- * Copyright (c) 1995
- * The Regents of the University of California. All rights reserved.
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * ttcompat.c -- convert sgtty flags to termios
- * originally from /sys/kern/tty_compat.c
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <unistd.h>
-#include <sys/ioctl_compat.h>
-#include <termios.h>
-#include <syslog.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "extern.h"
-
-/* Macros to clear/set/test flags. */
-#define SET(t, f) (t) |= (f)
-#define CLR(t, f) (t) &= ~(f)
-#define ISSET(t, f) ((t) & (f))
-
-static int sttygetoflags(struct termios *);
-static void sttysetoflags(struct termios *, int);
-
-static int
-sttygetoflags(struct termios *tp)
-{
- tcflag_t iflag = tp->c_iflag;
- tcflag_t lflag = tp->c_lflag;
- tcflag_t oflag = tp->c_oflag;
- tcflag_t cflag = tp->c_cflag;
- int flags = 0;
-
- if (ISSET(cflag, PARENB)) {
- if (ISSET(iflag, INPCK)) {
- if (ISSET(cflag, PARODD))
- SET(flags, ODDP);
- else
- SET(flags, EVENP);
- } else
- SET(flags, EVENP|ODDP);
- }
- if (ISSET(cflag, CSIZE) == CS8) {
- if (!ISSET(iflag, ISTRIP))
- SET(flags, PASS8);
- if (!ISSET(oflag, OPOST))
- SET(flags, LITOUT);
- }
- if (ISSET(lflag, XCASE))
- SET(flags, LCASE);
-
- if (!ISSET(lflag, ICANON)) {
- /* fudge */
- if (ISSET(iflag, IXON) || ISSET(lflag, ISIG|IEXTEN) ||
- ISSET(cflag, PARENB))
- SET(flags, CBREAK);
- else
- SET(flags, RAW);
- }
-
- return (flags);
-}
-
-static void
-sttysetoflags(struct termios *tp, int flags)
-{
- tcflag_t iflag = tp->c_iflag;
- tcflag_t oflag = tp->c_oflag;
- tcflag_t lflag = tp->c_lflag;
- tcflag_t cflag = tp->c_cflag;
-
- if (ISSET(flags, RAW)) {
- iflag &= IXOFF;
- CLR(lflag, ISIG|ICANON|IEXTEN|XCASE);
- CLR(cflag, PARENB);
- } else {
- SET(iflag, BRKINT|IXON|IMAXBEL);
- SET(lflag, ISIG|IEXTEN);
- if (ISSET(flags, CBREAK))
- CLR(lflag, ICANON);
- else
- SET(lflag, ICANON);
- if (ISSET(iflag, IUCLC) && ISSET(oflag, OLCUC))
- SET(lflag, XCASE);
- switch (ISSET(flags, ANYP)) {
- case 0:
- CLR(cflag, PARENB);
- break;
- case ANYP:
- SET(cflag, PARENB);
- CLR(iflag, INPCK);
- break;
- case EVENP:
- SET(cflag, PARENB);
- SET(iflag, INPCK);
- CLR(cflag, PARODD);
- break;
- case ODDP:
- SET(cflag, PARENB);
- SET(iflag, INPCK);
- SET(cflag, PARODD);
- break;
- }
- }
-
- if (ISSET(flags, RAW|LITOUT|PASS8)) {
- CLR(cflag, CSIZE);
- SET(cflag, CS8);
- if (!ISSET(flags, RAW|PASS8))
- SET(iflag, ISTRIP);
- else
- CLR(iflag, ISTRIP);
- if (!ISSET(flags, RAW|LITOUT))
- SET(oflag, OPOST);
- else
- CLR(oflag, OPOST);
- } else {
- CLR(cflag, CSIZE);
- SET(cflag, CS7);
- SET(iflag, ISTRIP);
- SET(oflag, OPOST);
- }
-
- tp->c_iflag = iflag;
- tp->c_oflag = oflag;
- tp->c_lflag = lflag;
- tp->c_cflag = cflag;
-}
-
-void
-sttyclearflags(struct termios *tp, int flags)
-{
- tcflag_t iflag = tp->c_iflag;
- tcflag_t oflag = tp->c_oflag;
- tcflag_t lflag = tp->c_lflag;
- tcflag_t cflag = tp->c_cflag;
- int oflags = sttygetoflags(tp) & ~flags;
-
- if (ISSET(flags, TANDEM))
- CLR(iflag, IXOFF);
- if (ISSET(flags, ECHO))
- CLR(lflag, ECHO);
- if (ISSET(flags, CRMOD)) {
- CLR(iflag, ICRNL);
- CLR(oflag, ONLCR);
- }
- if (ISSET(flags, LCASE)) {
- CLR(iflag, IUCLC);
- CLR(oflag, OLCUC);
- CLR(lflag, XCASE);
- }
- if (ISSET(flags, XTABS))
- CLR(oflag, OXTABS);
-
-
- tp->c_iflag = iflag;
- tp->c_oflag = oflag;
- tp->c_lflag = lflag;
- tp->c_cflag = cflag;
-
- sttysetoflags(tp, oflags);
-}
-
-void
-sttysetflags(struct termios *tp, int flags)
-{
- tcflag_t iflag = tp->c_iflag;
- tcflag_t oflag = tp->c_oflag;
- tcflag_t lflag = tp->c_lflag;
- tcflag_t cflag = tp->c_cflag;
- int oflags = sttygetoflags(tp) | flags;
-
- if (ISSET(flags, TANDEM))
- SET(iflag, IXOFF);
- if (ISSET(flags, ECHO))
- SET(lflag, ECHO);
- if (ISSET(flags, CRMOD)) {
- SET(iflag, ICRNL);
- SET(oflag, ONLCR);
- }
- if (ISSET(flags, LCASE)) {
- SET(iflag, IUCLC);
- SET(oflag, OLCUC);
- SET(lflag, XCASE);
- }
- if (ISSET(flags, XTABS))
- SET(oflag, OXTABS);
-
- tp->c_iflag = iflag;
- tp->c_oflag = oflag;
- tp->c_lflag = lflag;
- tp->c_cflag = cflag;
-
- sttysetoflags(tp, oflags);
-}
-
-void
-sttyclearlflags(struct termios *tp, int flags)
-{
- tcflag_t iflag = tp->c_iflag;
- tcflag_t oflag = tp->c_oflag;
- tcflag_t lflag = tp->c_lflag;
- tcflag_t cflag = tp->c_cflag;
- int oflags = sttygetoflags(tp) & ~flags;
-
- /* Nothing we can do with CRTBS. */
- if (ISSET(flags, PRTERA))
- CLR(lflag, ECHOPRT);
- if (ISSET(flags, CRTERA))
- CLR(lflag, ECHOE);
- /* Nothing we can do with TILDE. */
- if (ISSET(flags, MDMBUF))
- CLR(cflag, MDMBUF);
- if (ISSET(flags, NOHANG))
- SET(cflag, HUPCL);
- if (ISSET(flags, CRTKIL))
- CLR(lflag, ECHOKE);
- if (ISSET(flags, CTLECH))
- CLR(lflag, ECHOCTL);
- if (ISSET(flags, DECCTQ))
- SET(iflag, IXANY);
- CLR(lflag, ISSET(flags, TOSTOP|FLUSHO|PENDIN|NOFLSH));
-
- tp->c_iflag = iflag;
- tp->c_oflag = oflag;
- tp->c_lflag = lflag;
- tp->c_cflag = cflag;
-
- sttysetoflags(tp, oflags);
-}
-
-void
-sttysetlflags(struct termios *tp, int flags)
-{
- tcflag_t iflag = tp->c_iflag;
- tcflag_t oflag = tp->c_oflag;
- tcflag_t lflag = tp->c_lflag;
- tcflag_t cflag = tp->c_cflag;
- int oflags = sttygetoflags(tp) | flags;
-
- /* Nothing we can do with CRTBS. */
- if (ISSET(flags, PRTERA))
- SET(lflag, ECHOPRT);
- if (ISSET(flags, CRTERA))
- SET(lflag, ECHOE);
- /* Nothing we can do with TILDE. */
- if (ISSET(flags, MDMBUF))
- SET(cflag, MDMBUF);
- if (ISSET(flags, NOHANG))
- CLR(cflag, HUPCL);
- if (ISSET(flags, CRTKIL))
- SET(lflag, ECHOKE);
- if (ISSET(flags, CTLECH))
- SET(lflag, ECHOCTL);
- if (ISSET(flags, DECCTQ))
- CLR(iflag, IXANY);
- SET(lflag, ISSET(flags, TOSTOP|FLUSHO|PENDIN|NOFLSH));
-
- tp->c_iflag = iflag;
- tp->c_oflag = oflag;
- tp->c_lflag = lflag;
- tp->c_cflag = cflag;
-
- sttysetoflags(tp, oflags);
-}