[Pki-devel] [Patch] Option to include nextUpdate as an offset to thisUpdate

Andrew Wnuk awnuk at redhat.com
Fri Mar 22 00:24:33 UTC 2013


This patch provides an option to generate CRLs with nextUpdate 
calculated as sum of thisUpdate and an offset.

Bug: 919556.
-------------- next part --------------
Index: pki/dogtag/console-ui/CMSAdminRS.properties
===================================================================
--- pki/dogtag/console-ui/CMSAdminRS.properties	(revision 2533)
+++ pki/dogtag/console-ui/CMSAdminRS.properties	(working copy)
@@ -598,6 +598,7 @@
 CRLSETTING_LABEL_NEXTTIME_LABEL=Extend next update time in full CRLs
 CRLSETTING_LABEL_MINUTES_LABEL=minutes
 CRLSETTING_LABEL_GRACEPERIOD_LABEL=Next update grace period
+CRLSETTING_LABEL_NEXTASTHISEXTENSION_LABEL=Next update as this update extension
 CRLSETTING_DIALOG_UPDATES_TITLE=Error
 CRLSETTING_DIALOG_UPDATES_MESSAGE=You are required to select at least one form of CRL updates.
 CRLSETTING_DIALOG_BLANKSCHEMA_TITLE=Error
@@ -618,6 +619,10 @@
 CRLSETTING_DIALOG_BLANKGRACE_MESSAGE=Grace period must be specified!
 CRLSETTING_DIALOG_GRACENUMBER_TITLE=Number Format Error
 CRLSETTING_DIALOG_GRACENUMBER_MESSAGE=Grace period must be a positive integer!
+CRLSETTING_DIALOG_BLANKNEXTASTHISEXTENSION_TITLE=Error
+CRLSETTING_DIALOG_BLANKNEXTASTHISEXTENSION_MESSAGE=Grace period must be specified!
+CRLSETTING_DIALOG_NEXTASTHISEXTENSIONNUMBER_TITLE=Number Format Error
+CRLSETTING_DIALOG_NEXTASTHISEXTENSIONNUMBER_MESSAGE=This update extension must be a positive integer!
 CRLCACHE_TITLE=Cache
 CRLCACHE_BORDER_CACHE_LABEL=CRL Cache
 CRLCACHE_LABEL_CACHE_LABEL=Enable CRL cache:
Index: pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
===================================================================
--- pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java	(revision 2533)
+++ pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java	(working copy)
@@ -204,6 +204,11 @@
     private long mNextUpdateGracePeriod; 
 
     /**
+     * next update as this update extension
+     */
+    private long mNextAsThisUpdateExtension; 
+
+    /**
      * Boolean flag controlling whether CRLv2 extensions are to be 
      * used in CRL.
      */
@@ -663,6 +668,9 @@
         // get next update grace period 
         mNextUpdateGracePeriod = MINUTE * config.getInteger(Constants.PR_GRACE_PERIOD, 0);
 
+        // get next update as this update extension 
+        mNextAsThisUpdateExtension = MINUTE * config.getInteger(Constants.PR_NEXT_AS_THIS_EXTENSION, 0);
+
         // Get V2 or V1 CRL 
         mAllowExtensions = config.getBoolean(Constants.PR_EXTENSIONS, false);
 
@@ -1005,6 +1013,16 @@
                     }
                 }
 
+                if (name.equals(Constants.PR_NEXT_AS_THIS_EXTENSION)) {
+                    try {
+                        if (value != null && value.length() > 0) {
+                            mNextAsThisUpdateExtension = MINUTE * Long.parseLong(value.trim());
+                        }
+                    } catch (NumberFormatException e) {
+                        noRestart = false;
+                    }
+                }
+
                 // -- CRL Cache --
                 if (name.equals(Constants.PR_ENABLE_CACHE)) {
                     if (value.equals(Constants.FALSE) && mEnableCRLCache) {
@@ -2330,6 +2348,15 @@
         mLastUpdate = thisUpdate;
         // mNextUpdate = nextUpdate;
         mNextDeltaUpdate = (nextDeltaUpdate != null)? new Date(nextDeltaUpdate.getTime()): null;
+        if (mNextAsThisUpdateExtension > 0) {
+            Date nextUpdateAsThisUpdateExtension = new Date(thisUpdate.getTime()+mNextAsThisUpdateExtension);
+            if (nextUpdate != null && nextUpdate.before(nextUpdateAsThisUpdateExtension)) {
+                nextUpdate = nextUpdateAsThisUpdateExtension;
+            }
+            if (nextDeltaUpdate != null && nextDeltaUpdate.before(nextUpdateAsThisUpdateExtension)) {
+                nextDeltaUpdate = nextUpdateAsThisUpdateExtension;
+            }
+        }
         if (nextUpdate != null) {
             nextUpdate.setTime((nextUpdate.getTime())+mNextUpdateGracePeriod);
         }
Index: pki/base/common/src/com/netscape/certsrv/common/Constants.java
===================================================================
--- pki/base/common/src/com/netscape/certsrv/common/Constants.java	(revision 2533)
+++ pki/base/common/src/com/netscape/certsrv/common/Constants.java	(working copy)
@@ -214,6 +214,7 @@
     public final static String PR_ENABLE_FREQ = "enableUpdateInterval";
     public final static String PR_UPDATE_FREQ = "autoUpdateInterval";
     public final static String PR_GRACE_PERIOD = "nextUpdateGracePeriod";
+    public final static String PR_NEXT_AS_THIS_EXTENSION = "nextAsThisUpdateExtension";
     public final static String PR_ENABLE_CACHE = "enableCRLCache";
     public final static String PR_CACHE_FREQ = "cacheUpdateInterval";
     public final static String PR_CACHE_RECOVERY = "enableCacheRecovery";
Index: pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java
===================================================================
--- pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java	(revision 2533)
+++ pki/base/console/src/com/netscape/admin/certsrv/config/CMSCRLSettingPanel.java	(working copy)
@@ -59,6 +59,9 @@
     private JLabel mGracePeriodLabel;
     private JTextField mGracePeriod;
     private JLabel mGracePeriodMinLabel;
+    private JLabel mNextAsThisUpdateExtensionLabel;
+    private JTextField mNextAsThisUpdateExtension;
+    private JLabel mNextAsThisUpdateExtensionMinLabel;
 
     private Color mActiveColor;
     private AdminConnection _admin;
@@ -279,7 +282,32 @@
         gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
         freqPanel.add(mGracePeriodMinLabel, gbc);
 
+        // next update as this update extension
+        CMSAdminUtil.resetGBC(gbc);
+        mNextAsThisUpdateExtensionLabel = makeJLabel("NEXTASTHISEXTENSION");
+        gbc.anchor = gbc.WEST;
+        gbc.fill = gbc.NONE;
+        gbc.gridx = 0;
+        // gbc.gridx = 2;
+        gbc.weightx = 0.0;
+        gbc.gridwidth = 1;
+        gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+        freqPanel.add(mNextAsThisUpdateExtensionLabel, gbc);
 
+        mNextAsThisUpdateExtension = makeJTextField(5);
+        gbc.anchor = gbc.WEST;
+        gbc.gridx++;
+        gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,0);
+        freqPanel.add(mNextAsThisUpdateExtension, gbc);
+
+        mNextAsThisUpdateExtensionMinLabel = makeJLabel("MINUTES");
+        gbc.anchor = gbc.WEST;
+        gbc.gridx++;
+        gbc.weightx = 1.0;
+        gbc.gridwidth = gbc.REMAINDER;
+        gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0,COMPONENT_SPACE);
+        freqPanel.add(mNextAsThisUpdateExtensionMinLabel, gbc);
+
         refresh();
     }
 
@@ -295,6 +323,7 @@
         nvps.add(Constants.PR_ENABLE_FREQ, "");
         nvps.add(Constants.PR_UPDATE_FREQ, "");
         nvps.add(Constants.PR_GRACE_PERIOD, "");
+        nvps.add(Constants.PR_NEXT_AS_THIS_EXTENSION, "");
 
         try {
             NameValuePairs val = null;
@@ -342,6 +371,8 @@
                 mFrequency.setText(value);
             } else if (name.equals(Constants.PR_GRACE_PERIOD)) {
                 mGracePeriod.setText(value);
+            } else if (name.equals(Constants.PR_NEXT_AS_THIS_EXTENSION)) {
+                mNextAsThisUpdateExtension.setText(value);
             }
         }
     }
@@ -530,6 +561,21 @@
                 showMessageDialog("GRACENUMBER");
                 return false;
             }
+
+            if (mNextAsThisUpdateExtension.getText().trim().equals("")) {
+                showMessageDialog("BLANKNEXTASTHISEXTENSION");
+                return false;
+            }
+            try {
+                int nextAsThisUpdateExtension = Integer.parseInt(mNextAsThisUpdateExtension.getText().trim());
+                if (nextAsThisUpdateExtension < 0) {
+                    showMessageDialog("NEXTASTHISEXTENSIONNUMBER");
+                    return false;
+                }
+            } catch (NumberFormatException e) {
+                showMessageDialog("NEXTASTHISEXTENSIONNUMBER");
+                return false;
+            }
         }
 
         NameValuePairs nvps = new NameValuePairs();
@@ -571,6 +617,7 @@
 
         nvps.add(Constants.PR_GRACE_PERIOD, mGracePeriod.getText().trim());
 
+        nvps.add(Constants.PR_NEXT_AS_THIS_EXTENSION, mNextAsThisUpdateExtension.getText().trim());
 
         _model.progressStart();
 
@@ -617,6 +664,11 @@
                 CMSAdminUtil.repaintComp(mGracePeriodLabel);
                 mGracePeriodMinLabel.setEnabled(true);
                 CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+                CMSAdminUtil.enableJTextField(mNextAsThisUpdateExtension, true, mActiveColor);
+                mNextAsThisUpdateExtensionLabel.setEnabled(true);
+                CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionLabel);
+                mNextAsThisUpdateExtensionMinLabel.setEnabled(true);
+                CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionMinLabel);
             } else {
                 CMSAdminUtil.enableJTextField(mDailyAt, false, getBackground());
                 if (!mEnableFreq.isSelected()) {
@@ -625,6 +677,11 @@
                     CMSAdminUtil.repaintComp(mGracePeriodLabel);
                     mGracePeriodMinLabel.setEnabled(false);
                     CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+                    CMSAdminUtil.enableJTextField(mNextAsThisUpdateExtension, false, getBackground());
+                    mNextAsThisUpdateExtensionLabel.setEnabled(false);
+                    CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionLabel);
+                    mNextAsThisUpdateExtensionMinLabel.setEnabled(false);
+                    CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionMinLabel);
                 }
             }
         }
@@ -638,6 +695,11 @@
                 CMSAdminUtil.repaintComp(mGracePeriodLabel);
                 mGracePeriodMinLabel.setEnabled(true);
                 CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+                CMSAdminUtil.enableJTextField(mNextAsThisUpdateExtension, true, mActiveColor);
+                mNextAsThisUpdateExtensionLabel.setEnabled(true);
+                CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionLabel);
+                mNextAsThisUpdateExtensionMinLabel.setEnabled(true);
+                CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionMinLabel);
             } else {
                 CMSAdminUtil.enableJTextField(mFrequency, false, getBackground());
                 mMinLabel.setEnabled(false);
@@ -648,6 +710,11 @@
                     CMSAdminUtil.repaintComp(mGracePeriodLabel);
                     mGracePeriodMinLabel.setEnabled(false);
                     CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+                    CMSAdminUtil.enableJTextField(mNextAsThisUpdateExtension, false, getBackground());
+                    mNextAsThisUpdateExtensionLabel.setEnabled(false);
+                    CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionLabel);
+                    mNextAsThisUpdateExtensionMinLabel.setEnabled(false);
+                    CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionMinLabel);
                 }
             }
         }
@@ -696,6 +763,11 @@
         CMSAdminUtil.repaintComp(mGracePeriodLabel);
         mGracePeriodMinLabel.setEnabled(enable3);
         CMSAdminUtil.repaintComp(mGracePeriodMinLabel);
+        CMSAdminUtil.enableJTextField(mNextAsThisUpdateExtension, enable3, color3);
+        mNextAsThisUpdateExtensionLabel.setEnabled(enable3);
+        CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionLabel);
+        mNextAsThisUpdateExtensionMinLabel.setEnabled(enable3);
+        CMSAdminUtil.repaintComp(mNextAsThisUpdateExtensionMinLabel);
     }
 }
 
Index: pki/base/console/src/com/netscape/certsrv/common/Constants.java
===================================================================
--- pki/base/console/src/com/netscape/certsrv/common/Constants.java	(revision 2533)
+++ pki/base/console/src/com/netscape/certsrv/common/Constants.java	(working copy)
@@ -216,6 +216,7 @@
     public final static String PR_ENABLE_FREQ = "enableUpdateInterval";
     public final static String PR_UPDATE_FREQ = "autoUpdateInterval";
     public final static String PR_GRACE_PERIOD = "nextUpdateGracePeriod";
+    public final static String PR_NEXT_AS_THIS_EXTENSION = "nextAsThisUpdateExtension";
     public final static String PR_ENABLE_CACHE = "enableCRLCache";
     public final static String PR_CACHE_FREQ = "cacheUpdateInterval";
     public final static String PR_CACHE_RECOVERY = "enableCacheRecovery";
Index: pki/redhat/console-ui/CMSAdminRS.properties
===================================================================
--- pki/redhat/console-ui/CMSAdminRS.properties	(revision 16063)
+++ pki/redhat/console-ui/CMSAdminRS.properties	(working copy)
@@ -607,6 +607,7 @@
 CRLSETTING_LABEL_NEXTTIME_LABEL=Extend next update time in full CRLs
 CRLSETTING_LABEL_MINUTES_LABEL=minutes
 CRLSETTING_LABEL_GRACEPERIOD_LABEL=Next update grace period
+CRLSETTING_LABEL_NEXTASTHISEXTENSION_LABEL=Next update as this update extension
 CRLSETTING_DIALOG_UPDATES_TITLE=Error
 CRLSETTING_DIALOG_UPDATES_MESSAGE=You are required to select at least one form of CRL updates.
 CRLSETTING_DIALOG_BLANKSCHEMA_TITLE=Error
@@ -627,6 +628,10 @@
 CRLSETTING_DIALOG_BLANKGRACE_MESSAGE=Grace period must be specified!
 CRLSETTING_DIALOG_GRACENUMBER_TITLE=Number Format Error
 CRLSETTING_DIALOG_GRACENUMBER_MESSAGE=Grace period must be a positive integer!
+CRLSETTING_DIALOG_BLANKNEXTASTHISEXTENSION_TITLE=Error
+CRLSETTING_DIALOG_BLANKNEXTASTHISEXTENSION_MESSAGE=Grace period must be specified!
+CRLSETTING_DIALOG_NEXTASTHISEXTENSIONNUMBER_TITLE=Number Format Error
+CRLSETTING_DIALOG_NEXTASTHISEXTENSIONNUMBER_MESSAGE=This update extension must be a positive integer!
 CRLCACHE_TITLE=Cache
 CRLCACHE_BORDER_CACHE_LABEL=CRL Cache
 CRLCACHE_LABEL_CACHE_LABEL=Enable CRL cache:


More information about the Pki-devel mailing list