summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2015-09-29 02:37:29 +0000
committermillert <millert@openbsd.org>2015-09-29 02:37:29 +0000
commit1e18bebc8d22dda344cdf46f42b8579473c85b94 (patch)
treeba0f568c06e56df40006c3ddb8c942d2ddf393e3
parentMark eread(), veread(), and eformat() as printf-like and (diff)
downloadwireguard-openbsd-1e18bebc8d22dda344cdf46f42b8579473c85b94.tar.xz
wireguard-openbsd-1e18bebc8d22dda344cdf46f42b8579473c85b94.zip
Replace call to __ivaliduser_sa() with a pared down version that
only checks the host name. This clears the way for removal of __ivaliduser_sa() and __ivaliduser() from libc. OK deraadt@
-rw-r--r--usr.sbin/lpr/lpd/Makefile4
-rw-r--r--usr.sbin/lpr/lpd/extern.h5
-rw-r--r--usr.sbin/lpr/lpd/lpd.c9
3 files changed, 8 insertions, 10 deletions
diff --git a/usr.sbin/lpr/lpd/Makefile b/usr.sbin/lpr/lpd/Makefile
index 1ac4092dfaa..4af9d844a3c 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.5 2013/12/10 16:38:04 naddy Exp $
+# $OpenBSD: Makefile,v 1.6 2015/09/29 02:37:29 millert 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 common_vars.c
+ lpdchar.c common.c key.c modes.c common_vars.c allowedhost.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 3b2c86f5094..81cb453ed57 100644
--- a/usr.sbin/lpr/lpd/extern.h
+++ b/usr.sbin/lpr/lpd/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.8 2013/12/10 16:38:04 naddy Exp $ */
+/* $OpenBSD: extern.h,v 1.9 2015/09/29 02:37:29 millert Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -32,6 +32,8 @@
*/
#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <stdio.h>
#include <termios.h>
/*
@@ -48,6 +50,7 @@ struct info {
struct winsize win; /* window info */
};
+int allowedhost(FILE *, struct sockaddr *, socklen_t);
int ksearch(char ***, struct info *);
int msearch(char ***, struct info *);
void printjob(void);
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
index dad94bf0a23..033ae8f2630 100644
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpd.c,v 1.58 2015/02/09 23:00:14 deraadt Exp $ */
+/* $OpenBSD: lpd.c,v 1.59 2015/09/29 02:37:29 millert Exp $ */
/* $NetBSD: lpd.c,v 1.33 2002/01/21 14:42:29 wiz Exp $ */
/*
@@ -111,9 +111,6 @@ static int ckqueue(char *);
static __dead void usage(void);
static int *socksetup(int, int, const char *);
-extern int __ivaliduser_sa(FILE *, struct sockaddr *, socklen_t,
- const char *, const char *);
-
/* unused, needed for lpc */
volatile sig_atomic_t gotintr;
@@ -650,8 +647,6 @@ ckqueue(char *cap)
return (0);
}
-#define DUMMY ":nobody::"
-
/*
* Check to see if the from host has access to the line printer.
*/
@@ -715,7 +710,7 @@ chkhost(struct sockaddr *f)
hostf = fopen(_PATH_HOSTSLPD, "r");
PRIV_END;
if (hostf) {
- if (__ivaliduser_sa(hostf, f, f->sa_len, DUMMY, DUMMY) == 0) {
+ if (allowedhost(hostf, f, f->sa_len) == 0) {
(void)fclose(hostf);
return;
}