summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/main.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-11-09 06:22:49 +0000
committerbrian <brian@FreeBSD.org>1997-11-09 06:22:49 +0000
commiteae0088b91cbc4408b450aa68745064732b86734 (patch)
tree330d8937c8f71a0d93df3a925214b73ae069d846 /usr.sbin/ppp/main.c
parentadcd7ae702997873c044a63779bc24521e2f9349 (diff)
downloadFreeBSD-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/main.c')
-rw-r--r--usr.sbin/ppp/main.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index 73b6d6c..36ec955 100644
--- a/usr.sbin/ppp/main.c
+++ b/usr.sbin/ppp/main.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: main.c,v 1.87 1997/11/04 01:17:02 brian Exp $
+ * $Id: main.c,v 1.88 1997/11/08 00:28:09 brian Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@@ -47,6 +47,7 @@
#include "mbuf.h"
#include "log.h"
#include "defs.h"
+#include "id.h"
#include "timer.h"
#include "fsm.h"
#include "modem.h"
@@ -82,7 +83,6 @@ static struct termios oldtio; /* Original tty mode */
static struct termios comtio; /* Command level tty mode */
static pid_t BGPid = 0;
static char pid_filename[MAXPATHLEN];
-static char if_filename[MAXPATHLEN];
static int dial_up;
static void DoLoop(void);
@@ -178,8 +178,7 @@ Cleanup(int excode)
nointr_sleep(1);
if (mode & MODE_AUTO)
DeleteIfRoutes(1);
- (void) unlink(pid_filename);
- (void) unlink(if_filename);
+ ID0unlink(pid_filename);
if (mode & MODE_BACKGROUND && BGFiledes[1] != -1) {
char c = EX_ERRDEAD;
@@ -190,9 +189,9 @@ Cleanup(int excode)
close(BGFiledes[1]);
}
LogPrintf(LogPHASE, "PPP Terminated (%s).\n", ex_desc(excode));
- LogClose();
ServerClose();
TtyOldMode();
+ LogClose();
exit(excode);
}
@@ -344,8 +343,8 @@ main(int argc, char **argv)
}
VarTerm = stdout;
}
+ ID0init();
Greetings();
- GetUid();
IpcpDefAddress();
LocalAuthInit();
@@ -475,9 +474,8 @@ main(int argc, char **argv)
snprintf(pid_filename, sizeof(pid_filename), "%stun%d.pid",
_PATH_VARRUN, tunno);
- (void) unlink(pid_filename);
-
- if ((lockfile = fopen(pid_filename, "w")) != NULL) {
+ lockfile = ID0fopen(pid_filename, "w");
+ if (lockfile != NULL) {
fprintf(lockfile, "%d\n", (int) getpid());
fclose(lockfile);
} else
OpenPOWER on IntegriCloud