summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2013-02-07 15:59:18 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2013-02-12 19:00:07 -0500
commit12bd85dc50052107e5dccff56f4110b133aafdc1 (patch)
tree3e20240bdea5b008580585aef31d62472f4eff9d
parent8acab668775a85931c33e68eb79b2cf822b7c631 (diff)
downloadpki-12bd85dc50052107e5dccff56f4110b133aafdc1.zip
pki-12bd85dc50052107e5dccff56f4110b133aafdc1.tar.gz
pki-12bd85dc50052107e5dccff56f4110b133aafdc1.tar.xz
Added certificate status option for cert-find.
The cert-find command has been modified to provide an option to search by certificate status. Ticket #501
-rw-r--r--base/common/src/com/netscape/certsrv/cert/CertSearchRequest.java14
-rw-r--r--base/common/src/com/netscape/cms/servlet/cert/FilterBuilder.java11
-rw-r--r--base/java-tools/src/com/netscape/cmstools/cert/CertFindCLI.java8
3 files changed, 33 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/cert/CertSearchRequest.java b/base/common/src/com/netscape/certsrv/cert/CertSearchRequest.java
index 7939a02..33ff3fc 100644
--- a/base/common/src/com/netscape/certsrv/cert/CertSearchRequest.java
+++ b/base/common/src/com/netscape/certsrv/cert/CertSearchRequest.java
@@ -81,6 +81,10 @@ public class CertSearchRequest {
@XmlElement
protected boolean matchExactly;
+ //Status
+ @XmlElement
+ protected String status;
+
//Revoked By
@XmlElement
@@ -366,6 +370,16 @@ public class CertSearchRequest {
this.matchExactly = matchExactly;
}
+ //Status
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
//Revoked On
public String getRevokedOnTo() {
diff --git a/base/common/src/com/netscape/cms/servlet/cert/FilterBuilder.java b/base/common/src/com/netscape/cms/servlet/cert/FilterBuilder.java
index b8e3229..46c597b 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/FilterBuilder.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/FilterBuilder.java
@@ -42,6 +42,7 @@ public class FilterBuilder {
StringBuffer filter = new StringBuffer();
buildSerialNumberRangeFilter(filter);
buildSubjectFilter(filter);
+ buildStatusFilter(filter);
buildRevokedByFilter(filter);
buildRevokedOnFilter(filter);
buildRevocationReasonFilter(filter);
@@ -120,6 +121,16 @@ public class FilterBuilder {
}
}
+ private void buildStatusFilter(StringBuffer filter) {
+ String status = request.getStatus();
+ if (status == null || status.equals("")) {
+ return;
+ }
+ filter.append("(certStatus=");
+ filter.append(LDAPUtil.escapeFilter(status));
+ filter.append(")");
+ }
+
private void buildRevokedByFilter(StringBuffer filter) {
if (!request.getRevokedByInUse()) {
return;
diff --git a/base/java-tools/src/com/netscape/cmstools/cert/CertFindCLI.java b/base/java-tools/src/com/netscape/cmstools/cert/CertFindCLI.java
index e4f741b..5415da5 100644
--- a/base/java-tools/src/com/netscape/cmstools/cert/CertFindCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cert/CertFindCLI.java
@@ -195,6 +195,11 @@ public class CertFindCLI extends CLI {
options.addOption(option);
options.addOption(null, "matchExactly", false, "Match exactly with the details provided");
+ //status
+ option = new Option(null, "status", true, "Certificate status: VALID, INVALID, REVOKED, EXPIRED, REVOKED_EXPIRED");
+ option.setArgName("status");
+ options.addOption(option);
+
//revokedByInUse
option = new Option(null, "revokedBy", true, "Certificate revoked by");
option.setArgName("user id");
@@ -339,6 +344,9 @@ public class CertFindCLI extends CLI {
if (cmd.hasOption("matchExactly")) {
csd.setMatchExactly(true);
}
+ if (cmd.hasOption("status")) {
+ csd.setStatus(cmd.getOptionValue("status"));
+ }
if (cmd.hasOption("revokedBy")) {
csd.setRevokedByInUse(true);
csd.setRevokedBy(cmd.getOptionValue("revokedBy"));