home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
dsdelu.exe
/
DELUSER.C
next >
Wrap
C/C++ Source or Header
|
1995-04-12
|
5KB
|
195 lines
/****************************************************************************
** File: DELUSER.C
**
** Desc: Deletes objects in the Tree
**
** This was designed only to delete "User" Objects from the tree.
**
**
** 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.
**
** Programmers:
**
** Ini Who Firm
** --- ----------------- ------------------------------------------------
** CRG Calvin Gaisford Novell Developer Support.
**
** History:
**
** When Who What
** -------- --- ---------------------------------------------------------
** 10-21-94 CRG First code.
*/
/***************************************************************************
** Libraries Linked in for .exe
**
** NWCALLS.LIB
** NWLOCALE.LIB
** NWNET.LIB
**
*/
/***************************************************************************
** #defines
*/
#define FAILURE 0xFF
#define SUCCESS 0x00
/****************************************************************************
** Include headers, macros, etc.
*/
/*-----------------------------------------------------------------------
** ANSI
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*-----------------------------------------------------------------------
** NetWare
*/
#include <nwnet.h>
#include <nwcalls.h>
#include <nwlocale.h>
/*-----------------------------------------------------------------------
** Program Global storage
*/
struct
{
NWDSContextHandle context;
}gs;
extern unsigned _stklen=8000;
/***************************************************************************
** Function Prototypes
*/
void Proc(void);
void FatalError(int errorCode);
void InitDS(void);
int UninitDS(void);
/***************************************************************************
** Main Program
*/
void main(void)
{
InitDS();
Proc();
UninitDS();
}
/***************************************************************************
** This will prompt users for login names to remove a user from the tree.
*/
void Proc(void)
{
NWDSCCODE ccode;
char objectName[MAX_DN_CHARS];
printf("Login Name: ");
gets(objectName);
strcat(objectName,"\x0");
ccode = NWDSRemoveObject(gs.context, objectName);
if(ccode)
printf("NWDSRemoveObject returned %X\n", ccode);
else
{
printf("Object \"%s\"successfully removed\n", objectName);
}
}
/***************************************************************************
** FatalError is the common exit point for errors.
*/
void FatalError(int errorCode)
{
exit(errorCode);
}
/***************************************************************************
** Establish context. These are the standard initializations for DS calls
*/
void InitDS(void)
{
NWDSCCODE dsCcode;
LCONV lconvInfo;
dsCcode=NWCallsInit(NULL,NULL);
if(dsCcode) /* initialize allowing to call nwcalls functions */
{
printf("FatalError during NWCallsInit %X\n",dsCcode);
FatalError(FAILURE);
}
NWLlocaleconv(&lconvInfo);
dsCcode = NWInitUnicodeTables(lconvInfo.country_id, lconvInfo.code_page);
if(dsCcode)
{
printf("NWInitUnicodeTables() returned: %X\n", dsCcode);
FatalError(FAILURE);
}
gs.context=NWDSCreateContext();
if(gs.context)
{
printf("FatalError during NWDSCreateContext %X\n",gs.context);
FatalError(FAILURE);
}
}
/***************************************************************************
** Release context and clean up.
*/
int UninitDS()
{
NWDSCCODE dsCcode;
dsCcode=NWDSFreeContext(gs.context);
if(dsCcode)
{
printf("FatalError during NWDSFreeContext %X\n",dsCcode);
FatalError (FAILURE);
}
dsCcode=NWFreeUnicodeTables();
if(dsCcode)
{
printf("Error during NWFreeUnicodeTables()\n");
FatalError (FAILURE);
}
return(0);
}