Moved security access test to lib
This commit is contained in:
parent
244d8124b7
commit
deee7eee60
@ -8,12 +8,12 @@ CLCOMM_SRCS = clcomm.c client.c crc.c semafore.c signame.c
|
||||
CLCOMM_OBJS = clcomm.o client.o crc.o semafore.o signame.o
|
||||
CLCOMM_HDRS = clcomm.h
|
||||
COMMON_SRCS = attach.c charconv_utf.c falists.c hdr.c parsedate.c rfcmsg.c unpacker.c \
|
||||
batchrd.c charset.c ftn.c nodelist.c pktname.c mangle.c \
|
||||
batchrd.c charset.c ftn.c nodelist.c pktname.c mangle.c sectest.c \
|
||||
charconv.c dostran.c ftnmsg.c mbfile.c nodelock.c rawio.c strcasestr.c \
|
||||
charconv_hz.c execute.c expipe.c getheader.c mime.c noderecord.c rfcaddr.c strutil.c \
|
||||
charconv_jp.c faddr.c gmtoffset.c packet.c rfcdate.c term.c
|
||||
COMMON_OBJS = ftscprod.o attach.o charconv_utf.o falists.o hdr.o parsedate.o rfcmsg.o unpacker.o \
|
||||
batchrd.o charset.o ftn.o nodelist.o pktname.o mangle.o \
|
||||
batchrd.o charset.o ftn.o nodelist.o pktname.o mangle.o sectest.o \
|
||||
charconv.o dostran.o ftnmsg.o mbfile.o nodelock.o rawio.o strcasestr.o \
|
||||
charconv_hz.o execute.o expipe.o getheader.o mime.o noderecord.o rfcaddr.o strutil.o \
|
||||
charconv_jp.o faddr.o gmtoffset.o packet.o rfcdate.o term.o
|
||||
@ -133,6 +133,7 @@ ftn.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h dbftn.
|
||||
nodelist.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h
|
||||
pktname.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h
|
||||
mangle.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
||||
sectest.o: ../config.h libs.h structs.h common.h clcomm.h
|
||||
charconv.o: ../config.h libs.h memwatch.h structs.h users.h records.h common.h clcomm.h
|
||||
dostran.o: ../config.h libs.h memwatch.h structs.h users.h records.h common.h
|
||||
ftnmsg.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
|
||||
|
@ -920,5 +920,11 @@ void mangle_name_83( char *); /* Mangle name to 8.3 format */
|
||||
void name_mangle(char *); /* Mangle name or make uppercase */
|
||||
|
||||
|
||||
/*
|
||||
* sectest.c
|
||||
*/
|
||||
int Access(securityrec, securityrec); /* Check security access */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
57
lib/sectest.c
Normal file
57
lib/sectest.c
Normal file
@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* Purpose ...............: Security flags access test
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
* 1971 BV IJmuiden
|
||||
* the Netherlands
|
||||
*
|
||||
* This file is part of MBSE BBS.
|
||||
*
|
||||
* This BBS is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* MBSE BBS is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../config.h"
|
||||
#include "libs.h"
|
||||
#include "structs.h"
|
||||
#include "common.h"
|
||||
#include "clcomm.h"
|
||||
|
||||
|
||||
/*
|
||||
* Security Access Check
|
||||
*/
|
||||
int Access(securityrec us, securityrec ref)
|
||||
{
|
||||
Syslog('B', "User %5d %08lx %08lx", us.level, us.flags, ~us.flags);
|
||||
Syslog('B', "Ref. %5d %08lx %08lx", ref.level, ref.flags, ref.notflags);
|
||||
|
||||
if (us.level < ref.level)
|
||||
return FALSE;
|
||||
|
||||
if ((ref.notflags & ~us.flags) != ref.notflags)
|
||||
return FALSE;
|
||||
|
||||
if ((ref.flags & us.flags) != ref.flags)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -414,25 +414,3 @@ char *GLCdateyy()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Security Access Check
|
||||
*/
|
||||
int Access(securityrec us, securityrec ref)
|
||||
{
|
||||
Syslog('B', "User %5d %08lx %08lx", us.level, us.flags, ~us.flags);
|
||||
Syslog('B', "Ref. %5d %08lx %08lx", ref.level, ref.flags, ref.notflags);
|
||||
|
||||
if (us.level < ref.level)
|
||||
return FALSE;
|
||||
|
||||
if ((ref.notflags & ~us.flags) != ref.notflags)
|
||||
return FALSE;
|
||||
|
||||
if ((ref.flags & us.flags) != ref.flags)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,6 +13,5 @@ void CheckDir(char *); /* Check and create directory */
|
||||
void FindMBSE(void); /* Load Configuration file in memory */
|
||||
char *GLCdateyy(void); /* Returns current date DD-Mmm-YYYY */
|
||||
char *GetMonth(int); /* Returns Mmm */
|
||||
int Access(securityrec, securityrec); /* Check security access */
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user