📄 installer.c
字号:
continue;
pc = pc_db + strlen( pc_db) - 1;
while (*pc == ' ' || *pc == '\t')
*(pc--) = NULL;
if (!*pc_db)
continue;
if (us_err = us_OpenAndValidateMailDb( pc_db, pc_SERVERNM,
&pc_log, &h_db))
goto errJump;
if (h_db) {
if (us_err = us_RollBackMailDb( h_db, &t_env, pc_db, &pc_log))
goto errJump;
if (us_err = NSFDbClose( h_db))
goto errJump;
h_db = NULL;
}
} while (pc_db = strtok( NULL, mpc_DELIMITER));
*ppc_mereErrLog = pc_log;
errJump:
if (pc_EXTFILENM_DB_LIST)
free( pc_MailDbs);
if (h_db)
if ((us_error = NSFDbClose( h_db)) && !( us_err || f_failure))
us_err = us_error;
return us_err + f_failure;
} //us_RollBackMailDbs(
/** us_GetSourceEnvInfo( ***
Fills the provided special EnvInfo structure with information commonly used
in the PGP Notes Plug-In un/install routines.
--- parameters & return ----
pc_SERVERNM: Optional. Pointer to the name of the Domino server on which the
template to be opened resides. NULL pointer indicates that
template database has already been opened and its handle has been
provided in the appropriate member of the structure pointed to by the
pt_env parameter.
pc_EXTFILENM_TEMPLATE: Optional. Pointer to the name of the Notes template
database to be pumped for information.
pt_env: Output & Optional Input. Pointer to the structure to fill with
determined information about the installation environment. If no template
filename was specified, procedure expects the handle to the template
database to be provided in the h_template member of the structure.
RETURN: eus_SUCCESS if no error occured; the Notes API error code otherwise
--- revision history -------
4/24/01 PR: removed remmed-out code from listing
2/23/00 PR: logic adjustment to allow finding of crucial design elements
by alias as well as main title
9/20/99 PR: genericized code so install & uninstall could share
2/6/99 PR: created */
static STATUS us_GetSourceEnvInfo( char pc_SERVERNM[],
char pc_EXTFILENM_TEMPLATE[],
EnvInfo *const pt_env) {
DBHANDLE h;
STATUS us_err;
_ASSERTE( pt_env && (pc_SERVERNM ? pc_EXTFILENM_TEMPLATE :
pt_env->h_template));
if (pc_SERVERNM && pc_EXTFILENM_TEMPLATE) {
if (us_err = eus_OpenTemplate( pc_EXTFILENM_TEMPLATE, pc_SERVERNM,
&h, pt_env->pc_DbClass))
return us_err;
pt_env->h_template = h;
}else
h = pt_env->h_template;
if (us_err = SECKFMGetUserName( pt_env->pc_UserNm))
goto errJump;
if (us_err = NIFFindDesignNote( h, mpc_FORMNM_MEMO, NOTE_CLASS_FORM,
&pt_env->nid_Memo))
goto errJump;
if (us_err = NIFFindDesignNote( h, mpc_FORMNM_REPLY, NOTE_CLASS_FORM,
&pt_env->nid_Reply))
goto errJump;
if (us_err = NIFFindDesignNote( h, mpc_FORMNM_REPLY_WH, NOTE_CLASS_FORM,
&pt_env->nid_ReplyWH))
goto errJump;
if (us_err = NIFFindDesignNote( h, mpc_FORMNM_DEFAULT, NOTE_CLASS_FORM,
&pt_env->nid_Default))
if (ERR( us_err) != ERR_NOT_FOUND)
goto errJump;
else
pt_env->nid_Default = NULL;
if (pc_EXTFILENM_TEMPLATE)
strcpy( pt_env->pc_extFileNmTemplate, pc_EXTFILENM_TEMPLATE);
return eus_SUCCESS;
errJump:
if (pc_EXTFILENM_TEMPLATE)
NSFDbClose( h);
return us_err;
} //us_GetSourceEnvInfo(
/** us_InstallPlugInTemplate( ***
Conducts the creation/refresh of the PGP Notes Plugin Template based upon the
encountered current Domino environment. If the PGP template already exists on
the server being installed to, it is not replaced by the procedure; rather
its design elements are refreshed to the latest plug-in design as contained
in the installation package.
--- parameters & return ----
pc_SERVERNM: pointer to the name of the Domino server on which the plug-in's
components are to be installed
pc_EXTFILENM_MAIL_TEMPLATE: address of the extended filename of the Notes
Mail template whose e-mail forms will be copied to populate/refresh the
PGP Plugin Template database
pc_FILENM_PGP_TEMPLATE: address of the filename of the PGP Plugin Template
database, shorn of any path information as the template must reside in
the same directory as the specified Notes Mail template
pt_env: Output. Pointer to the structure to fill with determined information
about the installation environment.
RETURN:
eus_SUCCESS if no error occured
mus_EXCEPTION_HANDLED if particular errors occurred in template handling
(in which case the user has been informed of their nature by a
message-box prompt)
the Notes API error code otherwise
--- revision history -------
3/16/00 PR: safety improvement, at least
9/20/99 PR
+ logic adjustment in conjunction with recast of install routine
+ completed standard documentation
1/22/99: created */
static STATUS us_InstallPlugInTemplate( char pc_SERVERNM[],
char pc_EXTFILENM_MAIL_TEMPLATE[],
char pc_FILENM_PGP_TEMPLATE[],
EnvInfo *const pt_env) {
const char pc_PRFX_EXTFILENM_SRC_PGP_TEMPLATE[] = "INSTALL COPY--";
char pc_netFileNmPgpTemplate[ MAXPATH],
pc_extFileNmSrcPgpTemplate[ MAXPATH];
DBHANDLE h_MailTemplate, h_PgpTemplate = NULLHANDLE;
BOOL f_freshInstall;
NOTEID nid;
STATUS us_err, us_error, us_errDbDelete = eus_SUCCESS;
_ASSERTE( pc_SERVERNM && pc_EXTFILENM_MAIL_TEMPLATE && pt_env);
memset( pt_env, NULL, sizeof( EnvInfo));
if (us_err = us_OpenMailTemplate( pc_EXTFILENM_MAIL_TEMPLATE,
pc_SERVERNM, &h_MailTemplate, NULL))
return us_err;
if (!h_MailTemplate)
return mus_HANDLED_EXCEPTION;
//if no PGP plug-in template is found in the same directory as the mail
// template...
if (us_err = us_TestPgpTemplatePlaced( pc_FILENM_PGP_TEMPLATE,
pc_SERVERNM, pc_EXTFILENM_MAIL_TEMPLATE,
&h_PgpTemplate, pt_env->pc_DbClass,
pc_netFileNmPgpTemplate))
goto errJump;
strcat( strcpy( pc_extFileNmSrcPgpTemplate,
pc_PRFX_EXTFILENM_SRC_PGP_TEMPLATE),
pc_FILENM_PGP_TEMPLATE);
if (us_err = SECKFMGetUserName( pt_env->pc_UserNm))
goto errJump;
if (f_freshInstall = !h_PgpTemplate) {
char * pc = strrchr( pc_netFileNmPgpTemplate, ec_PATH_SPECIFIER);
//copy the template into that directory
if (pc)
pc_netFileNmPgpTemplate[ pc - pc_netFileNmPgpTemplate + 1] = NULL;
else
OSPathNetConstruct( NULL, pc_SERVERNM, epc_NULL,
pc_netFileNmPgpTemplate);
if (us_err = us_PlacePgpTemplate( pc_extFileNmSrcPgpTemplate,
strcat( pc_netFileNmPgpTemplate,
pc_FILENM_PGP_TEMPLATE),
pt_env->pc_UserNm, h_MailTemplate,
pc_EXTFILENM_MAIL_TEMPLATE,
&h_PgpTemplate, pt_env->pc_DbClass))
goto errJump;
//get the NoteID of the PGP subform design note
if (us_err = NIFFindDesignNote( h_PgpTemplate, mpc_SUBFORMNM_PGP,
NOTE_CLASS_FORM, &nid))
goto errJump;
//Else replace the design elements in the existing template with the
// design elements in the template just copied in by the installation
// process. This approach allows us to refresh the PGP installation
// without disturbing the existing ACL or Replica ID.
}else
if (us_err = us_RefreshPgpTemplate( h_PgpTemplate,
pc_extFileNmSrcPgpTemplate,
pc_EXTFILENM_MAIL_TEMPLATE, &nid))
goto errJump;
//delete the local, source template database which carried in the latest
// version of the PGP e-mail subform
#ifdef NDEBUG
us_errDbDelete = NSFDbDelete( pc_extFileNmSrcPgpTemplate);
#endif
//PGP-enable each of the significant e-mail forms, copying them from the
// mail template
if (us_err = us_PgpEnableEmailForm( mpc_FORMNM_MEMO, TRUE,
h_MailTemplate, h_PgpTemplate,
f_freshInstall, &pt_env->nid_Memo))
goto errJump;
if (us_err = us_PgpEnableEmailForm( mpc_FORMNM_REPLY, TRUE,
h_MailTemplate, h_PgpTemplate,
f_freshInstall, &pt_env->nid_Reply))
goto errJump;
if (us_err = us_PgpEnableEmailForm( mpc_FORMNM_REPLY_WH, TRUE,
h_MailTemplate, h_PgpTemplate,
f_freshInstall, &pt_env->nid_ReplyWH))
goto errJump;
if (us_err = us_PgpEnableEmailForm( mpc_FORMNM_DEFAULT, FALSE,
h_MailTemplate, h_PgpTemplate,
f_freshInstall, &pt_env->nid_Default))
goto errJump;
pt_env->h_template = h_PgpTemplate;
pt_env->nid_PgpSubform = nid;
OSPathNetParse( pc_netFileNmPgpTemplate, NULL, NULL,
pt_env->pc_extFileNmTemplate);
errJump:
if ((us_error = NSFDbClose( h_MailTemplate)) && !us_err)
us_err = us_error;
return us_err ? us_err : us_errDbDelete;
} //us_InstallPlugInTemplate(
/** us_PgpEnableEmailForm( ***
--- parameters & return ------
RETURN: eus_SUCCESS if no error occured; the Notes API error code otherwise
--- suggested enhancement ----
2/23/00 PR: Should handle error where PGP subform is already at the top of
the organization's mail template with user-friendly message box. It's
quite possible that some misguided administrator might decide to PGP
enable the mail template instead of sticking with the paradigm we've set
constructed.
--- revision history ---------
7/2/01 PR: removed remmed-out code
3/16/00 PR: adjustment to support change in how subforms are inserted in R5
2/23/00 PR
+ to prevent "corrupted note" error message in Notes 4.5.1 client, added
OPEN_EXPAND flag when opening notes to be signed
+ logic adjustment to allow finding of crucial design elements by alias as
well as main title
9/20/99 PR: function signature change to promote efficiency
2/8/99 PR: created */
static STATUS us_PgpEnableEmailForm( char pc_FORMNM[],
const BOOL f_REQUIRED,
DBHANDLE h_MAIL_TEMPLATE,
DBHANDLE h_PGP_TEMPLATE,
const BOOL f_FRESH_INSTALL,
NOTEID *const pnid_form) {
NOTEID nid_src, nid;
NOTEHANDLE h;
STATUS us_err;
_ASSERTE( pc_FORMNM && *pc_FORMNM && h_MAIL_TEMPLATE &&
h_PGP_TEMPLATE && h_MAIL_TEMPLATE !=
h_PGP_TEMPLATE /*&& h_PGP_SUBFORM*/);
if (pnid_form)
*pnid_form = NULL;
//copy the form into the PGP design-element database, replacing an
// existing copy if necessary
if (us_err = NIFFindDesignNote( h_MAIL_TEMPLATE, pc_FORMNM,
NOTE_CLASS_FORM, &nid_src))
return ERR( us_err) == ERR_NOT_FOUND && !f_REQUIRED ?
eus_SUCCESS : us_err;
if (!f_FRESH_INSTALL) {
if (us_err = NIFFindDesignNote( h_PGP_TEMPLATE, pc_FORMNM,
NOTE_CLASS_FORM, &nid)) {
if (ERR( us_err) != ERR_NOT_FOUND)
return us_err;
}else
if (us_err = NSFNoteDelete( h_PGP_TEMPLATE, nid, NULL))
return us_err;
}
if (us_err = NSFDbCopyNote( h_MAIL_TEMPLATE, NULL, NULL, nid_src,
h_PGP_TEMPLATE, NULL, NULL, &nid, NULL))
return us_err;
//Insert the PGP subform at the top of the form. Although at some point
// later versions do not have the restriction, the Notes 4.5.1 client
// will successfully verify design-note signatures only when the design
// note was explicitly opened with the "expand" flag before being signed.
if (us_err = NSFNoteOpen( h_PGP_TEMPLATE, nid, OPEN_EXPAND, &h))
return us_err;
if (us_err = us_InsertSubformTop( h, mpc_SUBFORMNM_PGP))
goto errJump;
//If this is the Reply With History form, remove any form aliases as a
// work-around to a nettlesome Notes bug. When a Design Refresh is
// invoked for a database and a particular form design element
// inherits from a template different from the database's default
// template, Notes searches for the form element by its *alias*, not by
// its first name. The alias for the Reply With History form is "Reply",
// so if no workaround were provided here, Notes would replace the
// Reply With History form with a duplicate Reply form, thus breaking
// the mail databae, effectively. So here we remove the alias, and we
// rely on the smarts of the PGP E-Mail subform to reproduce the
// form's alias functionality.
if (strcmp( pc_FORMNM, mpc_FORMNM_REPLY_WH) == ei_SAME) {
const WORD US = strlen( mpc_FORMNM_REPLY_WH);
char pc[ MAXBYTE];
WORD us;
if (!( us = NSFItemGetTextListEntry( h, FIELD_TITLE, 0, pc, MAXBYTE)))
goto errJump;
if (us > MAXBYTE - US) {
us_err = !eus_SUCCESS;
goto errJump;
}
if (us_err = eus_RemoveItem( h, FIELD_TITLE, ebid_NULLBLOCKID))
goto errJump;
if (us_err = NSFItemAppendTextList( h, FIELD_TITLE, pc, us, TRUE))
goto errJump;
if (us_err = NSFItemAppendTextList( h, FIELD_TITLE,
mpc_FORMNM_REPLY_WH, US, TRUE))
goto errJump;
} //if (strcmp( pc_FORMNM,
//sign and save the form
if (us_err = NSFNoteSign( h))
goto errJump;
if (us_err = NSFNoteUpdate( h, NULL))
goto errJump;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -