ADMINReqMoveUserInHier

ADMINReqMoveUserInHier

Messagepar Stephane Maillard » 01 Août 2005 à 13:20

[syntax="ls"] Type TimeDate
Innards(1) As Long
End Type

Type Password
Data(12) As Long
End Type

Type ADMINReqParams
Flags As Long
dwDeleteInNABType As Long
pGroupName As Long
pAltName As Long
pFirstName As Long
pMiddleInitial As Long
pLastName As Long
pAltCommonName As Long
pAltOrgUnitName As Long
pAltLanguage As Long
fDontUseV1ChangeRequest As Integer
End Type

Const APIModule = "NNOTES" ' Windows

Declare Function OSPathNetConstruct Lib APIModule Alias "OSPathNetConstruct" _
( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As Integer
Declare Function NSFDbOpen Lib APIModule Alias "NSFDbOpen" _
( Byval PathName As String, DbHandle As Long) As Integer
Declare Function NSFDbClose Lib APIModule Alias "NSFDbClose" _
( Byval DbHandle As Long) As Integer

Declare Function NSFNoteOpen Lib APIModule Alias "NSFNoteOpen" _
( Byval hDB As Long, Byval N As Long, Byval F As Integer, hNT As Long) As Integer
Declare Function NSFNoteClose Lib APIModule Alias "NSFNoteClose" _
( Byval hNT As Long) As Integer

Declare Function REGFindAddressBookEntry Lib APIModule Alias "REGFindAddressBookEntry" _
( Byval hDB As Long, Byval S As String, Byval N As String, E As Long) As Integer

Declare Function SECKFMGetCertifierCtx Lib APIModule Alias "SECKFMGetCertifierCtx" _
( Byval F As String, P As Password, Byval L As String, T As TimeDate, Byval C As String _
, hCC As Long, H As Integer, V As Integer) As Integer
Declare Sub SECKFMFreeCertifierCtx Lib APIModule Alias "SECKFMFreeCertifierCtx" _
( Byval hCC As Long)
Declare Sub SECKFMCreatePassword Lib APIModule Alias "SECKFMCreatePassword" _
( Byval P As String, R As Password)

Declare Function ADMINReqMoveUserInHier Lib APIModule Alias "ADMINReqMoveUserInHier" _
( Byval hCC As Long, Byval hDB As Long, Byval hNT As Long, Byval C As String _
, W As Integer, E As Integer, P As ADMINReqParams, nP As Integer) As Integer

Declare Sub NEMDisplayError Lib "NNOTESWS" Alias "NEMDisplayError" _
( Byval E As Long)

Sub Click(Source As Button)
username$ = "CN=Joe Soap/O=Co-Synergy"

server$ = "CN=RodTest/O=Co-Synergy"
nabfile$ = "names.nsf"
logfile$ = "certlog.nsf"

certfile$ = "ids\certs\cosynergy.id"
certname$ = "O=Co-Synergy"
certpass$ = "..."

newcert$ = "O=TestCert"

p$ = Space(256)
OSPathNetConstruct 0, server$, nabfile$, p$
Dim hNAB As Long
NSFDbOpen p$, hNAB
If Not hNAB = 0 Then
Dim idNT As Long
REGFindAddressBookEntry hNAB, "$Users", username$, idNT
If Not idNT = 0 Then
Dim hNT As Long
NSFNoteOpen hNAB, idNT, 0, hNT
If Not hNT = 0 Then
Dim certPW As Password
SECKFMCreatePassword certpass$, certPW
Dim expiry As TimeDate
Dim hCC As Long
SECKFMGetCertifierCtx certfile$, certPW, logfile$, expiry, certname$, hCC, xh%, xv%
If Not hCC = 0 Then
Dim request As ADMINReqParams
s% = ADMINReqMoveUserInHier(hCC, hNAB, hNT, newcert$, xw%, xe%, request, 42)
If s% = 0 Then
Messagebox "OK", 64, "Test"
Else
NEMDisplayError s%
End If
End If
SECKFMFreeCertifierCtx hCC
End If
NSFNoteClose hNT
End If
End If
NSFDbClose hNAB
End Sub[/syntax]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Retour vers API