From owner-freebsd-audit Sat Aug 18 23:58:39 2001 Delivered-To: freebsd-audit@freebsd.org Received: from obsecurity.dyndns.org (adsl-63-207-60-7.dsl.lsan03.pacbell.net [63.207.60.7]) by hub.freebsd.org (Postfix) with ESMTP id C505337B407 for ; Sat, 18 Aug 2001 23:58:34 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id 1AA3966D3E; Sat, 18 Aug 2001 23:58:34 -0700 (PDT) Date: Sat, 18 Aug 2001 23:58:33 -0700 From: Kris Kennaway To: ig25@rz.uni-karlsruhe.de, audit@FreeBSD.org Subject: at(1) signal handler fix Message-ID: <20010818235833.A36306@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable This patch is adapted from OpenBSD..please review. Kris Index: at.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /mnt/ncvs/src/usr.bin/at/at.c,v retrieving revision 1.19 diff -u -r1.19 at.c --- at.c 2001/07/24 14:15:51 1.19 +++ at.c 2001/08/19 06:58:02 @@ -113,6 +113,7 @@ char *atinput =3D (char*)0; /* where to get input from */ char atqueue =3D 0; /* which queue to examine for jobs (atq) */ char atverify =3D 0; /* verify time instead of queuing job */ +char *namep; =20 /* Function declarations */ =20 @@ -135,14 +136,23 @@ PRIV_END } =20 - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } =20 static void alarmc(int signo) { -/* Time out after some seconds - */ - panic("file locking timed out"); + char buf[1024]; + + /* Time out after some seconds. */ + strlcpy(buf, namep, sizeof(buf)); + strlcat(buf, ": file locking timed out\n", sizeof(buf)); + write(STDERR_FILENO, buf, strlen(buf)); + if (fcreated) { + PRIV_START + unlink(atfile); + PRIV_END + } + _exit(EXIT_FAILURE); } =20 /* Local functions */ @@ -611,6 +621,8 @@ else pgm++; =20 + namep =3D pgm; + /* find out what this program is supposed to do */ if (strcmp(pgm, "atq") =3D=3D 0) { @@ -695,8 +707,9 @@ */ =20 if (disp_version) - fprintf(stderr, "at version " VERSION "\n" - "Bug reports to: ig25@rz.uni-karlsruhe.de (Thomas Koenig)\n"); + fprintf(stderr, "%s version " VERSION "\n" + "Bug reports to: ig25@rz.uni-karlsruhe.de (Thomas Koenig)\n", + namep); =20 /* select our program */ --MGYHOYXEY6WxJCY8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7f2OZWry0BWjoQKURAlwPAJoCo1uY+8VNKKhZxkomCzQznGnVCQCfciiX XJWTEXPe4O617GpellZXheM= =q8Xs -----END PGP SIGNATURE----- --MGYHOYXEY6WxJCY8-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message