I use this code in LotusScript to go through shares on a server looking for user ID files. Once the ID files were...
found, I would run the code against them to gather information about the ID. I've also used the code in a Domain merge to run a list of IDs against a server to change a password and trigger the Adminp process.
Declare Function SECKFMChangePassword Lib "c:lotusnotesnnotes.dll" (Byval IDFile$,Byval OldPassword$, Byval NewPassword$)As Integer Declare Function SECKFMSwitchToIDFile Lib "c:lotusnotesnnotes.dll" (Byval IDFile$,Byval Password$, Byval UserName$, Byval MaxUserNameLength%,Byval ReservedFlag&,Byval flag&)As Integer Declare Function OSLoadString Lib "c:lotusnotesnlib.dll" (Byval hModule&, Byval Status%, Byval retBuffer$, Byval BufferLength%) As Integer Const MAXUSERNAME=256 Type ID_INFO Name As String Password As String End Type Function APICheckError(Error%) As String Dim s$, x% If Error% <> 0 Then s$ = Space$(254) x% = OSLoadString(0, Error%, s$, 254) If x% = 0 Then s$ = "General Notes Error" Else s$ = Left$(s$,x%) End If APICheckError= s$ End If End Function Sub APISwitchID(filepath$, passwordlist, id As ID_Info, s$) Dim Status% Dim Flag% Dim UserName As String * MAXUSERNAME ID.Name="NA" ID.Password= "NA" Flag%=False Forall x In PasswordList pword$=Cstr(x) Print s & " Checking Password ......" & Pword$ ,filepath$ Status%=SECKFMSwitchToIDFile (filepath$,pword$,UserName, MAXUSERNAME,0,0) If Status% =0 Then Print Now " Change Password SUCCESS %lt" & IDFile$ & ">" ' Call CreateIDDoc(filepath$,UserName, pword$,filepath$) Flag%=True ID.Name=UserName ID.Password= Cstr(x) Exit Forall Else Print "Error " & APICheckError(status%) Print" Change Password ERROR <" & IDFile$ & ">" Print" ERROR <" & APICheckError(status%)& ">" End If Status%=0 Yield End Forall If Flag%=False Then Print Now & " ERROR Could Not Add file <" & IDFile$ & ">" End If End Sub Function APIChangePword(IDFile$, OldPword$, NewPword$)As Integer Dim Status% Status%=SECKFMChangePassword (IDFile$,OldPword$,NewPword$) If Status% =0 Then Print"Change Password SUCCESS <" & IDFile$ & ">" APIChangePword=True Else Print"Change Password ERROR <" & IDFile$ & ">" Print"ERROR <" & APICheckError (status%)& ">" APIChangePword=False End If End Function
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Jon Lindgren. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.