Index: common/src/com/netscape/cms/profile/constraint/SubjectNameConstraint.java
===================================================================
--- common/src/com/netscape/cms/profile/constraint/SubjectNameConstraint.java	(revision 2600)
+++ common/src/com/netscape/cms/profile/constraint/SubjectNameConstraint.java	(working copy)
@@ -42,6 +42,16 @@
 
     public static final String CONFIG_PATTERN = "pattern";
 
+
+    private static final int COMMON_NAME_MAX = 64;
+    private static final int LOCALITY_NAME_MAX = 128;
+    private static final int STATE_NAME_MAX = 128;
+    private static final int ORG_NAME_MAX = 64;
+    private static final int ORG_UNIT_NAME_MAX = 64;
+    private static final int EMAIL_NAME_MAX = 255;
+    private static final int COUNTRY_NAME_MAX = 2;
+    private static final int UID_NAME_MAX = 64;
+
     public SubjectNameConstraint() {
         // configuration names
         addConfigName(CONFIG_PATTERN);
@@ -110,6 +120,103 @@
                         "CMS_PROFILE_SUBJECT_NAME_NOT_MATCHED", 
                         sn500.toString()));
         }
+
+        String commonName = null;
+        try {
+            commonName = sn500.getCommonName();
+        } catch (Exception e) {
+        }
+        if ( commonName != null && commonName.length() > COMMON_NAME_MAX ) {
+            throw new ERejectException(
+                    CMS.getUserMessage(getLocale(request),
+                        "CMS_PROFILE_INVALID_SUBJECT_NAME",sn500.toString()));
+
+        }
+
+        String country = null;
+        try { 
+             country =  sn500.getCountry();
+        } catch (Exception e) {
+        }
+
+        if ( country != null && country.length() > COUNTRY_NAME_MAX ) {
+            throw new ERejectException(
+                    CMS.getUserMessage(getLocale(request),
+                        "CMS_PROFILE_INVALID_SUBJECT_NAME",sn500.toString()));
+        }
+
+        String ou = null ;
+        try {
+            ou = sn500.getOrganizationalUnit();
+        } catch (Exception e) {
+        }
+
+        if ( ou != null && ou.length() > ORG_UNIT_NAME_MAX) {
+            throw new ERejectException(
+                    CMS.getUserMessage(getLocale(request),
+                        "CMS_PROFILE_INVALID_SUBJECT_NAME",sn500.toString()));
+        }
+
+        String o = null; 
+        try {
+            o = sn500.getOrganization();
+        } catch (Exception e) {
+        }
+
+        if ( o != null && o.length() > ORG_NAME_MAX) {
+            throw new ERejectException(
+                    CMS.getUserMessage(getLocale(request),
+                        "CMS_PROFILE_INVALID_SUBJECT_NAME",sn500.toString()));
+        }
+
+        String locality = null;
+        try {
+            locality =  sn500.getLocality();
+        } catch (Exception e) {
+        }
+
+        if ( locality != null && locality.length() > LOCALITY_NAME_MAX ) {
+            throw new ERejectException(
+                    CMS.getUserMessage(getLocale(request),
+                        "CMS_PROFILE_INVALID_SUBJECT_NAME",sn500.toString()));
+        }
+
+        String state =  null; 
+        try {
+            state = sn500.getState();
+        } catch (Exception e) {
+        }
+
+        if ( state != null && state.length() > STATE_NAME_MAX ) {
+            throw new ERejectException(
+                    CMS.getUserMessage(getLocale(request),
+                        "CMS_PROFILE_INVALID_SUBJECT_NAME",sn500.toString()));
+        }
+
+        String email =  null; 
+        try {
+            email = sn500.getEmail();
+        } catch (Exception e) {
+        }
+
+        if ( email != null && email.length() > EMAIL_NAME_MAX ) {
+            throw new ERejectException(
+                    CMS.getUserMessage(getLocale(request),
+                        "CMS_PROFILE_INVALID_SUBJECT_NAME",sn500.toString()));
+        }
+
+        String UID =  null;
+        try {
+            UID = sn500.getUserID();
+        } catch (Exception e) {
+        }
+        
+        if ( UID != null && UID.length() > UID_NAME_MAX) {
+             throw new ERejectException(
+                    CMS.getUserMessage(getLocale(request),
+                        "CMS_PROFILE_INVALID_SUBJECT_NAME",sn500.toString()));
+        }   
+
     }
 
     public String getText(Locale locale) {
