summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>1997-12-27 19:22:29 +0000
committerbrian <brian@cvs.openbsd.org>1997-12-27 19:22:29 +0000
commita9dc2c9a85547e3103792e978400aae63a057930 (patch)
tree5d6f65417176eacf092f59fa31f89ce9654471eb /usr.sbin
parent620782ad72dc562f184f5c57e4c66d5f16339a52 (diff)
Write to the routing socket as uid 0. It's not good enough
to just open it as uid 0 under OpenBSD.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/id.c14
-rw-r--r--usr.sbin/ppp/id.h3
-rw-r--r--usr.sbin/ppp/route.c4
3 files changed, 17 insertions, 4 deletions
diff --git a/usr.sbin/ppp/id.c b/usr.sbin/ppp/id.c
index 3b81b954da2..7495c691f76 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.c,v 1.2 1997/12/21 14:27:03 brian Exp $
+ * $Id: id.c,v 1.3 1997/12/27 19:22:26 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 a55b254b4ca..5d7b4b3aee6 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.h,v 1.2 1997/12/21 14:27:04 brian Exp $
+ * $Id: id.h,v 1.3 1997/12/27 19:22:27 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 7b9cc293341..1c796a6d5ac 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.9 1997/12/27 13:45:21 brian Exp $
+ * $Id: route.c,v 1.10 1997/12/27 19:22:28 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);