Change user password with LS

To change the user password using Script, I wrote a simple exe file using the C API.

To change the user password using Script, I wrote a simple exe file using the C API. First compile the code bellow then you can use it from LS by executing it with the shell function.

You can send me a mail at ysabag@iba.co.il and I'll send you the exe.


Put the following code in: ChangePassword.c

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <errno.h>

#include <lapicinc.h>
#include <lapiplat.h>
#include <osenv.h>
#include <kfm.h>




LAPI_MAIN
{
STATUS  error = NOERROR;
char    OrigPassword[20];
char    NewPassword[20];
char    IDFileSpec[MAXENVVALUE+1];

LAPI_INIT(error);

  if (error)
    LAPI_INIT_ERROR;
    


if (argc<3)
	LAPI_RETURN ("Syntax ChangePassword.exe KeyFileName OrigPassword NewPassword");

if (argc==3)  
{
	strcpy(OrigPassword, argv[1]);
	strcpy(NewPassword, argv[2]);

/* Get the current user's id file path specification */
	if (error=!OSGetEnvironmentString ("KeyFileName", IDFileSpec, MAXENVVALUE))
	{
		printf ("Cannot locate current id file, using NULL for pIDFilen");
		LAPI_RETURN (ERR(error));
	}
}
else
{

	strcpy(IDFileSpec, argv[1]);
	strcpy(OrigPassword, argv[2]);
	strcpy(NewPassword, argv[3]);

}


if (error = SECKFMChangePassword (IDFileSpec, OrigPassword, NewPassword)) 
   LAPI_RETURN (ERR(error));


}

The Make file :

!include <ntwin32.mak>

# The name of the program.

PROGNAME = ChangePassword

#
# DEC Alpha doesn't want the structures to be packed so we use the CPU
# type to conditionally add it as part of compile string
#
!IF "$(CPU)" == "ALPHA"
cpuflags = 
!ELSE
cpuflags = /Zp
!ENDIF

# Dependencies

$(PROGNAME).EXE: $(PROGNAME).OBJ
$(PROGNAME).OBJ: $(PROGNAME).C

# Compilation command.  

.C.OBJ:
    $(cc) $(cdebug) $(cflags) $(cpuflags) /DNT $(cvars) $*.c

# Link command.
           
.OBJ.EXE:
    $(link) $(linkdebug) $(conflags) -out:$@ $** notes0.obj $(conlibs) 
        notes.lib user32.lib
This was first published in October 2001

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close