home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
chgpss.exe
/
CHGPASS.C
next >
Wrap
Text File
|
1995-01-07
|
4KB
|
120 lines
/****************************************************************************
** DISCLAIMER
**
** Novell, Inc. makes no representations or warranties with respect to
** any NetWare software, and specifically disclaims any express or
** implied warranties of merchantability, title, or fitness for a
** particular purpose.
**
** Distribution of any NetWare software is forbidden without the
** express written consent of Novell, Inc. Further, Novell reserves
** the right to discontinue distribution of any NetWare software.
**
** Novell is not responsible for lost profits or revenue, loss of use
** of the software, loss of data, costs of re-creating lost data, the
** cost of any substitute equipment or program, or claims by any party
** other than you. Novell strongly recommends a backup be made before
** any software is installed. Technical support for this software
** may be provided at the discretion of Novell.
****************************************************************************
**
** File: CHGPASS.C
**
** Description: Program allows the user (supervisor) to change a password.
**
**
** Parameter descriptions: > input
** < output
**
**
** Programmers:
** Ini Who Firm
** -------------------------------------------------------------------
** ARM A. Ray Maxwell Novell Developer Support.
**
** History:
**
** -------------------------------------------------------------------
** 08-12-94 ARM First code.
*/
/***********************************************************************
** Include Headers, Macros & function Prototypes.
*/
/*-------------------------------------------------------------------
** ANSI
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define RETURN '\r'
/*-------------------------------------------------------------------
** NetWare
*/
#include <nwcalls.h>
/*-------------------------------------------------------------------
** Defines
*/
#define NWDOS
/*-------------------------------------------------------------------
** Prototypes
*/
/***********************************************************************
** Program start.
*/
void main(int argc, char *argv[ ])
{
NWCONN_HANDLE connHandle;
NWCCODE ccode;
char server[50],
objectName[50],
password[128],
oldPassword[128],
newPassword[128];
if(argc != 4) {
clrscr();
printf("Usage: CHGPASS <server name> <username> <new password>\n");
printf("Note: must be logged into server you change password on.\n");
exit(1);
}
oldPassword[0] = NULL; /* you can also enter the old password */
strcpy(server,strupr(argv[1])); /* servers name */
strcpy(objectName, strupr(argv[2])); /* user name is upper case */
strcpy(newPassword,strupr(argv[3])); /* password is upper case */
ccode = NWCallsInit(NULL, NULL);
if(ccode){
printf ("NWCallsInit failed with error=%X\n",ccode);
exit(1);
}
ccode = NWGetConnectionHandle(server, 0, &connHandle, NULL);
if(ccode){
printf("NWGetConnectionHandle failed with error=%X\n",ccode);
exit(1);
}
ccode = NWChangeObjectPassword(
/* > connection Handle */ connHandle,
/* > user name */ objectName,
/* > Bindery object */ OT_USER,
/* > Old password or NULL */ oldPassword,
/* > New password */ newPassword);
if(ccode){
printf ("NWChangObjectPassword failed with errror=%X\n",ccode);
exit(1);
}
}