diff options
author | brian <brian@FreeBSD.org> | 1997-11-09 06:22:49 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-11-09 06:22:49 +0000 |
commit | eae0088b91cbc4408b450aa68745064732b86734 (patch) | |
tree | 330d8937c8f71a0d93df3a925214b73ae069d846 /usr.sbin/ppp/route.c | |
parent | adcd7ae702997873c044a63779bc24521e2f9349 (diff) | |
download | FreeBSD-src-eae0088b91cbc4408b450aa68745064732b86734.zip FreeBSD-src-eae0088b91cbc4408b450aa68745064732b86734.tar.gz |
Introduce ID0 logging.
Stay as the invoking uid as much as possible.
Execution as a normal user is still forbidden for now,
so these changes are pretty ineffective.
The next commit will implement the modifications suggested
on -hackers a number of days ago.
Diffstat (limited to 'usr.sbin/ppp/route.c')
-rw-r--r-- | usr.sbin/ppp/route.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index 8bca1f2..b43ca22 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.21 1997/11/08 00:28:11 brian Exp $ + * $Id: route.c,v 1.22 1997/11/09 03:22:49 brian Exp $ * */ @@ -44,6 +44,7 @@ #include "loadalias.h" #include "command.h" #include "vars.h" +#include "id.h" #include "route.h" static int IfIndex; @@ -63,11 +64,12 @@ OsSetRoute(int cmd, { struct rtmsg rtmes; int s, nb, wb; - char *cp; + char *cp, *cmdstr; u_long *lp; struct sockaddr_in rtdata; - s = socket(PF_ROUTE, SOCK_RAW, 0); + cmdstr = (cmd == RTM_ADD ? "Add" : "Delete"); + s = ID0socket(PF_ROUTE, SOCK_RAW, 0); if (s < 0) { LogPrintf(LogERROR, "OsSetRoute: socket(): %s\n", strerror(errno)); return; @@ -122,15 +124,18 @@ OsSetRoute(int cmd, case ESRCH: LogPrintf(LogTCPIP, "Del route failed: Non-existent\n"); break; + case 0: + LogPrintf(LogTCPIP, "%s route failed: %s\n", cmdstr, strerror(errno)); + break; case ENOBUFS: default: - LogPrintf(LogTCPIP, "Add/Del route failed: %s\n", - strerror(rtmes.m_rtm.rtm_errno)); + LogPrintf(LogTCPIP, "%s route failed: %s\n", + cmdstr, strerror(rtmes.m_rtm.rtm_errno)); break; } } - LogPrintf(LogDEBUG, "wrote %d: dst = %x, gateway = %x\n", nb, - dst.s_addr, gateway.s_addr); + LogPrintf(LogDEBUG, "wrote %d: cmd = %s, dst = %x, gateway = %x\n", + wb, cmdstr, dst.s_addr, gateway.s_addr); close(s); } |