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

  1. /*
  2.  * File......: CHGPASS.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_cBndOPw()
  23.  *  $CATEGORY$
  24.  *     Bindery
  25.  *  $ONELINER$
  26.  *     Change Bindery Object Password
  27.  *  $SYNTAX$
  28.  *
  29.  *     FN_cBndOPw(cObject, nType, cOldPassWord, cNewPassWord) => lChanged
  30.  *
  31.  *  $ARGUMENTS$
  32.  *
  33.  *     <cObject> is the name of the Bindery Object to which you want to
  34.  *         change 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.  *     <cOldPassWord> 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.  *     <cNewPassWord> string containing the new password for the bindery
  45.  *              object.  Can be a maximun of 126 characters, must
  46.  *              be in upper case, Null = no password.
  47.  *
  48.  *  $RETURNS$
  49.  *
  50.  *     <lChanged> is a logical whether succesfull.  If an error
  51.  *        occurs this function will return .F..
  52.  *
  53.  *  $DESCRIPTION$
  54.  *
  55.  *     This function changes the password of a bindery object.
  56.  *
  57.  *     NOTE!  This function does _not_ support encrypted passwords.
  58.  *     Due to licensing restrictions from Novell, we could not include
  59.  *     encrypted support in this public domain release.  However, it
  60.  *     is available.  See elsewhere in the Norton Guide for details
  61.  *     on password encryption support.
  62.  *
  63.  *  $EXAMPLES$
  64.  *
  65.  *     lChanged :=  FN_cBndOPw("KEVIN",OT_USER,"123EWR","JT56CD")
  66.  *
  67.  *  $END$
  68.  */
  69.  
  70. #include "ftint86.ch"
  71. #include "netto.ch"
  72.  
  73. #define NW_LOG 227
  74. #xcommand DEFAULT <v1> TO <x1> [, <vN> TO <xN> ];
  75.       => IIF((<v1>)=NIL,<v1>:=<x1>,NIL) [; IF((<vN>)=NIL,<vN>:=<xN>,NIL)]
  76.  
  77. #ifdef FT_TEST
  78.   FUNCTION MAIN(cObject, nType, cOld, cNew)
  79.     default cobject to "KEVIN"
  80.     default ntype to "1"
  81.     default cold to ""
  82.     default cnew to ""
  83.     IF FN_cBndOPw(cObject,Val(nType),cOld,cNew)
  84.       Qout("Password has been successfully changed")
  85.     ELSE
  86.       Qout("Password has not been successfully changed")
  87.     ENDIF
  88.  
  89.   RETURN ( nil )
  90.  
  91. #endif
  92.  
  93. FUNCTION FN_cBndOPw(cObject, nType, cOldPassWord, cNewPassWord)
  94.  
  95. #ifdef NOENCRYPTION
  96.   LOCAL cSend := I2BYTE(64);               // 40h API Request Code
  97.            + W2HILO(nType);            // nw_int Object type
  98.            + fn_NameL(cObject,48);           // Object Name
  99.            + fn_NameL(cOldPassWord,127);   // Old Password Length encoded
  100.            + fn_NameL(cNewPassWord,127)    // New Password Length encoded
  101.  
  102. RETURN (_fnReq(NW_LOG,cSend,"") == ESUCCESS)
  103.  
  104. #else
  105.  
  106. RETURN (_fnChgPW3(Upper(cObject), nType, Upper(cOldPassWord), Upper(cNewPassWord)) == ESUCCESS)
  107.  
  108. #endif
  109.  
  110.