diff --git a/lib/Makefile b/lib/Makefile index ec8861d8..4f95c2ec 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -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 diff --git a/lib/common.h b/lib/common.h index 51aed7e6..81e459dc 100644 --- a/lib/common.h +++ b/lib/common.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 diff --git a/lib/sectest.c b/lib/sectest.c new file mode 100644 index 00000000..abfe46aa --- /dev/null +++ b/lib/sectest.c @@ -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; +} + diff --git a/mbsebbs/funcs.c b/mbsebbs/funcs.c index 257353a5..ccc11e7c 100644 --- a/mbsebbs/funcs.c +++ b/mbsebbs/funcs.c @@ -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; -} - - diff --git a/mbsebbs/funcs.h b/mbsebbs/funcs.h index bb7ccdce..b30dab1a 100644 --- a/mbsebbs/funcs.h +++ b/mbsebbs/funcs.h @@ -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