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/modem.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/modem.c')
-rw-r--r-- | usr.sbin/ppp/modem.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index 9015d4e..89d0726 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: modem.c,v 1.61 1997/10/29 01:19:44 brian Exp $ + * $Id: modem.c,v 1.62 1997/11/08 00:28:09 brian Exp $ * * TODO: */ @@ -38,16 +38,12 @@ #include <termios.h> #include <time.h> #include <unistd.h> -#ifdef __OpenBSD__ -#include <util.h> -#else -#include <libutil.h> -#endif #include <utmp.h> #include "mbuf.h" #include "log.h" #include "defs.h" +#include "id.h" #include "timer.h" #include "fsm.h" #include "hdlc.h" @@ -59,6 +55,11 @@ #include "vars.h" #include "main.h" #include "chat.h" +#ifdef __OpenBSD__ +#include <util.h> +#else +#include <libutil.h> +#endif #ifndef O_NONBLOCK #ifdef O_NDELAY @@ -440,7 +441,7 @@ LockModem() if (*VarDevice != '/') return 0; - if (!(mode & MODE_DIRECT) && (res = uu_lock(VarBaseDevice)) != UU_LOCK_OK) { + if (!(mode & MODE_DIRECT) && (res = ID0uu_lock(VarBaseDevice)) != UU_LOCK_OK) { if (res == UU_LOCK_INUSE) LogPrintf(LogPHASE, "Modem %s is in use\n", VarDevice); else @@ -450,9 +451,8 @@ LockModem() } snprintf(fn, sizeof fn, "%s%s.if", _PATH_VARRUN, VarBaseDevice); - (void) unlink(fn); - - if ((lockfile = fopen(fn, "w")) != NULL) { + lockfile = ID0fopen(fn, "w"); + if (lockfile != NULL) { fprintf(lockfile, "tun%d\n", tunno); fclose(lockfile); } else @@ -468,10 +468,10 @@ UnlockModem() return; snprintf(fn, sizeof fn, "%s%s.if", _PATH_VARRUN, VarBaseDevice); - if (unlink(fn) == -1) + if (ID0unlink(fn) == -1) LogPrintf(LogALERT, "Warning: Can't remove %s: %s\n", fn, strerror(errno)); - if (!(mode & MODE_DIRECT) && uu_unlock(VarBaseDevice) == -1) + if (!(mode & MODE_DIRECT) && ID0uu_unlock(VarBaseDevice) == -1) LogPrintf(LogALERT, "Warning: Can't uu_unlock %s\n", fn); } @@ -517,7 +517,7 @@ OpenModem() if (strncmp(VarDevice, "/dev/", 5) == 0) { if (LockModem() == -1) return (-1); - modem = open(VarDevice, O_RDWR | O_NONBLOCK); + modem = ID0open(VarDevice, O_RDWR | O_NONBLOCK); if (modem < 0) { LogPrintf(LogERROR, "OpenModem failed: %s: %s\n", VarDevice, strerror(errno)); |