diff options
author | brian <brian@FreeBSD.org> | 1997-12-27 19:23:13 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-12-27 19:23:13 +0000 |
commit | c15231d3d82a392faccd7b0a0b4b3f21df3c4469 (patch) | |
tree | ce07fc9ebe98b9c3bc31f16580bea55095e2f9db | |
parent | 9eec71e4627db28802c11ebba87b942c601ff60d (diff) | |
download | FreeBSD-src-c15231d3d82a392faccd7b0a0b4b3f21df3c4469.zip FreeBSD-src-c15231d3d82a392faccd7b0a0b4b3f21df3c4469.tar.gz |
Write to the routing socket as uid 0. It's not good enough
to just open it as uid 0 under OpenBSD.
-rw-r--r-- | usr.sbin/ppp/id.c | 14 | ||||
-rw-r--r-- | usr.sbin/ppp/id.h | 3 | ||||
-rw-r--r-- | 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 dbbdefd..df37339 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 <sys/types.h> @@ -146,6 +146,18 @@ ID0open(const char *path, int flags) } 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) { int ret; diff --git a/usr.sbin/ppp/id.h b/usr.sbin/ppp/id.h index 015a416..121e8da 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 dc00dbc..534af94 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); |