home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / nettos11.zip / BINDERY / VERPASS.PRG < prev    next >
Text File  |  1993-07-23  |  3KB  |  106 lines

  1. /*
  2.  * File......: VERPASS.PRG
  3.  * Author....: Kevin Maher/Steve Tyrakowski
  4.  * CIS ID....: 73766,1224
  5.  * Date......: $Date$
  6.  * Revision..: $Revision$
  7.  * Log file..: $Logfile$
  8.  *
  9.  * This is an original work by Kevin Maher and Steve Tyrakowski
  10.  * and is placed in the public domain.
  11.  *
  12.  * Modification history:
  13.  * ---------------------
  14.  *
  15.  * $Log$
  16.  *
  17.  */
  18.  
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *     FN_vBndOPw()
  23.  *  $CATEGORY$
  24.  *     Bindery
  25.  *  $ONELINER$
  26.  *     Verify Bindery Object Password
  27.  *  $SYNTAX$
  28.  *
  29.  *     FN_vBndOPw(cObject, nType, cPassWord) => lVerifed
  30.  *
  31.  *  $ARGUMENTS$
  32.  *
  33.  *     <cObject> is the name of the Bindery Object to which you want to
  34.  *     verify the password.  Max Length = 47
  35.  *
  36.  *     <nType> is the Bindery Object Type.  Manifest constants
  37.  *           describing the defined types are included in the NETTO.CH
  38.  *           header file.
  39.  *
  40.  *     <cPassWord> string containing the current password to be
  41.  *              checked for validity. Can be a maximun of 126
  42.  *              characters, must be in upper case, Null = no password.
  43.  *
  44.  *
  45.  *  $RETURNS$
  46.  *
  47.  *     <lVerified> is a logical whether password was verified.
  48.  *
  49.  *  $DESCRIPTION$
  50.  *
  51.  *     This function compares the supplied password to the password
  52.  *     stored in the bindery for the object.  If the passwork is the
  53.  *     same it will return a true, if not it will return a false.
  54.  *
  55.  *     NOTE!  This function does _not_ support encrypted passwords.
  56.  *     Due to licensing restrictions from Novell, we could not include
  57.  *     encrypted support in this public domain release.  However, it
  58.  *     is available.  See elsewhere in the Norton Guide for details
  59.  *     on password encryption support.
  60.  *
  61.  *  $EXAMPLES$
  62.  *
  63.  *     lVerified :=  FN_vBndOPw("KEVIN",OT_USER,"123EWR")
  64.  *
  65.  *  $END$
  66.  */
  67.  
  68. #include "ftint86.ch"
  69. #include "netto.ch"
  70.  
  71. #define NW_LOG 227
  72. #xcommand DEFAULT <v1> TO <x1> [, <vN> TO <xN> ];
  73.       => IIF((<v1>)=NIL,<v1>:=<x1>,NIL) [; IF((<vN>)=NIL,<vN>:=<xN>,NIL)]
  74.  
  75. #ifdef FT_TEST
  76.   FUNCTION MAIN(cObject, nType, cPass)
  77.     default cobject to "KEVIN"
  78.     default ntype to "1"
  79.     default cpass to ""
  80.     IF FN_vBndOPw(cObject,Val(nType),cPass)
  81.       Qout("Password is correct.")
  82.     ELSE
  83.       Qout("Password has not been verified.")
  84.     ENDIF
  85.  
  86.   RETURN ( nil )
  87.  
  88. #endif
  89.  
  90. FUNCTION FN_vBndOPw(cObject, nType, cPassWord)
  91.  
  92. #ifdef NOENCRYPTION
  93.   LOCAL cSend := I2BYTE(63);           // 3Fh API Request Code
  94.          + W2HILO(nType);              // nw_int Object type
  95.          + fn_NameL(cObject,48);       // Object Name
  96.          + fn_NameL(cPassWord,128);    // Password Length encoded
  97.  
  98. RETURN (_fnReq(NW_LOG,cSend,"") == ESUCCESS)
  99.  
  100. #else
  101.  
  102. RETURN (_fnVerPW3(Upper(cObject), nType, Upper(cPassWord)) == ESUCCESS)
  103.  
  104. #endif
  105.  
  106.