How to authorize Lotus Notes database by C++ API?

安稳与你 提交于 2019-12-25 04:17:37

问题


I run following code and get dialog box for entering password.

    LNNotesSession session;
    LNDatabase db;
    LNSetThrowAllErrors(TRUE);
    LNFormArray forms;
    LNIDFile idfile;
    LNCertifier cert;
    LNDatetime expired;

    try {
        session.Init();

        session.GetDatabase("names.nsf", &db, "ipanema");
        db.Open();
        db.GetForms(&forms);
        for (int i = 0; i < forms.GetCount(); i++) {
            LNForm form = forms[i];
            form.Open();
            LNString name = form.GetName();
            form.Close();
        }
        db.Close();
        session.Term();

    } catch(LNSTATUS error) {
        char errorBuf[LN_ERROR_MESSAGE_LENGTH];
        LNGetErrorMessage(error, errorBuf);
        MessageBox(NULL, errorBuf, "Lotus Notes Errors", MB_OK);
    }

How can I enter password by code instead of manual?


回答1:


The nextpwd option could help. Described here.




回答2:


There are a couple of other options I've used in the past: One is to create an ID for the purposes of running that code, and create it without a password. I then used other means of security to secure that ID file.

The other option is to enable client single sign-on and synchronize the passwords between your logged on windows user and the Notes user. That should work in this scenario, but I've only used this to bypass the prompt on the Notes Client itself.




回答3:


The answer depends on the situation.

  1. If the code is running on a user workstation, and you don't want the password prompt to appear if the user is logged into Notes, but you do want the password prompt to appear if the user is not logged in, then there is a builtin option in the Notes client for this. In Notes 8.x, it is in the User Security dialog, and the option label is "Don't prompt for a password from other Notes-based programs". There is a little tag after this option that says "reduces security", but all of the possible ways of bypassing password prompts do that.

  2. If the code is running on a user workstation, and the code will only run when the user is actually logged into windows, then Ken's second suggestion may be appropriate. The thing is, the Notes client's single sign-on feature is not usually activated on a case-by-case basis, and your organization's security, Domino and Windows administrators would have to be involved.

  3. If the code is running on a locked-down machine that no user routinely accesses, then Ken's first suggestion is appropriate, as long as your organization's security people are ok with having an unpassworded ID file.

  4. In pretty much all other cases, Jasper's suggestion of using the Extension Manager hook from the Notes C API is appropriate, and the sample extpwd.c code that is included in the C++ API toolkit is a good start. But don't just store the password in a file called password.txt! Wherever you store it, you need to encrypt the password, otherwise this is just as insecure as using an un-passworded ID file. (Truthfully, even storing it encrypted isn't good security practice since the key can probably be recovered by someone analyzing your code, but it's one of the compromises that we end up making for convenience.)



来源:https://stackoverflow.com/questions/7789178/how-to-authorize-lotus-notes-database-by-c-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!