SECidfGet and other security related API commands in LS

Hi, the most of our users are iNotes users and we have to manage their user IDs whenever they get renamed (moved from an OU to another) to get the whole rename process (rename in ACLs, groups, unread lists, etc…) executed.I’m not a developer, but 'I’m trying to create an agent that downloads ID file from IDVault and writes it to disk, opens it, executes a “SECRefreshIdFile” command writes back the modifications and then does a “SECidfSync” of the modified id…

Since LS doesn’t support this kind of operations I need to use APIs, but I’m stuck at the first step: SECidfGet gets the RC 2051

This is the declaration:

Declare Function SECidfGet Lib “nnotes.dll” _

(ByVal pUserName As String,_

ByVal pPassword As String,_

ByVal pPutIDFileHere As String,_

ByVal KFHANDLE As Long,_

pServerName As String,_

ByVal dwReservedFlags As Long,_

ByVal wReservedType As Integer,_

pReserved As Integer) As Integer

Then I call it in a sub:

Sub ProcessID (uid As String, uname As String, temp As String, vaultserver As string)

Dim rc As Integer

Dim handle As Long



If Dir$(temp & "\RenUs", 16) = "" Then

	MkDir temp & "\RenUs\"

End If



rc = SECidfGet(uname, PWD, temp & "\RenUs\" & uid & ".id", handle, vaultserver, 0, 0, 0)

Print rc

'....more code here

End Sub

uid is the shortname from the person document in names

uname is the user’s old canonical name

temp is the result of Environ$(“TMP”)

vaultserver is the canonical name the server where the ID Vault resides

PWD is a public const declared at the beginning (this one is just an example)

Public Const PWD = “PASSWORD”

The agent is executed by me (ID Vault administrator, with [Auditor] role)

I’m pretty sure that i messed up something in the function declaration… any idea?

Subject: Sample code…

I needed to do something similar a while ago. I’m not able to share my solution, but this forum post solved most of my issues: http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/b30b2cbf04a53b83852571f0003e7584?OpenDocument and there’s a slightly fuller solution here: http://tippner.blogspot.co.uk/2011/02/managing-userids-in-lotus-notes.html

Or alternatively, upgrade to 8.5 and start using the ID vault, and you don’t have to worry about this any more :slight_smile:

Subject: RE: Sample code…

I’m already using 8.5.2 FP3 server, the problem is the SECidfGet function, to retrieve the id from vault that says “Unable to find path to server. Check that your network connection is working. If you have a working connection, go to Preferences - Notes Ports and click Trace to discover where it breaks down.”

The same variable works with NSFDbOpen

Subject: RE: SECidfGet and other security related API commands in LS

I got it!The problem was in the declaration, as I supposed.

The correct declaration for SECidfGet is:

Declare Function SECidfGet Lib “nnotes.dll” _

(ByVal pUserName As LMBCS String,_

ByVal pPassword As LMBCS String,_

ByVal pPutIDFileHere As LMBCS String,_

ByVal KFHANDLE As Long,_

ByVal pServerName As String,_

ByVal dwReservedFlags As Long,_

ByVal wReservedType As Integer,_

pReserved As Integer) As Integer

Now the error is wrong password, so i think i have to reset it with SECidvResetUserPassword before extracting it with a default password.