home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / NETCLB35.ZIP / NETCLB35.EXE / EXAMPLES / VERPASS.C < prev    next >
C/C++ Source or Header  |  1996-01-03  |  2KB  |  63 lines

  1. /***************************************************************************/
  2. /* File:             VERPASS.C                                             */
  3. /*                                                                         */
  4. /* Function:         Verifies a Netware Users password.                    */
  5. /*                                                                         */
  6. /* Usage:            verpass username password                             */
  7. /*                                                                         */
  8. /* Functions Called: GetPreferredConnectionID                              */
  9. /*                   GetDefaultConnectionID                                */
  10. /*                   SetPreferredConnectionID                              */
  11. /*                   GetPrimaryConnectionID                                */
  12. /*                   ISShellLoaded                                         */
  13. /*                   VerifyBinderyObjectPassword                           */
  14. /*                                                                         */
  15. /***************************************************************************/
  16.  
  17. #include <stdlib.h>
  18. #include <stdio.h>
  19. #include <string.h>
  20.  
  21. #include "netware.h"
  22.  
  23. void main(int argc,char *argv[])
  24. {
  25. int prefserver;
  26. int thisserver;
  27. byte encrypt[8];
  28. long objectID;
  29. int r;
  30.  
  31.    if (argc != 3)
  32.    {
  33.        printf("Usage is: VERPASS <user name> <password>\n");
  34.        exit(0);
  35.    }
  36.  
  37.    if (IsShellLoaded() != SUCCESS)
  38.    {
  39.       printf("*** No netware shell loaded ***\n");
  40.       exit(255);
  41.    }
  42.  
  43.    if ((prefserver = GetPreferredConnectionID()) == 0)
  44.    {
  45.       if ((thisserver = GetDefaultConnectionID()) == 0)
  46.          thisserver = GetPrimaryConnectionID();
  47.       SetPreferredConnectionID( thisserver );
  48.    }
  49.    else
  50.       thisserver = prefserver;
  51.  
  52.    strupr(argv[1]);
  53.    strupr(argv[2]);
  54.  
  55.    if ((r=VerifyBinderyObjectPassword(USER,argv[1],argv[2])) != 0)
  56.       printf("*** password is invalid (%d) ***\n",r);
  57.    else
  58.       printf("*** password OK ***\n");
  59.    
  60.    if (thisserver != prefserver)   /* reset preferred server */
  61.       SetPreferredConnectionID( prefserver );
  62. }
  63.