Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ISSUE:#1714 Restrict special chars from comp names

configgen will indicate and error when encountering
special characters in component names.

configmgr will pop-up an error when users attempt
to enter special characters for component names

Signed-off-by: Gleb Aronsky <gleb.aronsky@lexisnexis.com>
  • Loading branch information...
commit 1d10af4c6a3c6e7e417e8204908bd33f94b6792a 1 parent 5ebf7cb
@garonsky garonsky authored
View
14 esp/services/WsDeploy/WsDeployService.cpp
@@ -892,6 +892,13 @@ bool CWsDeployFileInfo::navMenuEvent(IEspContext &context,
return true;
}//onNavMenuEvent
+bool CWsDeployFileInfo::isAlphaNumeric(const char *pstr) const
+{
+ RegExpr expr("[A-Za-z0-9-_]+");
+
+ return (expr.find(pstr) && expr.findlen(0) == strlen(pstr));
+}
+
bool CWsDeployFileInfo::saveSetting(IEspContext &context, IEspSaveSettingRequest &req, IEspSaveSettingResponse &resp)
{
synchronized block(m_mutex);
@@ -1242,8 +1249,15 @@ bool CWsDeployFileInfo::saveSetting(IEspContext &context, IEspSaveSettingRequest
//perform checks
if (!strcmp(pszAttrName, "name"))
+ {
ensureUniqueName(pEnvRoot, pComp, pszNewValue);
+ if (isAlphaNumeric(pszNewValue) == false)
+ {
+ throw MakeStringException(-1, "Invalid Character in name '%s'.", pszNewValue);
+ }
+ }
+
//Store prev settings for use further down for esp service bindings
const char* sPrevDefaultPort = NULL;
const char* sPrevPort = NULL;
View
1  esp/services/WsDeploy/WsDeployService.hpp
@@ -259,6 +259,7 @@ class CWsDeployFileInfo : public CInterface, implements IInterface
virtual bool navMenuEvent(IEspContext &context, IEspNavMenuEventRequest &req,
IEspNavMenuEventResponse &resp);
virtual bool displaySettings(IEspContext &context, IEspDisplaySettingsRequest &req, IEspDisplaySettingsResponse &resp);
+ virtual bool isAlphaNumeric(const char *pstr) const;
virtual bool saveSetting(IEspContext &context, IEspSaveSettingRequest &req, IEspSaveSettingResponse &resp);
virtual bool getBuildSetInfo(IEspContext &context, IEspGetBuildSetInfoRequest &req, IEspGetBuildSetInfoResponse &resp);
virtual bool getDeployableComps(IEspContext &context, IEspGetDeployableCompsRequest &req, IEspGetDeployableCompsResponse &resp);
View
7 initfiles/componentfiles/configxml/validateAll.xsl
@@ -29,6 +29,7 @@ xmlns:seisint="http://seisint.com" exclude-result-prefixes="seisint">
<xsl:apply-templates select="Hardware/Computer"/>
<xsl:apply-templates select="Software/ThorCluster"/>
<xsl:apply-templates select="Software/Topology"/>
+ <xsl:apply-templates select="Software"/>
</xsl:template>
<xsl:template match="Environment/Software/*">
@@ -41,6 +42,12 @@ xmlns:seisint="http://seisint.com" exclude-result-prefixes="seisint">
</xsl:call-template>
</xsl:if>
</xsl:for-each>
+ <xsl:variable select="@name" name="elem1"/>
+ <xsl:if test="(translate($elem1,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_',''))" >
+ <xsl:call-template name="validationMessage">
+ <xsl:with-param name="msg" select=" concat('Invalid character[@name=' ,$elem1, ']') "/>
+ </xsl:call-template>
+ </xsl:if>
</xsl:template>
<xsl:template match="Computer">
Please sign in to comment.
Something went wrong with that request. Please try again.