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 <bloom@acm.org>
This commit is contained in:
Kris Kennaway 2000-04-17 00:01:23 +00:00
parent e50c89eca8
commit bf1d0435ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=59300
2 changed files with 13 additions and 2 deletions

View File

@ -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)

View File

@ -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 *));