From 7db2ebc8f6cf6d4a2c07a074416a2422174f0caf Mon Sep 17 00:00:00 2001 From: kris Date: Mon, 17 Apr 2000 00:01:23 +0000 Subject: Allow applications to disable the installation of the atexit() handler which cleans up OPIE lockfiles. This is required for pam_opie. Submitted by: Jim Bloom --- contrib/opie/libopie/lock.c | 12 ++++++++++-- contrib/opie/opie.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'contrib/opie') diff --git a/contrib/opie/libopie/lock.c b/contrib/opie/libopie/lock.c index fc449d4..0f666a6 100644 --- a/contrib/opie/libopie/lock.c +++ b/contrib/opie/libopie/lock.c @@ -27,6 +27,8 @@ License Agreement applies to this software. error return values. Check open() return value properly. Avoid NULL. Created at NRL for OPIE 2.2 from opiesubr2.c + +$FreeBSD$ */ #include "opie_cfg.h" #if HAVE_STRING_H @@ -49,12 +51,17 @@ License Agreement applies to this software. #endif /* !HAVE_LSTAT */ int __opie_lockrefcount = 0; +static int do_atexit = 1; +VOIDRET opiedisableaeh FUNCTION_NOARGS +{ + do_atexit = 0; +} #if USER_LOCKING char *__opie_lockfilename = (char *)0; /* atexit() handler for opielock() */ -static VOIDRET opieunlockaeh FUNCTION_NOARGS +VOIDRET opieunlockaeh FUNCTION_NOARGS { if (__opie_lockfilename) { __opie_lockrefcount = 0; @@ -227,7 +234,8 @@ int opielock FUNCTION((principal), char *principal) __opie_lockrefcount++; rval = 0; - atexit(opieunlockaeh); + if (do_atexit) + atexit(opieunlockaeh); lockret: if (fh >= 0) diff --git a/contrib/opie/opie.h b/contrib/opie/opie.h index 71db7bd..c41fabf 100644 --- a/contrib/opie/opie.h +++ b/contrib/opie/opie.h @@ -93,6 +93,9 @@ void opiehash __P((void *, unsigned)); int opiehtoi __P((register char)); int opiekeycrunch __P((int, char *, char *, char *)); int opielock __P((char *)); +int opieunlock __P((void)); +void opieunlockaeh __P((void)); +void opiedisableaeh __P((void)); int opielookup __P((struct opie *,char *)); int opiepasscheck __P((char *)); void opierandomchallenge __P((char *)); -- cgit v1.1