From c15231d3d82a392faccd7b0a0b4b3f21df3c4469 Mon Sep 17 00:00:00 2001 From: brian Date: Sat, 27 Dec 1997 19:23:13 +0000 Subject: [PATCH] Write to the routing socket as uid 0. It's not good enough to just open it as uid 0 under OpenBSD. --- usr.sbin/ppp/id.c | 14 +++++++++++++- usr.sbin/ppp/id.h | 3 ++- usr.sbin/ppp/route.c | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ppp/id.c b/usr.sbin/ppp/id.c index dbbdefdb57d7..df37339ae8c2 100644 --- a/usr.sbin/ppp/id.c +++ b/usr.sbin/ppp/id.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: id.c,v 1.4 1997/12/21 12:11:05 brian Exp $ */ #include @@ -145,6 +145,18 @@ ID0open(const char *path, int flags) return ret; } +int +ID0write(int fd, const void *data, size_t len) +{ + int ret; + + ID0set0(); + ret = write(fd, data, len); + LogPrintf(LogID0, "%d = write(%d, data, %d)\n", ret, fd, len); + ID0setuser(); + return ret; +} + int ID0uu_lock(const char *basettyname) { diff --git a/usr.sbin/ppp/id.h b/usr.sbin/ppp/id.h index 015a41666995..121e8da331e3 100644 --- a/usr.sbin/ppp/id.h +++ b/usr.sbin/ppp/id.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: id.h,v 1.2 1997/12/21 12:11:05 brian Exp $ */ extern void ID0init(void); @@ -33,5 +33,6 @@ extern int ID0unlink(const char *); extern int ID0socket(int, int, int); extern FILE *ID0fopen(const char *, const char *); extern int ID0open(const char *, int); +extern int ID0write(int, const void *, size_t); extern int ID0uu_lock(const char *); extern int ID0uu_unlock(const char *); diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index dc00dbcb1304..534af942a3b1 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: route.c,v 1.35 1997/12/24 09:29:12 brian Exp $ + * $Id: route.c,v 1.36 1997/12/27 13:45:57 brian Exp $ * */ @@ -138,7 +138,7 @@ OsSetRoute(int cmd, nb = cp - (char *) &rtmes; rtmes.m_rtm.rtm_msglen = nb; - wb = write(s, &rtmes, nb); + wb = ID0write(s, &rtmes, nb); if (wb < 0) { LogPrintf(LogTCPIP, "OsSetRoute failure:\n"); LogPrintf(LogTCPIP, "OsSetRoute: Cmd = %s\n", cmd);