From 6b0f06d93512264346464af31bff441feb7a0bcd Mon Sep 17 00:00:00 2001 From: tls Date: Sun, 2 Apr 2006 19:16:22 +0000 Subject: [PATCH] Fix the conditional compilation on ACULOG so it actually works. Turn it off by default -- it hardly saves any space, but it's one of the reasons why the executable is installed setuid, and other versions of tip/cu don't write a log file anyway. We can add syslog support later if we ever really want this back, the file-writing is all encapsulated in log.c. --- usr.bin/tip/Makefile | 10 +++++----- usr.bin/tip/acu.c | 27 ++++++++++++++++++++++++--- usr.bin/tip/cu.c | 6 ++++-- usr.bin/tip/remote.c | 4 ++-- usr.bin/tip/tip.c | 6 ++++-- usr.bin/tip/tip.h | 2 +- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/usr.bin/tip/Makefile b/usr.bin/tip/Makefile index de8048d7cef1..f6b5303f1749 100644 --- a/usr.bin/tip/Makefile +++ b/usr.bin/tip/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2006/04/02 19:00:40 tls Exp $ +# $NetBSD: Makefile,v 1.16 2006/04/02 19:16:22 tls Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # # Files are: @@ -34,8 +34,8 @@ WARNS=4 PROG= tip CPPFLAGS+=-I${.CURDIR} \ - -DDEFBR=9600 -DDEFFS=BUFSIZ -DACULOG -DPRISTINE -DCONNECT \ - -DHAYES #-DV831 -DVENTEL -DHAYES -DCOURIER -DT3000 + -DDEFBR=9600 -DDEFFS=BUFSIZ -DCONNECT \ + -DHAYES #-DV831 -DVENTEL -DHAYES -DCOURIER -DT3000 -DACULOG -DPRISTINE .PATH: ${.CURDIR}/aculib BINOWN= uucp BINGRP= dialer @@ -46,7 +46,7 @@ SRCS= acu.c acutab.c cmds.c cmdtab.c cu.c hunt.c log.c partab.c \ # -- acutab is configuration dependent, and so depends on the Makefile # -- remote.o depends on the Makefile because of DEFBR and DEFFS -# -- log.o depends on the Makefile because of ACULOG -acutab.o log.o remote.o: Makefile +# -- log.o, cu.o, acu.o, tip.o depend on the Makefile because of ACULOG +acutab.o log.o cu.o acu.o tip.o remote.o: Makefile .include diff --git a/usr.bin/tip/acu.c b/usr.bin/tip/acu.c index 1504ec3fb295..98c7c8586f4d 100644 --- a/usr.bin/tip/acu.c +++ b/usr.bin/tip/acu.c @@ -1,4 +1,4 @@ -/* $NetBSD: acu.c,v 1.9 2004/04/23 22:11:44 christos Exp $ */ +/* $NetBSD: acu.c,v 1.10 2006/04/02 19:16:22 tls Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: acu.c,v 1.9 2004/04/23 22:11:44 christos Exp $"); +__RCSID("$NetBSD: acu.c,v 1.10 2006/04/02 19:16:22 tls Exp $"); #endif /* not lint */ #include "tip.h" @@ -78,7 +78,9 @@ connect() if (!DU) { /* regular connect message */ if (CM != NULL) xpwrite(FD, CM, strlen(CM)); +#ifdef ACULOG logent(value(HOST), "", DV, "call completed"); +#endif return (NULL); } /* @@ -91,7 +93,9 @@ connect() signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); printf("\ncall aborted\n"); +#ifdef ACULOG logent(value(HOST), "", "", "call aborted"); +#endif if (acu != NULL) { setboolean(value(VERBOSE), FALSE); if (conflag) @@ -113,12 +117,16 @@ connect() if ((conflag = (*acu->acu_dialer)(phnum, CU)) != 0) { if (CM != NULL) xpwrite(FD, CM, strlen(CM)); +#ifdef ACULOG logent(value(HOST), phnum, acu->acu_name, "call completed"); +#endif return (NULL); } else +#ifdef ACULOG logent(value(HOST), phnum, acu->acu_name, "call failed"); +#endif tried++; } } else { @@ -151,18 +159,25 @@ connect() fclose(fd); if (CM != NULL) xpwrite(FD, CM, strlen(CM)); +#ifdef ACULOG logent(value(HOST), phnum, acu->acu_name, "call completed"); +#endif return (NULL); } else +#ifdef ACULOG logent(value(HOST), phnum, acu->acu_name, "call failed"); +#endif tried++; } fclose(fd); } - if (!tried) + if (!tried) { +#ifdef ACULOG logent(value(HOST), "", acu->acu_name, "missing phone number"); +#endif + } else (*acu->acu_abort)(); return (tried ? "call failed" : "missing phone number"); @@ -174,15 +189,21 @@ disconnect(reason) { if (!conflag) { +#ifdef ACULOG logent(value(HOST), "", DV, "call terminated"); +#endif return; } if (reason == NULL) { +#ifdef ACULOG logent(value(HOST), "", acu->acu_name, "call terminated"); +#endif if (boolean(value(VERBOSE))) printf("\r\ndisconnecting..."); } else +#ifdef ACULOG logent(value(HOST), "", acu->acu_name, reason); +#endif (*acu->acu_disconnect)(); } diff --git a/usr.bin/tip/cu.c b/usr.bin/tip/cu.c index edfe8c6cfc56..a17fa3345d91 100644 --- a/usr.bin/tip/cu.c +++ b/usr.bin/tip/cu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cu.c,v 1.10 2006/04/02 19:04:24 tls Exp $ */ +/* $NetBSD: cu.c,v 1.11 2006/04/02 19:16:22 tls Exp $ */ /* * Copyright (c) 1983, 1993 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: cu.c,v 1.10 2006/04/02 19:04:24 tls Exp $"); +__RCSID("$NetBSD: cu.c,v 1.11 2006/04/02 19:16:22 tls Exp $"); #endif /* not lint */ #include "tip.h" @@ -186,7 +186,9 @@ cumain(argc, argv) exit(3); } setbuf(stdout, NULL); +#ifdef ACULOG loginit(); +#endif user_uid(); vinit(); switch (parity) { diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c index fdb5bfdda8ba..49ad11aac4b1 100644 --- a/usr.bin/tip/remote.c +++ b/usr.bin/tip/remote.c @@ -1,4 +1,4 @@ -/* $NetBSD: remote.c,v 1.14 2006/04/02 19:03:55 tls Exp $ */ +/* $NetBSD: remote.c,v 1.15 2006/04/02 19:16:22 tls Exp $ */ /* * Copyright (c) 1992, 1993 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if 0 static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: remote.c,v 1.14 2006/04/02 19:03:55 tls Exp $"); +__RCSID("$NetBSD: remote.c,v 1.15 2006/04/02 19:16:22 tls Exp $"); #endif /* not lint */ #include "pathnames.h" diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c index a0f3ebf96c29..9f311e87c228 100644 --- a/usr.bin/tip/tip.c +++ b/usr.bin/tip/tip.c @@ -1,4 +1,4 @@ -/* $NetBSD: tip.c,v 1.33 2006/04/02 19:04:24 tls Exp $ */ +/* $NetBSD: tip.c,v 1.34 2006/04/02 19:16:22 tls Exp $ */ /* * Copyright (c) 1983, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: tip.c,v 1.33 2006/04/02 19:04:24 tls Exp $"); +__RCSID("$NetBSD: tip.c,v 1.34 2006/04/02 19:16:22 tls Exp $"); #endif /* not lint */ /* @@ -148,7 +148,9 @@ notnumber: exit(3); } setbuf(stdout, NULL); +#ifdef ACULOG loginit(); +#endif /* * Now that we have the logfile and the ACU open diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h index 9becc9ecc3aa..e57a5449466a 100644 --- a/usr.bin/tip/tip.h +++ b/usr.bin/tip/tip.h @@ -1,4 +1,4 @@ -/* $NetBSD: tip.h,v 1.18 2006/04/02 19:04:24 tls Exp $ */ +/* $NetBSD: tip.h,v 1.19 2006/04/02 19:16:22 tls Exp $ */ /* * Copyright (c) 1989, 1993