summaryrefslogtreecommitdiffstats
path: root/ldap
Commit message (Collapse)AuthorAgeFilesLines
...
* Initial import of memberof plugin from FreeIPA (refactored from changeset ↵Nathan Kinder2008-02-191-0/+2030
| | | | 640:9c57bd91b32f if ipa-memberof.c).
* Resolves: 429793Nathan Kinder2008-01-254-59/+41
| | | | Summary: Fixed crash in replication during bulk import. Use bulk impport code more consistently.
* Resolves: 429799Nathan Kinder2008-01-241-1/+1
| | | | Summary: Allow import fifo to clear out all finished entries.
* Resolves: bug 425849Rich Megginson2007-12-171-1/+3
| | | | | | | | | | | Bug Description: migrate-ds-admin.pl spins at 100% cpu Reviewed by: nkinder (Thanks!) Fix Description: It was spinning because inst_dir was not being set, so it kept trying to find the parent directory of a non-existent directory. In migration, the old instance has no instance dir - we will fill that in during instance creation, so just skip it if not set. I also found and fixed another bug in migration with the usage of file_name_is_absolute - have to use the full module name and function name. Platforms tested: RHEL4 32bit and 64bit Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: bug 425861Rich Megginson2007-12-171-4/+14
| | | | | | | | | | | | Bug Description: Instance creation through console is broken Reviewed by: nhosoi (Thanks!) Fix Description: This was caused by my fix for bug 420751. When I added the as_uid to fix the ACI for the admin user, I did not add the mapping everywhere it was used. Unfortunately, I found that the code I added it to could only be used with a live connection to the new directory server, not a FileConn to the dse.ldif. So I had to add a new function to add this ACI to the new root suffix after the server had been started. Another problem with instance creation was that the org entries were not being added when creating a new instance in the console. The default should be to create them if nothing else was specified. Another problem was that instance creation was leaving temp ldif files around. I also had to make sure ServerAdminID was specified everywhere it was needed by dirserver.map, or this would also have broken ds_remove. Platforms tested: RHEL5 x86_64 Flag Day: Yes - autotool file change in adminserver Doc impact: no
* Resolves: bug 424381Rich Megginson2007-12-141-1/+1
| | | | | Description: migrate-ds-admin.pl script - not working Fix Description: Was getting this output - GLOB(0x9d908d8)inst_dir = - forgot a comma
* Resolves: bug 424381Rich Megginson2007-12-131-2/+2
| | | | | Description: migrate-ds-admin.pl script - not working Fix Description: Broken while fixing bug 400421 - Need to use $mig->{inf} instead of $inf
* Resolves: bug 416721Rich Megginson2007-12-081-1/+3
| | | | | Descriptionn: fedora-ds-base build problem Fix Description: Correct usage of va_list and vfprintf
* Resolves: bug 400421Rich Megginson2007-12-072-0/+22
| | | | | | | | | | | Bug Description: unable to restart configDS via console Reviewed by: nhosoi (Thanks!) Fix Description: We were using the old format for the ldapStart directive, which assumed everything was under a serverroot, so it just stored the relative path. We need the absolute path. During regular setup, we can get this from the directory server instance. During migration, we need to update the ldapStart directive to use the absolute path, so we need to get that information from the directory server code. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: #403751Noriko Hosoi2007-12-061-8/+7
| | | | | Summary: command line scripts fine tuning (Comment #2) Description: removed words "6.x" and "iWS" from the output messages.
* Resolves: #403751Noriko Hosoi2007-12-061-12/+13
| | | | | Summary: command line scripts fine tuning (Comment #1) Description: dded "-T vlvAttributeName: ..." to the usage
* Resolves: #174776Noriko Hosoi2007-12-041-3/+7
| | | | | | | Summary: Multiple restores from a non-existant directory could wipe out database Description: The given archive path was not normalized. Due to the trailing slash '/', comparing with the db dir failed and wiped out the db dirs. Applying the path normalization to the archive path.
* Resolves: #231093Noriko Hosoi2007-12-045-72/+104
| | | | | | | | | | | | | | Summary: db2bak: crash bug (comment #8, 11) Description: Set the strong requirement: nsslapd-directory must have some value. to guarantee it: 1) checking errors from ldbm_config_directory_set. If the check fails, don't start the server. 2) if nsslapd-directory does not exist or the value is empty in dse.ldif, issuing an error message and returning the error code. 3) since it was difficult to distinguish the nsslapd-directory empty value from the initial default value, introduced CONFIG_FLAG_SKIP_DEFAULT_SETTING flag to tell the backend config code to skip setting the default value
* Resolves: #403351Noriko Hosoi2007-12-031-16/+37
| | | | | | | | | | | Summary: LongDuration: Error log Rotation test suite causes slapd hang Problem description: LDAPDebug eventually calls slapd_log_error_proc_internal, which obtains the lock. If any functions called in the lock tries to log into the errors log, it tries to get the same lock and it hangs there since the underlying PR_Lock is not reentrant. Fix description: log__enough_freespace and log__delete_error_logfile could be called indirectly from slapd_log_error_proc_internal. Instead of LDAPDebug, changed these functions to call log__error_emergency when necessary.
* Resolves: #229576Noriko Hosoi2007-11-308-13918/+0
| | | | | | | | | | Summary: clean up template-scriptname which is derived from template-scriptname.in (comment #3,4) Description: removing obsolete scripts: ds_viewlog.pl scripts/template-dsml-activate.pl scripts/template-migrateInstance5 scripts/template-migrateTo6 scripts/template-migrate50to51 scripts/template-migrateInstance6 scripts/template-migrate5to6 scripts/template-migrateTo5
* Resolves: #316281Noriko Hosoi2007-11-301-2/+2
| | | | | | Summary: db2bak fails if the archive path exists and ends with '/' (Comment #8) Description: Changed the condition to normalize the path: if '.' or '/' is included in the path, normalize it.
* Resolves: #238649Noriko Hosoi2007-11-281-1/+1
| | | | | | Summary: Hide nsslapd-db-transaction Description: don't show the configuration parameter nsslapd-db-transaction in dse.ldif.
* Resolves: #371751Noriko Hosoi2007-11-281-1/+1
| | | | Summary: verify-db.pl : can't find dbverify
* Resolves: #345671Noriko Hosoi2007-11-281-14/+32
| | | | | | Summary: clu test failures (Comment #7) Description: 1) Removing obsolete PATH info from Usage 2) Replacing "idl" with "ID list" following the suggestion from Doc.
* Resolves: bug 371771Rich Megginson2007-11-213-4/+4
| | | | | | | | | | | Bug Description: '.' (dot) in the server ID Reviewed by: nkinder (Thanks!) Fix Description: Remove . and , from the characters allowed in the server ID. Also use the more descriptive error message. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: bug 388021Rich Megginson2007-11-191-2/+34
| | | | | | | | | | Bug Description: MMR breaks from master that has been reinited Reviewed by: nkinder (Thanks!) Fix Description: This problem occurs when you have two or more masters, and you have updates that have originated at a master that have been sent to other masters (so that the other masters have a valid min/max csn for that replica in the ruv). If that master needs to be reinitialized for some reason (crash, etc.) the reinit will erase the changelog. The RUV for that master will now contain CSNs that are not in the changelog. If that master attempts to update another master, it will first look at the RUV from the consumer, which will contain the old CSNs, and it will look for those CSNs in the changelog, fail, and abort the update process, meaning this master can no longer send updates to other servers. The solution is for the master to just use the min CSN in its own RUV as the new starting point, if it has not been purged. In the case of purging, if the CSN is not found, this means the consumer is too far behind and must be reinitialized. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no
* Resolves: #383141Noriko Hosoi2007-11-141-3/+4
| | | | | | | Summary: listenhost: hostname associated with multiple addresses 1) parentheses were needed around *addr, which should have been evaluated before the array. 2) fixed a small memory leak.
* Resolves: bug 197997Rich Megginson2007-11-141-2/+21
| | | | | | | | | | | | | | | Bug Description: PTA config parsing broken Reviewed by: nhosoi (Thanks!) Fix Description: The problem is that it is very difficult to use a comma as a delimiter between the url and the optional settings. This is because the suffix may contain many commas. The argument string may look like this: ldap://host1:port1 host2:port2 .... hostN:portN/a,long,suffix1:a,long,suffix2;....;a,long,suffixN optional,numeric,settings The ldap url may not contain any spaces after the hostlist - the suffixlist part must contain only url encoded spaces if the suffix actually has a space in it. So the solution is to use a space to separate the url from the options list. The parser looks for the first space after the last "/" in the url. This should be ok - at least it will not break the most common use of pta, which is to allow the config DS admin user to log into servers that do not have the o=NetscapeRoot. setup will use something like this: ldap://configdshost:configdsport/o=NetscapeRoot with not optional settings - this should parse just fine with the new code. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: bug 345711Rich Megginson2007-11-141-2/+1
| | | | | Description: migration : ignore idl switch value in 6.21 and earlier Fix Description: Have to assign the values directly to the array ref - not to a temp array ref
* Resolves: bug 367721Rich Megginson2007-11-141-1/+1
| | | | | | | | | | | Bug Description: dbgen.pl uses incorrect perl interpreter on hpux Reviewed by: nhosoi (Thanks!) Fix Description: Set @perlexec@ to the correct platform specific perl location. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: bug 339041Rich Megginson2007-11-142-23/+19
| | | | | | | | | | | Bug Description: migration : encryption key entries missing when source is 6.21 Reviewed by: nhosoi (Thanks!) Fix Description: I found out why it wasn't always adding the attribute encryption entries. If the cn=monitor entry existed for the database, it would not add the other container entries. I don't know why it did that. I changed it to always add those entries, and just skip the ones that already exist. This should ensure that the attribute encryption entries always exist. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: #367671Noriko Hosoi2007-11-061-1/+1
| | | | | Summary: verify-db.pl : can't find dbverify (comment #5) Fix: added the inst_dir to PATH to tell verify-db.pl where dbverify is located.
* Resolves: #193724Noriko Hosoi2007-11-011-156/+155
| | | | | | | | | | | Summary: "nested" filtered roles result in deadlock Description: Function slapi_vattr_values_get_sp used to use the context allocated on the stack. Changed it to call vattr_context_new to set the locally created pblock (local_pb). The pblock is used to pass the context loop info as the stack gets deeper to prevent the stack overflow. At the end of this function slapi_vattr_values_get_sp, slapi_pblock_destroy is called if the context is local (use_local_ctx). The function cleans up pb_vattr_context internally.
* Resolves: bug 353071Rich Megginson2007-10-261-0/+80
| | | | | Description: Need to support mail server schema Fix Description: There are customers who are using the mail schema, so we need to keep it in the product.
* Resolves: Bug 345711Rich Megginson2007-10-261-1/+1
| | | | | Description: migration : ignore idl switch value in 6.21 and earlier Fix Description: Fix the error message
* Resolves: bug 345711Rich Megginson2007-10-251-1/+1
| | | | | Description: migration : ignore idl switch value in 6.21 and earlier Fix Description: Fix the error message
* Resolves: #339791Noriko Hosoi2007-10-243-35/+57
| | | | | | | Summary: rhds71sp1 rhel3u6 - ns-slapd process dies with segmentation fault Description: ldap_utf8prev, LDAP_UTF8PREV, and LDAP_UTF8DEC were sometimes used without checking the returned pointer going back beyond the beginning of the string.
* Resolves: #188320Noriko Hosoi2007-10-231-5/+4
| | | | | | Summary: HP-UX: warnings reported by the HP-UX compiler (Comment #25,26) Change description: moved the DEBUG_TRACE to the place before deleting the physical log file.
* Resolves: bug 345711Rich Megginson2007-10-231-22/+55
| | | | | | | | | | | Bug Description: migration : ignore idl switch value in 6.21 and earlier Reviewed by: nhosoi (Thanks!) Fix Description: If we are migrating a 6.21 or older database, we must not preserve the old idl switch setting, we must use the new default. We also have to use LDIF files for database migration as we cannot reuse the old binary database files. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: 344631Nathan Kinder2007-10-221-4/+5
| | | | Summary: Corrected path generation for loading SNMP stats file.
* Resolves: bug 232910Rich Megginson2007-10-191-9/+9
| | | | | Description: ACI targetattr list parser is whitespace sensitive Fix Description: In addition to the previous fixes, test for quote at end of string before incrementing s - otherwise test will always fail.
* Resolves: bug 232910Rich Megginson2007-10-191-8/+15
| | | | | Description: ACI targetattr list parser is whitespace sensitive Fix Description: I made it too sensitive. The parser should allow simple unquoted strings. However, if it begins with a quote, it must end with a quote.
* Resolves: 188320Nathan Kinder2007-10-191-0/+8
| | | | Summary: Don't define _XOPEN_SOURCE_EXTENDED on HP-UX.
* Resolves: bug 340211Rich Megginson2007-10-191-2/+2
| | | | | Description: ssl acceptance tests are failing Fix Description: This isn't the full fix, but the error message should print out the directory where it was looking for the missing cert db files.
* Resolves: bug 297221Rich Megginson2007-10-194-6/+19
| | | | | | Description: rhds71 Malformed Dynamic Authorization Group makes Directory Server Crash Reviewed by: supplemental Fix Description: In some cases, it is ok if the filter is NULL. So just allow NULL in those cases. slapi_str2filter must take either NULL or a writable string, so make sure we pass those in correctly.
* Resolves: bug 336881Rich Megginson2007-10-191-4/+9
| | | | | | | | | | | Bug Description: qualify warning message when cert8.db is missing Reviewed by: self Fix Description: Only warn when both cert8.db and cert7.db are missing. If cert7.db is there, NSS will automatically create cert8.db from it. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: bug 339041Rich Megginson2007-10-191-0/+10
| | | | | | | | | | | Bug Description: migration : encryption key entries missing when source is 6.21 Reviewed by: self Fix Description: Just always create those entries when creating the backend. The server does this at startup, but I guess for this case that occurs too late in the startup process. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: #339031Noriko Hosoi2007-10-194-4/+7
| | | | Summary: Solaris: warnings reported by the Solaris compiler
* Resolves: bug 338991Rich Megginson2007-10-191-2/+6
| | | | | | | | | | | Bug Description: obsolete values migrated to target instance Reviewed by: nhosoi (Thanks!) Fix Description: When fixing the attributes in the old entry, remove any obsolete attributes. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
* Resolves: #336871Noriko Hosoi2007-10-181-1/+1
| | | | | | Summary: infadd tool won't start. Fails to load data file (comment #4) Description: HP compiler does not like to have a function call in a constant expression.
* Resolves #329951Noriko Hosoi2007-10-187-184/+228
| | | | | | | | | Summary: MMR: Supplier does not respond anymore after many operations (deletes) Description: introduce OP_FLAG_REPL_RUV. It's set in repl5_replica.c if the entry is RUV. The operation should not be blocked at the backend SERIAL lock (this is achieved by having OP_FLAG_REPL_FIXUP set in the operation flag). But updating RUV has nothing to do with VLV, thus if the flag is set, it skips the VLV indexing.
* Resolves: bug 297221Rich Megginson2007-10-184-3/+27
| | | | | | | | | | Bug Description: rhds71 Malformed Dynamic Authorization Group makes Directory Server Crash Reviewed by: nhosoi (Thanks!) Fix Description: The problem was that we were not checking the return value of slapi_str2filter(). I added a check at the crash site, and it will not print out a helpful error message. I did a search through the code looking for other similar places and found a couple. I added similar code in those places. I added an initialization of a buffer to null, as suggested by nhosoi. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no
* Resolves: bug 232910Rich Megginson2007-10-181-1/+10
| | | | | | | | | | | Bug Description: ACI targetattr list parser is whitespace sensitive Reviewed by: nkinder, nhosoi (Thanks!) Files: see diff Branch: HEAD Fix Description: Need to trim trailing whitespace from the targetattr clause. I noticed that targetattrfilters had the same problem, except it returned ACL_SYNTAX_ERR in that case, so I changed targetattr to do the same. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no
* Resolves: #193724Noriko Hosoi2007-10-181-0/+1
| | | | | Summary: "nested" filtered roles result in deadlock (comment #16) Description: fixed a memory leak introduced in the previous checkins (comment #12)
* Resolves: 336871Nathan Kinder2007-10-181-9/+3
| | | | Summary: Look for infadd data files in TEMPLATEDIR.
span class="hl opt">.security.x509.RevokedCertImpl; import netscape.security.x509.X509CertImpl; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.authentication.AuthToken; import com.netscape.certsrv.authentication.IAuthSubsystem; import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.authority.ICertAuthority; import com.netscape.certsrv.authorization.AuthzToken; import com.netscape.certsrv.authorization.EAuthzAccessDenied; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.base.Nonces; import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.dbs.certdb.ICertRecord; import com.netscape.certsrv.dbs.certdb.ICertificateRepository; import com.netscape.certsrv.logging.AuditFormat; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.publish.IPublisherProcessor; import com.netscape.certsrv.ra.IRegistrationAuthority; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestQueue; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; import com.netscape.certsrv.usrgrp.Certificates; import com.netscape.certsrv.usrgrp.ICertUserLocator; import com.netscape.certsrv.usrgrp.IUGSubsystem; import com.netscape.certsrv.usrgrp.IUser; import com.netscape.cms.servlet.base.CMSServlet; import com.netscape.cms.servlet.common.CMSRequest; import com.netscape.cms.servlet.common.CMSTemplate; import com.netscape.cms.servlet.common.CMSTemplateParams; import com.netscape.cms.servlet.common.ECMSGWException; /** * Revoke a Certificate * * @version $Revision$, $Date$ */ public class DoRevoke extends CMSServlet { /** * */ private static final long serialVersionUID = 1693115906265904238L; private final static String TPL_FILE = "revocationResult.template"; private ICertificateRepository mCertDB = null; private String mFormPath = null; private IRequestQueue mQueue = null; private IPublisherProcessor mPublisherProcessor = null; private Nonces mNonces = null; private int mTimeLimits = 30; /* in seconds */ private IUGSubsystem mUG = null; private ICertUserLocator mUL = null; private final static String REVOKE = "revoke"; private final static String ON_HOLD = "on-hold"; private final static int ON_HOLD_REASON = 6; private final static String LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST = "LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_5"; private final static String LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED = "LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED_7"; public DoRevoke() { super(); } /** * initialize the servlet. This servlet uses the template * file "revocationResult.template" to render the result * * @param sc servlet configuration, read from the web.xml file */ public void init(ServletConfig sc) throws ServletException { super.init(sc); mFormPath = "/" + mAuthority.getId() + "/" + TPL_FILE; mUG = (IUGSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_UG); mUL = mUG.getCertUserLocator(); if (mAuthority instanceof ICertificateAuthority) { mCertDB = ((ICertificateAuthority) mAuthority).getCertificateRepository(); if (((ICertificateAuthority) mAuthority).noncesEnabled()) { mNonces = ((ICertificateAuthority) mAuthority).getNonces(); } } if (mAuthority instanceof ICertAuthority) { mPublisherProcessor = ((ICertAuthority) mAuthority).getPublisherProcessor(); } mQueue = mAuthority.getRequestQueue(); mTemplates.remove(CMSRequest.SUCCESS); if (mOutputTemplatePath != null) mFormPath = mOutputTemplatePath; /* Server-Side time limit */ try { mTimeLimits = Integer.parseInt(sc.getInitParameter("timeLimits")); } catch (Exception e) { /* do nothing, just use the default if integer parsing failed */ } } /** * Serves HTTP request. The http parameters used by this request are as follows: * * <pre> * serialNumber Serial number of certificate to revoke (in HEX) * revocationReason Revocation reason (Described below) * totalRecordCount [number] * verifiedRecordCount [number] * invalidityDate [number of seconds in Jan 1,1970] * * </pre> * * revocationReason can be one of these values: * * <pre> * 0 = Unspecified (default) * 1 = Key compromised * 2 = CA key compromised * 3 = Affiliation changed * 4 = Certificate superseded * 5 = Cessation of operation * 6 = Certificate is on hold * </pre> */ public void process(CMSRequest cmsReq) throws EBaseException { HttpServletRequest req = cmsReq.getHttpReq(); HttpServletResponse resp = cmsReq.getHttpResp(); IAuthToken authToken = authenticate(cmsReq); String revokeAll = null; int totalRecordCount = -1; int verifiedRecordCount = -1; EBaseException error = null; int reason = -1; boolean authorized = true; Date invalidityDate = null; CMSTemplate form = null; Locale[] locale = new Locale[1]; try { form = getTemplate(mFormPath, req, locale); } catch (IOException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_ERR_GET_TEMPLATE", mFormPath, e.toString())); throw new ECMSGWException(CMS.getLogMessage("CMSGW_ERROR_DISPLAY_TEMPLATE")); } IArgBlock header = CMS.createArgBlock(); IArgBlock ctx = CMS.createArgBlock(); CMSTemplateParams argSet = new CMSTemplateParams(header, ctx); try { if (req.getParameter("revocationReason") != null) { reason = Integer.parseInt(req.getParameter( "revocationReason")); } if (req.getParameter("totalRecordCount") != null) { totalRecordCount = Integer.parseInt(req.getParameter( "totalRecordCount")); } if (req.getParameter("verifiedRecordCount") != null) { verifiedRecordCount = Integer.parseInt( req.getParameter( "verifiedRecordCount")); } if (req.getParameter("invalidityDate") != null) { long l = Long.parseLong(req.getParameter( "invalidityDate")); if (l > 0) { invalidityDate = new Date(l); } } revokeAll = req.getParameter("revokeAll"); if (mNonces != null) { boolean nonceVerified = false; boolean skipNonceVerification = false; X509Certificate cert2 = getSSLClientCertificate(req); if (cert2 != null) { X509Certificate certChain[] = new X509Certificate[1]; certChain[0] = cert2; IUser user = null; try { user = mUL.locateUser(new Certificates(certChain)); } catch (Exception e) { CMS.debug("DoRevoke: Failed to map certificate '" + cert2.getSubjectDN().getName() + "' to user."); } if (mUG.isMemberOf(user, "Subsystem Group")) { skipNonceVerification = true; } } String nonceStr = req.getParameter("nonce"); if (nonceStr != null) { long nonce = Long.parseLong(nonceStr.trim()); X509Certificate cert1 = mNonces.getCertificate(nonce); if (cert1 == null) { CMS.debug("DoRevoke: Unknown nonce"); } else if (cert1 != null && cert2 != null && cert1.equals(cert2)) { nonceVerified = true; mNonces.removeNonce(nonce); } } else { CMS.debug("DoRevoke: Missing nonce"); } CMS.debug("DoRevoke: nonceVerified=" + nonceVerified); CMS.debug("DoRevoke: skipNonceVerification=" + skipNonceVerification); if ((!nonceVerified) && (!skipNonceVerification)) { cmsReq.setStatus(CMSRequest.UNAUTHORIZED); return; } } String comments = req.getParameter(IRequest.REQUESTOR_COMMENTS); String eeSubjectDN = null; String eeSerialNumber = null; //for audit log. String initiative = null; String authMgr = AuditFormat.NOAUTH; authToken = authenticate(req); AuthzToken authzToken = null; try { authzToken = authorize(mAclMethod, authToken, mAuthzResourceName, "revoke"); } catch (EAuthzAccessDenied e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("ADMIN_SRVLT_AUTH_FAILURE", e.toString())); } catch (Exception e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("ADMIN_SRVLT_AUTH_FAILURE", e.toString())); } if (authzToken == null) { cmsReq.setStatus(CMSRequest.UNAUTHORIZED); return; } if (mAuthMgr != null && mAuthMgr.equals(IAuthSubsystem.CERTUSERDB_AUTHMGR_ID)) { if (authToken != null) { String serialNumber = req.getParameter("serialNumber"); getSSLClientCertificate(req); // throw exception on error if (serialNumber != null) { eeSerialNumber = serialNumber; } authMgr = authToken.getInString(AuthToken.TOKEN_AUTHMGR_INST_NAME); String agentID = authToken.getInString("userid"); initiative = AuditFormat.FROMAGENT + " agentID: " + agentID + " authenticated by " + authMgr; } } else { // request is fromUser. initiative = AuditFormat.FROMUSER; String serialNumber = req.getParameter("serialNumber"); X509CertImpl sslCert = (X509CertImpl) getSSLClientCertificate(req); if (serialNumber == null || sslCert == null || !(serialNumber.equals(sslCert.getSerialNumber().toString(16)))) { authorized = false; } else { eeSubjectDN = sslCert.getSubjectDN().toString(); eeSerialNumber = sslCert.getSerialNumber().toString(); } } if (authorized) { process(argSet, header, reason, invalidityDate, initiative, req, resp, verifiedRecordCount, revokeAll, totalRecordCount, eeSerialNumber, eeSubjectDN, comments, locale[0]); } } catch (NumberFormatException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("BASE_INVALID_NUMBER_FORMAT")); error = new EBaseException(CMS.getLogMessage("BASE_INVALID_NUMBER_FORMAT")); } catch (EBaseException e) { error = e; } /* catch (Exception e) { noError = false; header.addStringValue(OUT_ERROR, MessageFormatter.getLocalizedString( errorlocale[0], BaseResources.class.getName(), BaseResources.INTERNAL_ERROR_1, e.toString())); } */ try { ServletOutputStream out = resp.getOutputStream(); if (error == null && authorized) { String xmlOutput = req.getParameter("xml"); if (xmlOutput != null && xmlOutput.equals("true")) { outputXML(resp, argSet); } else { resp.setContentType("text/html"); form.renderOutput(out, argSet); cmsReq.setStatus(CMSRequest.SUCCESS); } } else if (!authorized) { cmsReq.setStatus(CMSRequest.UNAUTHORIZED); } else { cmsReq.setStatus(CMSRequest.ERROR); cmsReq.setError(error); } } catch (IOException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_ERR_OUT_STREAM_TEMPLATE", e.toString())); throw new ECMSGWException(CMS.getLogMessage("CMSGW_ERROR_DISPLAY_TEMPLATE")); } } /** * Process cert status change request * <P> * * (Certificate Request - either an "agent" cert status change request, or an "EE" cert status change request) * <P> * * (Certificate Request Processed - either an "agent" cert status change request, or an "EE" cert status change * request) * <P> * * <ul> * <li>signed.audit LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST used when a cert status change request (e. g. - * "revocation") is made (before approval process) * <li>signed.audit LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED used when a certificate status is * changed (revoked, expired, on-hold, off-hold) * </ul> * * @param argSet CMS template parameters * @param header argument block * @param reason revocation reason (0 - Unspecified, 1 - Key compromised, * 2 - CA key compromised; should not be used, 3 - Affiliation changed, * 4 - Certificate superceded, 5 - Cessation of operation, or * 6 - Certificate is on hold) * @param invalidityDate certificate validity date * @param initiative string containing the audit format * @param req HTTP servlet request * @param resp HTTP servlet response * @param verifiedRecordCount number of verified records * @param revokeAll string containing information on all of the * certificates to be revoked * @param totalRecordCount total number of records (verified and unverified) * @param eeSerialNumber string containing the end-entity certificate * serial number * @param eeSubjectDN string containing the end-entity certificate subject * distinguished name (DN) * @param comments string containing certificate comments * @param locale the system locale * @exception EBaseException an error has occurred */ private void process(CMSTemplateParams argSet, IArgBlock header, int reason, Date invalidityDate, String initiative, HttpServletRequest req, HttpServletResponse resp, int verifiedRecordCount, String revokeAll, int totalRecordCount, String eeSerialNumber, String eeSubjectDN, String comments, Locale locale) throws EBaseException { boolean auditRequest = true; String auditMessage = null; String auditSubjectID = auditSubjectID(); String auditRequesterID = auditRequesterID(req); String auditSerialNumber = auditSerialNumber(eeSerialNumber); String auditRequestType = auditRequestType(reason); String auditApprovalStatus = ILogger.SIGNED_AUDIT_EMPTY_VALUE; String auditReasonNum = String.valueOf(reason); CMS.debug("DoRevoke: eeSerialNumber: " + eeSerialNumber + " auditSerialNumber: " + auditSerialNumber); long startTime = CMS.getCurrentDate().getTime(); try { int count = 0; Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); CRLReasonExtension crlReasonExtn = new CRLReasonExtension(revReason); // Construct a CRL invalidity date extension. InvalidityDateExtension invalidityDateExtn = null; if (invalidityDate != null) { invalidityDateExtn = new InvalidityDateExtension(invalidityDate); } // Construct a CRL extension for this request. CRLExtensions entryExtn = new CRLExtensions(); if (crlReasonExtn != null) { entryExtn.set(crlReasonExtn.getName(), crlReasonExtn); } if (invalidityDateExtn != null) { entryExtn.set(invalidityDateExtn.getName(), invalidityDateExtn); } if (mAuthority instanceof ICertificateAuthority) { Enumeration<ICertRecord> e = mCertDB.searchCertificates(revokeAll, totalRecordCount, mTimeLimits); while (e != null && e.hasMoreElements()) { ICertRecord rec = e.nextElement(); if (rec == null) continue; X509CertImpl xcert = rec.getCertificate(); IArgBlock rarg = CMS.createArgBlock(); // we do not want to revoke the CA certificate accidentially if (xcert != null && isSystemCertificate(xcert.getSerialNumber())) { CMS.debug("DoRevoke: skipped revocation request for system certificate " + xcert.getSerialNumber()); continue; } if (xcert != null) { rarg.addStringValue("serialNumber", xcert.getSerialNumber().toString(16)); if (eeSerialNumber != null && (eeSerialNumber.equals(xcert.getSerialNumber().toString())) && rec.getStatus().equals(ICertRecord.STATUS_REVOKED)) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CA_CERTIFICATE_ALREADY_REVOKED_1", xcert.getSerialNumber() .toString(16))); // store a message in the signed audit log file auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType); audit(auditMessage); throw new ECMSGWException(CMS.getLogMessage("CMSGW_UNAUTHORIZED")); } else if (rec.getStatus().equals(ICertRecord.STATUS_REVOKED)) { rarg.addStringValue("error", "Certificate 0x" + xcert.getSerialNumber().toString(16) + " is already revoked."); } else if (eeSubjectDN != null && (!eeSubjectDN.equals(xcert.getSubjectDN().toString()))) { rarg.addStringValue("error", "Certificate 0x" + xcert.getSerialNumber().toString(16) + " belongs to different subject."); } else { oldCertsV.addElement(xcert); RevokedCertImpl revCertImpl = new RevokedCertImpl(xcert.getSerialNumber(), CMS.getCurrentDate(), entryExtn); revCertImplsV.addElement(revCertImpl); count++; rarg.addStringValue("error", null); } argSet.addRepeatRecord(rarg); } } } else if (mAuthority instanceof IRegistrationAuthority) { String reqIdStr = req.getParameter("requestId"); Vector<String> serialNumbers = new Vector<String>(); if (revokeAll != null && revokeAll.length() > 0) { for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; i = revokeAll.indexOf('=', i)) { if (i > -1) { i++; while (i < revokeAll.length() && revokeAll.charAt(i) == ' ') { i++; } // xxxx decimal serial number? String legalDigits = "0123456789"; int j = i; while (j < revokeAll.length() && legalDigits.indexOf(revokeAll.charAt(j)) != -1) { j++; } if (j > i) { serialNumbers.addElement(revokeAll.substring(i, j)); } } } } if (reqIdStr != null && reqIdStr.length() > 0 && serialNumbers.size() > 0) { IRequest certReq = mRequestQueue.findRequest(new RequestId(reqIdStr)); X509CertImpl[] certs = certReq.getExtDataInCertArray(IRequest.OLD_CERTS); boolean authorized = false; for (int i = 0; i < certs.length; i++) { boolean addToList = false; for (int j = 0; j < serialNumbers.size(); j++) { //xxxxx serial number in decimal? if (certs[i].getSerialNumber().toString().equals(serialNumbers.elementAt(j)) && eeSubjectDN != null && eeSubjectDN.equals(certs[i].getSubjectDN().toString())) { addToList = true; break; } } if (eeSerialNumber != null && eeSerialNumber.equals(certs[i].getSerialNumber().toString())) { authorized = true; } if (addToList) { IArgBlock rarg = CMS.createArgBlock(); rarg.addStringValue("serialNumber", certs[i].getSerialNumber().toString(16)); oldCertsV.addElement(certs[i]); RevokedCertImpl revCertImpl = new RevokedCertImpl(certs[i].getSerialNumber(), CMS.getCurrentDate(), entryExtn); revCertImplsV.addElement(revCertImpl); count++; rarg.addStringValue("error", null); argSet.addRepeatRecord(rarg); } } if (!authorized) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_REQ_AUTH_REVOKED_CERT")); // store a message in the signed audit log file auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType); audit(auditMessage); throw new ECMSGWException(CMS.getLogMessage("CMSGW_UNAUTHORIZED")); } } else { String b64eCert = req.getParameter("b64eCertificate"); if (b64eCert != null) { // BASE64Decoder decoder = new BASE64Decoder(); // byte[] certBytes = decoder.decodeBuffer(b64eCert); byte[] certBytes = CMS.AtoB(b64eCert); X509CertImpl cert = new X509CertImpl(certBytes); IArgBlock rarg = CMS.createArgBlock(); rarg.addStringValue("serialNumber", cert.getSerialNumber().toString(16)); oldCertsV.addElement(cert); RevokedCertImpl revCertImpl = new RevokedCertImpl(cert.getSerialNumber(), CMS.getCurrentDate(), entryExtn); revCertImplsV.addElement(revCertImpl); count++; rarg.addStringValue("error", null); argSet.addRepeatRecord(rarg); } } } if (count == 0) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_REV_CERTS_ZERO")); // store a message in the signed audit log file auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType); audit(auditMessage); throw new ECMSGWException(CMS.getLogMessage("CMSGW_REVOCATION_ERROR_CERT_NOT_FOUND")); } header.addIntegerValue("totalRecordCount", count); X509CertImpl[] oldCerts = new X509CertImpl[count]; //Certificate[] oldCerts = new Certificate[count]; RevokedCertImpl[] revCertImpls = new RevokedCertImpl[count]; for (int i = 0; i < count; i++) { oldCerts[i] = oldCertsV.elementAt(i); revCertImpls[i] = revCertImplsV.elementAt(i); } IRequest revReq = mQueue.newRequest(IRequest.REVOCATION_REQUEST); // store a message in the signed audit log file auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST, auditSubjectID, ILogger.SUCCESS, auditRequesterID, auditSerialNumber, auditRequestType); audit(auditMessage); revReq.setExtData(IRequest.CERT_INFO, revCertImpls); revReq.setExtData(IRequest.REQ_TYPE, IRequest.REVOCATION_REQUEST); if (initiative.equals(AuditFormat.FROMUSER)) revReq.setExtData(IRequest.REQUESTOR_TYPE, IRequest.REQUESTOR_EE); else revReq.setExtData(IRequest.REQUESTOR_TYPE, IRequest.REQUESTOR_AGENT); revReq.setExtData(IRequest.OLD_CERTS, oldCerts); if (comments != null) { revReq.setExtData(IRequest.REQUESTOR_COMMENTS, comments); } revReq.setExtData(IRequest.REVOKED_REASON, Integer.valueOf(reason)); // change audit processing from "REQUEST" to "REQUEST_PROCESSED" // to distinguish which type of signed audit log message to save // as a failure outcome in case an exception occurs auditRequest = false; mQueue.processRequest(revReq); // retrieve the request status auditApprovalStatus = revReq.getRequestStatus().toString(); RequestStatus stat = revReq.getRequestStatus(); String type = revReq.getRequestType(); // The SVC_PENDING check has been added for the Cloned CA request // that is meant for the Master CA. From Clone's point of view // the request is complete if ((stat == RequestStatus.COMPLETE) || ((type.equals(IRequest.CLA_CERT4CRL_REQUEST)) && (stat == RequestStatus.SVC_PENDING))) { // audit log the error Integer result = revReq.getExtDataInInteger(IRequest.RESULT); if (result.equals(IRequest.RES_ERROR)) { String[] svcErrors = revReq.getExtDataInStringArray(IRequest.SVCERRORS); if (svcErrors != null && svcErrors.length > 0) { for (int i = 0; i < svcErrors.length; i++) { String err = svcErrors[i]; if (err != null) { //cmsReq.setErrorDescription(err); for (int j = 0; j < count; j++) { if (oldCerts[j] instanceof X509CertImpl) { X509CertImpl cert = oldCerts[j]; if (oldCerts[j] != null) { mLogger.log(ILogger.EV_AUDIT, ILogger.S_OTHER, AuditFormat.LEVEL, AuditFormat.DOREVOKEFORMAT, new Object[] { revReq.getRequestId(), initiative, "completed with error: " + err, cert.getSubjectDN(), cert.getSerialNumber().toString(16), RevocationReason.fromInt(reason).toString() } ); } } } } } } // store a message in the signed audit log file // if and only if "auditApprovalStatus" is // "complete", "revoked", or "canceled" if ((auditApprovalStatus.equals( RequestStatus.COMPLETE_STRING)) || (auditApprovalStatus.equals( RequestStatus.REJECTED_STRING)) || (auditApprovalStatus.equals( RequestStatus.CANCELED_STRING))) { auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType, auditReasonNum, auditApprovalStatus); audit(auditMessage); } return; } long endTime = CMS.getCurrentDate().getTime(); // audit log the success. for (int j = 0; j < count; j++) { if (oldCerts[j] != null) { if (oldCerts[j] instanceof X509CertImpl) { X509CertImpl cert = oldCerts[j]; mLogger.log(ILogger.EV_AUDIT, ILogger.S_OTHER, AuditFormat.LEVEL, AuditFormat.DOREVOKEFORMAT, new Object[] { revReq.getRequestId(), initiative, "completed", cert.getSubjectDN(), cert.getSerialNumber().toString(16), RevocationReason.fromInt(reason).toString() + " time: " + (endTime - startTime) } ); } } } header.addStringValue("revoked", "yes"); Integer updateCRLResult = revReq.getExtDataInInteger(IRequest.CRL_UPDATE_STATUS); if (updateCRLResult != null) { header.addStringValue("updateCRL", "yes"); if (updateCRLResult.equals(IRequest.RES_SUCCESS)) { header.addStringValue("updateCRLSuccess", "yes"); } else { header.addStringValue("updateCRLSuccess", "no"); String crlError = revReq.getExtDataInString(IRequest.CRL_UPDATE_ERROR); if (crlError != null) header.addStringValue("updateCRLError", crlError); } // let known crl publishing status too. Integer publishCRLResult = revReq.getExtDataInInteger(IRequest.CRL_PUBLISH_STATUS); if (publishCRLResult != null) { if (publishCRLResult.equals(IRequest.RES_SUCCESS)) { header.addStringValue("publishCRLSuccess", "yes"); } else { header.addStringValue("publishCRLSuccess", "no"); String publError = revReq.getExtDataInString(IRequest.CRL_PUBLISH_ERROR); if (publError != null) header.addStringValue("publishCRLError", publError); } } } if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { ICRLIssuingPoint crl = otherCRLs.nextElement(); String crlId = crl.getId(); if (crlId.equals(ICertificateAuthority.PROP_MASTER_CRL)) continue; String updateStatusStr = crl.getCrlUpdateStatusStr(); Integer updateResult = revReq.getExtDataInInteger(updateStatusStr); if (updateResult != null) { if (updateResult.equals(IRequest.RES_SUCCESS)) { CMS.debug("DoRevoke: " + CMS.getLogMessage("ADMIN_SRVLT_ADDING_HEADER", updateStatusStr)); header.addStringValue(updateStatusStr, "yes"); } else { String updateErrorStr = crl.getCrlUpdateErrorStr(); CMS.debug("DoRevoke: " + CMS.getLogMessage("ADMIN_SRVLT_ADDING_HEADER_NO", updateStatusStr)); header.addStringValue(updateStatusStr, "no"); String error = revReq.getExtDataInString(updateErrorStr); if (error != null) header.addStringValue(updateErrorStr, error); } String publishStatusStr = crl.getCrlPublishStatusStr(); Integer publishResult = revReq.getExtDataInInteger(publishStatusStr); if (publishResult == null) continue; if (publishResult.equals(IRequest.RES_SUCCESS)) { header.addStringValue(publishStatusStr, "yes"); } else { String publishErrorStr = crl.getCrlPublishErrorStr(); header.addStringValue(publishStatusStr, "no"); String error = revReq.getExtDataInString(publishErrorStr); if (error != null) header.addStringValue( publishErrorStr, error); } } } } if (mPublisherProcessor != null && mPublisherProcessor.ldapEnabled()) { header.addStringValue("dirEnabled", "yes"); Integer[] ldapPublishStatus = revReq.getExtDataInIntegerArray("ldapPublishStatus"); int certsToUpdate = 0; int certsUpdated = 0; if (ldapPublishStatus != null) { certsToUpdate = ldapPublishStatus.length; for (int i = 0; i < certsToUpdate; i++) { if (ldapPublishStatus[i] == IRequest.RES_SUCCESS) { certsUpdated++; } } } header.addIntegerValue("certsUpdated", certsUpdated); header.addIntegerValue("certsToUpdate", certsToUpdate); // add crl publishing status. String publError = revReq.getExtDataInString(IRequest.CRL_PUBLISH_ERROR); if (publError != null) { header.addStringValue("crlPublishError", publError); } } else { header.addStringValue("dirEnabled", "no"); } header.addStringValue("error", null); } else { if (stat == RequestStatus.PENDING || stat == RequestStatus.REJECTED) { header.addStringValue("revoked", stat.toString()); } else { header.addStringValue("revoked", "no"); } Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); if (errors != null) { StringBuffer errInfo = new StringBuffer(); for (int i = 0; i < errors.size(); i++) { errInfo.append(errors.elementAt(i)); errInfo.append("\n"); } header.addStringValue("error", errInfo.toString()); } else if (stat == RequestStatus.PENDING) { header.addStringValue("error", "Request Pending"); } else { header.addStringValue("error", null); } // audit log the pending, revoked and rest for (int j = 0; j < count; j++) { if (oldCerts[j] != null) { if (oldCerts[j] instanceof X509CertImpl) { X509CertImpl cert = oldCerts[j]; mLogger.log(ILogger.EV_AUDIT, ILogger.S_OTHER, AuditFormat.LEVEL, AuditFormat.DOREVOKEFORMAT, new Object[] { revReq.getRequestId(), initiative, stat.toString(), cert.getSubjectDN(), cert.getSerialNumber().toString(16), RevocationReason.fromInt(reason).toString() } ); } } } } // store a message in the signed audit log file // if and only if "auditApprovalStatus" is // "complete", "revoked", or "canceled" if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING)) || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING)) || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) { auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED, auditSubjectID, ILogger.SUCCESS, auditRequesterID, auditSerialNumber, auditRequestType, auditReasonNum, auditApprovalStatus); audit(auditMessage); } } catch (CertificateException e) { if (auditRequest) { // store a "CERT_STATUS_CHANGE_REQUEST" failure // message in the signed audit log file auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType); audit(auditMessage); } else { // store a "CERT_STATUS_CHANGE_REQUEST_PROCESSED" failure // message in the signed audit log file // if and only if "auditApprovalStatus" is // "complete", "revoked", or "canceled" if ((auditApprovalStatus.equals( RequestStatus.COMPLETE_STRING)) || (auditApprovalStatus.equals( RequestStatus.REJECTED_STRING)) || (auditApprovalStatus.equals( RequestStatus.CANCELED_STRING))) { auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType, auditReasonNum, auditApprovalStatus); audit(auditMessage); } } log(ILogger.LL_FAILURE, "error " + e); } catch (EBaseException e) { log(ILogger.LL_FAILURE, "error " + e); if (auditRequest) { // store a "CERT_STATUS_CHANGE_REQUEST" failure // message in the signed audit log file auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType); audit(auditMessage); } else { // store a "CERT_STATUS_CHANGE_REQUEST_PROCESSED" failure // message in the signed audit log file // if and only if "auditApprovalStatus" is // "complete", "revoked", or "canceled" if ((auditApprovalStatus.equals( RequestStatus.COMPLETE_STRING)) || (auditApprovalStatus.equals( RequestStatus.REJECTED_STRING)) || (auditApprovalStatus.equals( RequestStatus.CANCELED_STRING))) { auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType, auditReasonNum, auditApprovalStatus); audit(auditMessage); } } throw e; } catch (IOException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_ERROR_MARKING_CERT_REVOKED_1", e.toString())); if (auditRequest) { // store a "CERT_STATUS_CHANGE_REQUEST" failure // message in the signed audit log file auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType); audit(auditMessage); } else { // store a "CERT_STATUS_CHANGE_REQUEST_PROCESSED" failure // message in the signed audit log file // if and only if "auditApprovalStatus" is // "complete", "revoked", or "canceled" if ((auditApprovalStatus.equals( RequestStatus.COMPLETE_STRING)) || (auditApprovalStatus.equals( RequestStatus.REJECTED_STRING)) || (auditApprovalStatus.equals( RequestStatus.CANCELED_STRING))) { auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED, auditSubjectID, ILogger.FAILURE, auditRequesterID, auditSerialNumber, auditRequestType, auditReasonNum, auditApprovalStatus); audit(auditMessage); } } throw new ECMSGWException(CMS.getLogMessage("CMSGW_ERROR_MARKING_CERT_REVOKED")); } return; } /** * Signed Audit Log Requester ID * * This method is called to obtain the "RequesterID" for * a signed audit log message. * <P> * * @param req HTTP request * @return id string containing the signed audit log message RequesterID */ private String auditRequesterID(HttpServletRequest req) { // if no signed audit object exists, bail if (mSignedAuditLogger == null) { return null; } String requesterID = null; // Obtain the requesterID requesterID = req.getParameter("requestId"); if (requesterID != null) { requesterID = requesterID.trim(); } else { requesterID = ILogger.UNIDENTIFIED; } return requesterID; } /** * Signed Audit Log Serial Number * * This method is called to obtain the serial number of the certificate * whose status is to be changed for a signed audit log message. * <P> * * @param eeSerialNumber a string containing the un-normalized serialNumber * @return id string containing the signed audit log message RequesterID */ private String auditSerialNumber(String eeSerialNumber) { // if no signed audit object exists, bail if (mSignedAuditLogger == null) { return null; } String serialNumber = null; // Normalize the serialNumber if (eeSerialNumber != null) { serialNumber = eeSerialNumber.trim(); // find out if the value is hex or decimal BigInteger value = BigInteger.ONE.negate(); //try int try { value = new BigInteger(serialNumber, 10); } catch (NumberFormatException e) { } //try hex if (value.compareTo(BigInteger.ONE.negate()) == 0) { try { value = new BigInteger(serialNumber, 16); } catch (NumberFormatException e) { } } // give up if it isn't hex or dec if (value.compareTo(BigInteger.ONE.negate()) == 0) { throw new NumberFormatException(); } // convert it to hexadecimal serialNumber = "0x" + value.toString(16); } else { serialNumber = ILogger.SIGNED_AUDIT_EMPTY_VALUE; } return serialNumber; } /** * Signed Audit Log Request Type * * This method is called to obtain the "Request Type" for * a signed audit log message. * <P> * * @param reason an integer denoting the revocation reason * @return string containing REVOKE or ON_HOLD */ private String auditRequestType(int reason) { // if no signed audit object exists, bail if (mSignedAuditLogger == null) { return null; } String requestType = null; // Determine the revocation type based upon the revocation reason if (reason == ON_HOLD_REASON) { requestType = ON_HOLD; } else { requestType = REVOKE; } return requestType; } }