home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / pibterm / pibt41e3.zip / GETPASS.SCR < prev    next >
Text File  |  1988-02-26  |  5KB  |  98 lines

  1. ***************************************************************************
  2. *       G E T P A S S . S C R  --- Get password for remote system         *
  3. ***************************************************************************
  4. *
  5. *                                  Dialing entry to get password for
  6.  Import DEntry Integer
  7. *                                  Password to return to calling script
  8.  Import PassWord String
  9. *
  10. ***************************************************************************
  11. *                                                                         *
  12. *    Script:  GetPass.Scr                                                 *
  13. *                                                                         *
  14. *    Purpose: Returns entry in password file corresponding to             *
  15. *             given dialing entry.                                        *
  16. *                                                                         *
  17. *    Invocation:                                                          *
  18. *                                                                         *
  19. *       Execute "GetPass"  DialEnt PassWord                               *
  20. *                                                                         *
  21. *          DialEnt  --- Number of entry to get password for               *
  22. *          PassWord --- Password for entry "DialEnt"                      *
  23. *                                                                         *
  24. *    Remarks:                                                             *
  25. *                                                                         *
  26. *       PibTerm does not store passwords for systems to be dialed in the  *
  27. *       dialing directory.  This is for security reasons.  However,       *
  28. *       you may find it convenient to maintain a file of passwords for    *
  29. *       each system on your own.  You can do this with the built-in       *
  30. *       PibTerm editor, for example.                                      *
  31. *                                                                         *
  32. *       This script provides a mechanism for accessing your password      *
  33. *       file from another script invoked as the result of a PibTerm       *
  34. *       request.  Your dialing script just needs to invoke this script    *
  35. *       as indicated above.                                               *
  36. *                                                                         *
  37. *       Using a password file allows you to write one script which can    *
  38. *       handle the signon sequence for a number of remote systems.  For   *
  39. *       example, you can write a generic routine to log into PC Board     *
  40. *       systems.  Then you can attach this generic script to the dialing  *
  41. *       entries for all the PC Board systems you call.  The major         *
  42. *       difference will be the password, and using GETPASS.SCR allows you *
  43. *       to handle that difference rather easily.                          *
  44. *                                                                         *
  45. *       The password file is assumed to be called 'c:\pibterm\mypass.dat' *
  46. *       but you can change that to whatever name you like.  The format    *
  47. *       of the password file is simple:  for each entry in the dialing    *
  48. *       directory, place a corresponding password on the matching line    *
  49. *       number in the password file.  Hence, if your dialing directory    *
  50. *       (PIBTERM.FON) has 25 entries, then your password file should also *
  51. *       have 25 lines.  Each line has the password corresponding to one   *
  52. *       dialing entry.  For example, the 10th line in the password file   *
  53. *       should have the password for the 10th entry in the dialing        *
  54. *       directory.                                                        *
  55. *                                                                         *
  56. *       A non-existent password is returned as a null string.             *
  57. *                                                                         *
  58. ***************************************************************************
  59. *
  60. *                                  Current entry in password file
  61.  Declare IEntry Integer
  62. *                                  Return null password in case of error
  63.  PassWord = ''
  64. *                                  Make sure dialing # is reasonable
  65.  IF ( DEntry <= 0 ) THEN
  66.     EXIT
  67.  ENDIF
  68. *                                  Open password file.
  69. *                                  Change name to whatever you want.
  70. *
  71.  Open 1 "c:\modem\mypass.dat" "Input"
  72. *
  73. *                                  Check that open went OK -- if not,
  74. *                                  return to caller.
  75.  IF ( IOResult <> 0 ) THEN
  76.     EXIT
  77.  ENDIF
  78. *                                  Skip down to correct entry
  79. *
  80.  FOR IEntry = 1 TO ( DEntry - 1 ) DO
  81.     Readln 1 PassWord
  82.     IF ( IOResult <> 0 ) THEN
  83.        PassWord = ''
  84.        CLOSE 1
  85.        EXIT
  86.     ENDIF
  87.  ENDFOR
  88. *                                 Read correct entry
  89.  Readln 1 PassWord
  90. *
  91.  IF ( IOResult <> 0 ) THEN
  92.     PassWord = ''
  93.     CLOSE 1
  94.     EXIT
  95.  ENDIF
  96. *                                  Close password file
  97.  Close 1
  98.