home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / UT / UT070.ZIP / MENUS.EXE / LOGIN.MNU < prev    next >
Text File  |  1991-04-08  |  17KB  |  678 lines

  1. Comment
  2. ========================================================
  3.  
  4. Copyright 1990 by Marc Perkel * All right reserved.
  5.  
  6. MarxMenu now allows you to login to a Novell network without using
  7. Novell's login program or messing with nasty login scripts. You can
  8. be in MarxMenu all the way in.
  9.  
  10. Logging into Novell is tricky. Especially if you are using boot roms
  11. on your network cards. Through much trial and error, I have found
  12. some solid tricks that make life easier.
  13.  
  14. You should have the following two BATCH files in your LOGIN
  15. directory as follows:
  16.  
  17. LOADNET.BAT
  18. -----------
  19. NET4
  20. F:
  21. STARTUP
  22.  
  23. STARTUP.BAT
  24. -----------
  25. SET BOOTUP=LOGIN
  26. MarxMenu Login
  27. %BOOTUP%
  28.  
  29. Each workstation should have their own AUTOEXEC.BAT. The last line
  30. should be LOADNET. If you are running multiple versions of dos you
  31. can have the first line of LOADNET.BAT be %NET%. You will then have
  32. to have SET NET=NET4 in your AUTOEXEC.BAT file.
  33.  
  34. Also, if you want automatic login you can add the following lines:
  35.  
  36. SET USERNAME=MARC   Your Name Here
  37. SET PASSWORD=NERD   Your Password Here
  38.  
  39. You should also change the COMSPEC= to the network command.com BEFORE
  40. you run NET4. For some unknown reason, this solves a lot of problems.
  41.  
  42. Example:
  43.  
  44. IPX
  45. SET COMSPEC=Y:COMMAMD.COM
  46. NET4
  47.  
  48. Another boot rom quirk is that you can't run any program off a boot
  49. rom that trashes upper memory. An example is running QEMM on a
  50. monochrome monitor.
  51.  
  52. By using this method the boot disk or boot rom hands control over in
  53. a clean way. LOADNET.BAT then branches to STARTUP.BAT for the rest
  54. of the login sequence.
  55.  
  56. For some strange reason which I can't explain, LOADNET and STARTUP
  57. have to be two separate batch files. I think it forces the transient
  58. part of COMMAND.COM to load into memory. Anyhow, don't combine these
  59. into one batch file
  60.  
  61. The first line of STARTUP.BAT is a message that tells this menu that
  62. the user is logging in for the first time. This menu creates a batch
  63. file and puts the name of it in the environment variable BOOTUP.
  64. STARTUP.BAT then executes this file.
  65.  
  66. This is the example for MY network. You'll have to modify it for
  67. yours.
  68.  
  69. One word of caution. After modifing this menu, always run MARXCOMP
  70. LOGIN to compile it. Otherwise, if you boot up into it you won't
  71. have enough access rights to recompile automatically.
  72.  
  73. ========================================================
  74. EndComment
  75.  
  76. var
  77.    UserName
  78.    OldPass
  79.    NewPass
  80.    Logged
  81.    Station
  82.    NetAddress
  83.    SmartDir
  84.    MyServer
  85.    HomeDir
  86.    DosDir
  87.    BatName
  88.    BatFile
  89.    UseMarxLogin
  90.    Shell
  91.    PasswordExpDays
  92.    SkipError
  93.  
  94. Comment
  95. ========================================================
  96.  
  97. If UseMarxLogin is set to true then this program will use the MarxMenu
  98. API call to log into the network. If set to false the it will shell
  99. Novell's LOGIN.EXE program.
  100.  
  101. If UseMarxLogin is set to true, and you are using 386 NetWare then you
  102. will have to add the following command to your AUTOEXEC.NCF file:
  103.  
  104. SET ALLOW UNENCRYPTED PASSWORDS = ON
  105.  
  106. ========================================================
  107. EndComment
  108.  
  109. UseMarxLogin = True
  110.  
  111. Shell = CleanFileName(ReadEnv('COMSPEC'))
  112. MyServer = NovDefaultServer
  113.  
  114. Comment
  115. ========================================================
  116.  
  117. If Environment variables USERNAME and PASSWORD are set, this menu
  118. will attempt to log into the network using these values. This allows
  119. for automatic login. You can also pass the parameters on the command
  120. line as follows.
  121.  
  122. MarxMenu Login <Name> <Password>
  123.  
  124. The name may contain a referrence to a server: Server/Name
  125.  
  126. ========================================================
  127. EndComment
  128.  
  129. ;------ If CapsLock key is on then override default login
  130.  
  131. Logged = False
  132. SkipError = False
  133.  
  134. if CapsLock
  135.    CapsLock Off
  136. else
  137.    UserName = ParamStr(2)
  138.    if UserName = '' then UserName = ReadEnv('USERNAME')
  139.    if UserName > ''
  140.       OldPass = ParamStr(3)
  141.       if OldPass = '' then OldPass = ReadEnv('PASSWORD')
  142.       if OldPass > ''
  143.          SkipError = True
  144.          Login (UserName,OldPass)
  145.          SkipError = False
  146.          if PasswordNeedsChanged
  147.             Logged = False
  148.             Suggest 'C'
  149.          endif
  150.       endif
  151.    endif
  152. endif
  153.  
  154. ;------ Fills station to 3 digits. Example: 004
  155.  
  156. Station  = Str(NovConnection)
  157. while length(Station) < 3
  158.    Station = '0' + Station
  159. endwhile
  160.  
  161. ;------ Read network address
  162.  
  163. NetAddress = NovStationAddress (NovConnection)
  164.  
  165. ;------ Select colors and prepare screen
  166.  
  167. if not Logged
  168.    if ColorScreen
  169.       TextColor White Red
  170.       BoxBorderColor Green Brown
  171.       BoxInsideColor Black Brown
  172.       ClearScreen 176
  173.       ClockColor Black Brown
  174.       TextColor Black Green
  175.       BoxHeaderColor Yellow Mag
  176.       Shadow
  177.    else
  178.       TextColor Grey Black
  179.       ClearScreen 176
  180.       TextColor Black Grey
  181.       BoxBorderColor Black Grey
  182.       BoxInsideColor Black Grey
  183.       BoxHeaderColor Black Grey
  184.       ClockColor Black Grey
  185.    endif
  186.    BlankMessage = 'Netware Login'
  187.    ClockMode = 262
  188.    GotoXY 1 25
  189.    ClearLine
  190.    WriteCenter "Computer Tyme Master Network Login Menu"
  191.    SingleLineBox
  192.    Explode Off
  193.    ShadowColor Grey Red
  194.    if ColorScreen
  195.       DrawBox 3 2 74 5
  196.       ClockPos 42 5
  197.       TextColor Blue Brown
  198.    else
  199.       DrawBox 3 2 76 5
  200.       ClockPos 44 5
  201.    endif
  202.    WriteCenter 'Computer Tyme Software Development Laboratory'
  203.    Writeln
  204.    TextColor Black Brown
  205.    WriteCenter '───────────────────────────────────────────────────────'
  206.    Writeln
  207.    TextColor Black Brown
  208.    Write "  (C) 1990 by Marc Perkel"
  209.    DoubleLineBox
  210.    BlankTime = 10
  211.  
  212.    Explode On
  213.    BlockBox
  214.    BoxBorderColor Green Blue
  215.    BoxInsideColor Yellow Blue
  216.    BoxHeader = " Station Information "
  217.    if ColorScreen
  218.       DrawBox 39 17 38 6
  219.       TextColor Yellow Blue
  220.    else
  221.       DrawBox 41 17 38 6
  222.       TextColor Grey Black
  223.    endif
  224.  
  225.    Writeln '           Server: ' MyServer
  226.    Writeln '          Network: ' NetAddress
  227.    Writeln '       Connection: ' Station
  228.    Write   '      DOS Version: ' DosVersionString
  229.  
  230.    ChooseOption
  231.  
  232.    EraseTopWindow
  233.    EraseTopWindow
  234.    EraseTopWindow
  235.    TextColor Grey Black
  236.    ClearScreen
  237. endif
  238.  
  239. UserName = NovMyLoginName
  240.  
  241. Comment
  242. ========================================================
  243.  
  244. Here we set a different directory for a program depending on if we
  245. have a color or monochrome monitor.
  246.  
  247. ========================================================
  248. EndComment
  249.  
  250. if VideoMode = Mono
  251.    SmartDir = 'F:\PUBLIC\MSMART'
  252. else
  253.    SmartDir = 'F:\PUBLIC\CSMART'
  254. endif
  255.  
  256. ;----- You can't assume that you have an F: drive unless you map it.
  257.  
  258. NovMapDrive ('F','SYS:\LOGIN')
  259.  
  260. ;----- Here we calculate a home directory for each user.
  261.  
  262. HomeDir = 'F:\HOME\' + UserName
  263. if UserName = 'SUPERVISOR' then HomeDir = 'F:\SYSTEM'
  264. if not ExistDir(HomeDir) then HomeDir = 'F:\PUBLIC\APPS'
  265.  
  266. Comment
  267. ========================================================
  268.  
  269. Here we calulate the the name of the dos directory that matches the
  270. version of dos we are running.
  271.  
  272. ========================================================
  273. EndComment
  274.  
  275. DosDir = 'F:\PUBLIC\DOSV' + DosVersionString
  276.  
  277. Comment
  278. ========================================================
  279.  
  280. Here's where we map our drives. This does not set the search path.
  281. You set that explicitly by writing to the PATH environment variable.
  282.  
  283. Drive map commands may contain server and volume referrences:
  284.  
  285. MovMapDrive('I','TYME/VOL1:SERVICE')
  286.  
  287. ========================================================
  288. EndComment
  289.  
  290. NovMapDrive ('Z',HomeDir)
  291. NovMapDrive ('Y','F:\PUBLIC\APPS')
  292. NovMapDrive ('X',DosDir)
  293. NovMapDrive ('W','F:\PUBLIC\UTIL')
  294. NovMapDrive ('P','F:\PUBLIC')
  295. NovMapDrive ('U','F:\SYSTEM')
  296. NovMapDrive ('L','F:\LOGIN')
  297. if MyServer = 'TYME'
  298.    NovMapDrive ('I','VOL1:')
  299. endif
  300. if (MyServer = 'TYME') or (MyServer = 'MARX')
  301.    NovMapDrive ('S',SmartDir)
  302. endif
  303.  
  304. if ExistDir (HomeDir + '\TP6') then NovMapDrive ('T',HomeDir + '\TP6')
  305.  
  306. ;------ Here's where we set master environment variable strings
  307.  
  308. SetEnv ('PASSWORD=')
  309. SetEnv ('NET=')
  310. SetEnv ('USERNAME=' + UserName)
  311. SetEnv ('STATION=' + Station)
  312. if Shell <> 'C:\COMMAND.COM' then SetEnv ('COMSPEC=X:COMMAND.COM')
  313. SetEnv ('PROMPT=$e[1;33m$p: $e[0;32m')
  314. SetEnv ('PD.EXE=/$Z:PD.PIC')
  315. SetEnv ('MXCTL=/C')
  316. SetEnv ('MXECHO=OFF')
  317.  
  318. Comment
  319. ========================================================
  320.  
  321. If a TEMP environment variable is set, MarxMenu will use it for
  322. temporary batch files. This is compatible with DOS 5 and Windows
  323. conventions. The users should be given full access rights to this
  324. directory. I'm using \TMPFILES for my network.
  325.  
  326. ========================================================
  327. EndComment
  328.  
  329. if ExistDir('\TMPFILES') then SetEnv('TEMP=' + CleanFileName('\TMPFILES'))
  330.  
  331. SetEnv ('PATH=T:.;Z:.;Y:.;X:.;W:.;P:.;U:.;S:.;')
  332.  
  333. FixPath    ;Verifies all search paths exist
  334.  
  335. ChDir (HomeDir)
  336.  
  337. Comment
  338. ========================================================
  339.  
  340. Opens a semaphore that XMETER can read.
  341. To see how many users are users are on with XMETER type:
  342. XMETER LOGIN /U
  343.  
  344. ========================================================
  345. EndComment
  346.  
  347. NovOpenSemaphore ('XM-LOGIN',0)
  348.  
  349. ;------ LOGIN is set to BOOTUP if logging in for the first time
  350.  
  351. if UpperCase(ReadEnv('BOOTUP')) <> 'LOGIN' then ExitMenu
  352.  
  353. Comment
  354. ========================================================
  355.  
  356. In order to load TSRs, MarxMenu writes a temporary batch file and
  357. exits. The STARTUP.BAT file then jumps to this batch file.
  358.  
  359. ========================================================
  360. EndComment
  361.  
  362. ;------ Create temporary batch file for rest of login sequence
  363.  
  364.  
  365. BatName = 'Y:' + NamePart(BatFileName) + '.BAT'
  366. SetEnv ('BOOTUP=' + BatName)
  367. FileAssign(BatFile,BatName)
  368. FileCreate(BatFile)
  369.  
  370. if DosVersionString < '3.30'
  371.    WriteBat('ECHO OFF')
  372. else
  373.    WriteBat('@ECHO OFF')
  374. endif
  375. WriteBat ('SET BOOTUP=')
  376. WriteBat ('MARK > NUL')
  377.  
  378. ;----- Load Lan Assist
  379.  
  380. if NovInGroup ('LANASSIST')
  381.    WriteBat ('P:LA\LA +N >NUL')
  382. endif
  383.  
  384. Comment
  385. ================================================================
  386.  
  387. This next section deals with running special programs bases on the
  388. physical station number rather than by user. This deals with special
  389. hardware that needs software drivers loaded.
  390.  
  391. ================================================================
  392. EndComment
  393.  
  394. ;----- CD ROM Machine
  395.  
  396. ;if NetAddress = '255:2'
  397. ;   WriteBat ('CD\PUBLIC\MA')
  398. ;   WriteBat ('MSCDEX.EXE /D:MSCD003 /M:12')
  399. ;   WriteBat ('MAR C:\ RW=/ /C')
  400. ;endif
  401.  
  402. ;----- Vicki's Printer
  403.  
  404. if NetAddress = '255:65'
  405.    WriteBat('P:PA\PA P=1 M=200 T=10 Q1=TYME/VICKI')
  406.    Capture('VICKI',1)
  407. endif
  408.  
  409. ;----- Grace's Printer
  410.  
  411. if NetAddress = '255:68'
  412.    WriteBat('P:PA\PA P=1 M=200 T=10 Q1=TYME/GRACE')
  413.    Capture('GRACE',1)
  414. endif
  415.  
  416. ;----- Nita's Printer
  417.  
  418. if NetAddress = '255:E8'
  419.    WriteBat('P:PA\PA P=1 M=200 T=10 Q1=TYME/NITA')
  420.    Capture('NITA',1)
  421. endif
  422.  
  423. Comment
  424. ================================================================
  425.  
  426. This next section deals with running special programs bases on the
  427. users preferrences.
  428.  
  429. ================================================================
  430. EndComment
  431.  
  432. if UserName = 'MARC'
  433.    WriteBat('KBD 6 NumOff');
  434.    Capture('DOT',1)
  435.    Capture('LASER',2)
  436.    ChDir('TP6')
  437. endif
  438.  
  439. if UserName = 'VICKI'
  440.    Capture('LASER',2)
  441.    WriteBat('KBD 6 NumOn CR');
  442.    WriteBat('MAP ROOT C:=Z:')
  443.    WriteBat('MOUSE')
  444. endif
  445.  
  446. if UserName = 'KEVIN'
  447.    WriteBat('KBD 0,0 NumOn');
  448.    Capture('LASER',1)
  449.    Capture('DOT',2)
  450.    SetEnv('PROMPT=($p)')
  451.    SetEnv('PATH=' + ReadEnv( 'Path' ) + ';f:\home\kevin\brief' )
  452.    ChDir('MARX')
  453. endif
  454.  
  455. if UserName = '386'
  456.    WriteBat('KBD 6 NumOff');
  457.    Capture('DOT',1)
  458.    Capture('LASER',2)
  459. endif
  460.  
  461. if UserName = 'TBBS'
  462.    Capture('DOT',1)
  463.    Capture('LASER',2)
  464.    ChDir('I:\BBS\TBBS')
  465.    NovMapDrive('H','I:')
  466.    SetEnv('D.EXE=/O/I')
  467.    WriteBat('CASTOFF')
  468.    WriteBat('DROPTO ' + BatName + ' R')
  469. endif
  470.  
  471. if UserName = 'GRACE'
  472.    WriteBat('KBD 6 NumOn');
  473.    Capture('LASER',2)
  474. endif
  475.  
  476. if UserName = 'NITA'
  477.    WriteBat('KBD 6 NumOn CapsOn');
  478.    Capture('LASER',2)
  479. endif
  480.  
  481. if UserName = 'WORK'
  482.    WriteBat('KBD 6 NumOff');
  483.    Capture('DOT',1)
  484.    Capture('LASER',2)
  485. endif
  486.  
  487. ;------ Load SideKick if in Sidekick Group
  488.  
  489. if NovInGroup 'SIDEKICK'
  490.    WriteBat ('KBD CR');
  491.    WriteBat ('SWAPSK/N/G/D' + HomeDir + ' >NUL')
  492.    WriteBat ('SK')
  493.    WriteBat ('CLS')
  494. endif
  495.  
  496.  
  497. ;------ Load SideKick 2 if in SK2 Group
  498.  
  499. if NovInGroup 'SK2'
  500.    WriteBat ('CD SK2')
  501.    WriteBat ('SK2')
  502.    WriteBat ('CD ..')
  503. endif
  504.  
  505.  
  506. Comment
  507. ================================================================
  508.  
  509. The batch file ends by jumping to personal menu, if there is one, or
  510. the default menu if there isn't. DROPTO.BAT is used to erase the
  511. temporary batch file that this menu creates.
  512.  
  513. ================================================================
  514. EndComment
  515.  
  516. WriteBat ('DROPTO ' + BatName + ' MARX TYME')
  517.  
  518. FileClose(BatFile)
  519.  
  520. ExitMenu
  521.  
  522.  
  523. ;----- Procedure Definitions
  524.  
  525. Procedure WriteBat (BatLine)
  526.    FileWriteln(BatFile,BatLine)
  527. EndProc
  528.  
  529.  
  530. Procedure Pause
  531.    WriteBat ('PAUSE')
  532. EndProc
  533.  
  534.  
  535. Procedure Capture (Queue, PrinterPort)
  536. var PortSt
  537.    PortSt = Str(PrinterPort)
  538.    WriteBat ('P:CAPTURE Q=' + Queue + ' C=1 NB NFF TI=5 L=' + PortSt + '>NUL')
  539. EndProc
  540.  
  541. Comment
  542. ========================================================
  543.  
  544. A list is created in the \LOGIN directory containing the names of
  545. users who want to load sidekick. The name of the file is SIDEKICK.LST
  546. and looks like:
  547.  
  548. MARC
  549. VICKI
  550. GRACE
  551.  
  552. ========================================================
  553. EndComment
  554.  
  555. Procedure ChooseOption
  556. var Ch
  557.    repeat
  558.       DrawBox 3 17 26 5
  559.       UseArrows
  560.       InverseColor Yellow Cyan
  561.       Writeln '  L - Login to Network'
  562.       Writeln '  C - Change Password'
  563.       Write   '  S - Select Server'
  564.       Ch = UpperCase(ReadKey)
  565.       if (Ch = 'L') or (Ch = 'C') or (Ch = 'S')
  566.          EraseTopWindow
  567.          if Ch = 'L'
  568.             LoginToNetwork (False)
  569.          endif
  570.          if Ch = 'C'
  571.             LoginToNetwork (True)
  572.          endif
  573.          if Ch = 'S'
  574.             SelectServer
  575.          endif
  576.       endif
  577.    until Logged
  578. EndProc
  579.  
  580.  
  581. Procedure Warning (St)
  582.    BoxHeader ' Warning '
  583.    DrawBox 3 17 length(St) + 4 3
  584.    Write Char(7) ' ' St
  585.    Wait 300
  586.    EraseTopWindow
  587. EndProc
  588.  
  589.  
  590. Procedure LoginToNetwork (CP)
  591. var NewPassVerify
  592.    BoxHeader = ' Logging into Server * ' + MyServer + ' '
  593.    DrawBox 3 10 50 4
  594.    UseArrows Off
  595.    Security
  596.    repeat
  597.       if UserName = ''
  598.          Write ' Name: '
  599.          UserName = UpperCase(Readln)
  600.          Writeln
  601.       endif
  602.       Write ' Password: '
  603.       OldPass = UpperCase(Readln)
  604.       Write CR
  605.       ClearLine
  606.       Login (UserName,OldPass)
  607.       if not CP
  608.          CP = PasswordNeedsChanged
  609.          if CP then Warning('Time to change your password!')
  610.       endif
  611.       if CP
  612.          if LastKey <> Esc
  613.             repeat
  614.                Write ' New Password: '
  615.                NewPass = UpperCase(Readln)
  616.                Write CR
  617.                ClearLine
  618.                if NewPass = OldPass then Warning('Select a NEW Password!')
  619.             until NewPass <> OldPass
  620.          endif
  621.          if LastKey <> Esc
  622.             Write ' Verify: '
  623.             NewPassVerify = UpperCase(Readln)
  624.             Write CR
  625.             ClearLine
  626.             if NewPass = NewPassVerify
  627.                NovChangePassword (OldPass,NewPass)
  628.                if NovResult <> 0
  629.                   Warning ('Password Change Failed!')
  630.                   Logged = False
  631.                endif
  632.             else
  633.                Warning('Password Typed Wrong!')
  634.                Logged = False
  635.             endif
  636.          endif
  637.       endif
  638.    ClearScreen
  639.    if not Logged
  640.       UserName = ''
  641.    endif
  642.    until (LastKey = Esc) or Logged
  643.    EraseTopWindow
  644. EndProc
  645.  
  646.  
  647. Procedure Login (User, Pass)
  648.    if UseMarxLogin
  649.       NovLogin (User, Pass)
  650.       Logged = NovResult = 0
  651.    else
  652.       ClearScreenFirst Off
  653.       UseCommand On
  654.       StuffKbd = Pass + CR
  655.       Execute ('LOGIN.EXE ' + MyServer + '/' + User + '>nul')
  656.       Logged = ExistDir ('F:\SYSTEM')
  657.    endif
  658.    if not Logged and not SkipError then Warning('Login Failed!')
  659. EndProc
  660.  
  661.  
  662. Procedure PasswordNeedsChanged
  663. var X
  664.    X = NovPasswordExpDate (UserName)
  665.    if X = 0 then Return False
  666.    Return (X - Today) / SecondsInDay <= 5
  667. EndProc
  668.  
  669.  
  670. Procedure SelectServer
  671. var Servers
  672.    NovServers(Servers)
  673.    DrawBox 25 9 20 NumberOfElements (Servers) + 2
  674.    MyServer = PickOne (Servers)
  675.    NovSetPrimaryServer (MyServer)
  676.    EraseTopWindow
  677. EndProc
  678.