Write to the routing socket as uid 0. It's not good enough

to just open it as uid 0 under OpenBSD.
This commit is contained in:
brian 1997-12-27 19:23:13 +00:00
parent 9eec71e462
commit c15231d3d8
3 changed files with 17 additions and 4 deletions

View File

@ -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>
@ -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)
{

View File

@ -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 *);

View File

@ -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);