//=========================================================================//
//       Security Front End for Internet Addresser 3.0 for Wildcat 4.01    //
//                                                                         //
//                                                                         //
// Purpose: To restrict access to Internet Addresser via Sysop Configurable//
//          Security Levels or a file called BADUSER.LST                   //
//                                                                         //
// To Compile: Place this .wcc in the same directory as IAUUCP3.WCX and run//
//             this command from that directory:                           //
//                  WCC INADDFE.WCC                                        //
//                                                                         //
// To Use: Start MAKEMENU and replace IAUUCP3.WCX with INADDFE.WCX in the   //
//         command you use to start Internet Addresser with.               //
//                                                                         //
//         Edit the File INADDFE.INI and enter the names of the Security   //
//         Profiles you would like to have access to Internet Addresser    //
//                                                                         //
//         Edit the file BADUSER.LST and enter the names of the users      //
//         thatt you don't want to have access to INADD3                   //
//                                                                         //
//          Note: The Security names MUST be spelled correctly, one per    //
//                line with no extra information in the file.              //
//                The Security names are CASE SENSITIVE.                   //
//                                                                         //
//    No Error Trapping is coded in for the file operations. This is       //
//    Something you may want to add.                                       //
//                                                                         //
//    Written by Kevin Erickson, Cyberdeck Systems Software, 1994          //
//         YOU MAY FREELY DISTRIBUTE THIS SOURCE CODE AND PROGRAM          //
//         MODIFY IT TO SUIT YOUR NEEDS - JUST LEAVE A LITTLE CREDIT       //
//         IN HERE FOR US! <GRIN>                                          //
//-------------------------------------------------------------------------//

Dim AccessSecurity as string *25        // Security levels to allow access
Dim BadUser as string                   // Baduser's Variable (temp)

Dim Sec_ok as Integer                   // This variable is true if the user
                                        // has access, false if not.

Dim Bad_User as Integer                 //This variable is true if the user's
                                        //Name is found in the BADUSER.LST,
                                        //false if not.

Declare Function CheckSecurity(USec as String, ASec as string) as Integer
        //This function returns true if the user's security allows
        //access. This function also sets the Sec_ok variable to true if
        //the function returns true.

Declare Function CheckUser(UName as String, BName as string) As Integer
        //This function returns true is the User's name was found in the
        //BADUSER.LST. This function also sets the Bad_User variable to
        //true if the function returns true.


Sec_ok = False      //This makes an inital assumption of False
Bad_User = False    //This also...


Open (Progpath + "inaddfe.ini") for input as #1       //Opens the .INI file
                                                      //To read in Security
                                                      //levels.
  While Not (EOF(1))
    Input #1, AccessSecurity
    If Checksecurity((User.SecLevel), (AccessSecurity)) then
      Sec_ok = True    //If the Users Security matches one of the ones
                       //defined in INADDFE.INI then Sec_ok is True.
    End if
  Wend

Close #1

If Sec_ok = False then goto NoWay            //If the Users Sec. Level was
                                             //not found in the .INI file
                                             //Deny Access.


Open (Progpath + "baduser.lst") for input as #1     //Opens the BADUSER.LST
                                                    //to check users name.
   While Not (EOF(1))
     Input #1, Baduser
     If CheckUser((User.Name), (Baduser)) then
       Bad_User = True         //If the User's name was found in the file then
                               //Bad_User is True
     End if
   Wend
Close #1

If Bad_User = True then goto Noway          //If the User's name was found in
                                            //the BADUSER.LST then deny access


Chain (progpath + "iauucp3.wcx")             //Start Internet Addresser 3.0 UUCP
Goto Finish


NoWay:                                      //This is what is told to the user
                                            //when access is denied. Please
                                            //leave my credit in there. :)
Print
Print "@0E@INADDFE - 1994 CyberDeck Systems Software@0F@"
Print
Print "Sorry you do not have the required access for this function. If you feel"
Print "This is in error, please leave a comment to the Sysop. Thank you.@0E@"
Print
Waitenter


Finish:                                   // End of Program
End


          // These are the Function Definitions:

Function CheckUser(UName as string, BName as String) As Integer
  CheckUser = False
  If Uname = Bname then
    CheckUser = True
  End if
End Function

Function CheckSecurity(Usec as String, Asec as string) as Integer
  CheckSecurity = False
  If Usec = Asec then
     CheckSecurity = True
  End if
End Function
