home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************/
- /* File: VERPASS.C */
- /* */
- /* Function: Verifies a Netware Users password. */
- /* */
- /* Usage: verpass username password */
- /* */
- /* Functions Called: GetPreferredConnectionID */
- /* GetDefaultConnectionID */
- /* SetPreferredConnectionID */
- /* GetPrimaryConnectionID */
- /* ISShellLoaded */
- /* VerifyBinderyObjectPassword */
- /* */
- /***************************************************************************/
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
-
- #include "netware.h"
-
- void main(int argc,char *argv[])
- {
- int prefserver;
- int thisserver;
- byte encrypt[8];
- long objectID;
- int r;
-
- if (argc != 3)
- {
- printf("Usage is: VERPASS <user name> <password>\n");
- exit(0);
- }
-
- if (IsShellLoaded() != SUCCESS)
- {
- printf("*** No netware shell loaded ***\n");
- exit(255);
- }
-
- if ((prefserver = GetPreferredConnectionID()) == 0)
- {
- if ((thisserver = GetDefaultConnectionID()) == 0)
- thisserver = GetPrimaryConnectionID();
- SetPreferredConnectionID( thisserver );
- }
- else
- thisserver = prefserver;
-
- strupr(argv[1]);
- strupr(argv[2]);
-
- if ((r=VerifyBinderyObjectPassword(USER,argv[1],argv[2])) != 0)
- printf("*** password is invalid (%d) ***\n",r);
- else
- printf("*** password OK ***\n");
-
- if (thisserver != prefserver) /* reset preferred server */
- SetPreferredConnectionID( prefserver );
- }
-