Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-3.8.x'
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chapman <[email protected]>
  • Loading branch information
richardkchapman committed Jul 13, 2012
2 parents f830c9b + a1c0117 commit 1fe3026
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 52 deletions.
6 changes: 5 additions & 1 deletion esp/eclwatch/ws_XSLT/clusterprocesses.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

<xsl:variable name="autoRefresh" select="$reqInfo/AutoRefresh"/>
<xsl:variable name="numColumns" select="count(/GetTargetClusterInfoResponse/Columns/Item)"/>
<xsl:variable name="countTargetClusters" select="count(/GetTargetClusterInfoResponse/TargetClusterInfoList/TargetClusterInfo)"/>

<xsl:template match="/GetTargetClusterInfoResponse">
<html>
Expand All @@ -89,6 +90,7 @@
</script>

<script language="JavaScript1.2">
var countTCs=<xsl:value-of select="$countTargetClusters"/>;
<xsl:text disable-output-escaping="yes"><![CDATA[
var allowReloadPage = true;
var sortableTable = null;
Expand All @@ -97,6 +99,7 @@
function onLoad()
{
document.getElementsByName('TargetClusters.itemcount')[0].value = countTCs;
initSelection('resultsTable');
initPreflightControls();
Expand Down Expand Up @@ -254,6 +257,7 @@
<form id="listitems" action="/ws_machine/GetTargetClusterInfo" method="post">
<input type="hidden" name="Path" value="{$reqInfo/Path}"/>
<input type="hidden" name="Cluster" value="{$clusterName}"/>
<input type="hidden" name="TargetClusters.itemcount" value=""/>
<xsl:choose>
<xsl:when test="Exceptions">
<h1><xsl:value-of select="Exceptions"/></h1>
Expand Down Expand Up @@ -328,7 +332,7 @@
<table id="resultsTable" class="sort-table" width="100%">
<tr class="grey">
<td valign="top" width="20">
<input type="checkbox" name="TargetClusters_i{count(preceding::TargetClusterInfo)}" checked="1"
<input type="checkbox" name="TargetClusters.{count(preceding::TargetClusterInfo)}" checked="1"
value="{$type}:{$name}" title="Select this target cluster" onclick="return clickTCCheckbox('{$type}', '{$name}', this);"></input>
</td>
<td align="left" width="20">
Expand Down
7 changes: 5 additions & 2 deletions esp/eclwatch/ws_XSLT/machines.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
function onLoad()
{
initSelection('resultsTable');
document.getElementsByName('Addresses.itemcount')[0].value = totalItems;

<xsl:if test="$ShowPreflightInfo and not($SwapNode)">initPreflightControls();</xsl:if>
onRowCheck(false);
var table = document.getElementById('resultsTable');
Expand Down Expand Up @@ -194,6 +196,7 @@
</xsl:if>
<input type="hidden" name="Path" value="{/TpMachineQueryResponse/Path}"/>
<input type="hidden" name="Cluster" value="{$clusterName}"/>
<input type="hidden" name="Addresses.itemcount" value=""/>
<h3>
<xsl:choose>
<xsl:when test="$SwapNode">Select a spare node to swap</xsl:when>
Expand Down Expand Up @@ -310,12 +313,12 @@
<xsl:if test="$ShowPreflightInfo">
<xsl:choose>
<xsl:when test="not($SwapNode)">
<input type="checkbox" name="Addresses_i{position()}" value="{Netaddress}|{ConfigNetaddress}:{Type}:{$clusterName}:{OS}:{translate(Directory, ':', '$')}:{ProcessNumber}" onclick="return clicked(this, event)">
<input type="checkbox" name="Addresses.{position()-1}" value="{Netaddress}|{ConfigNetaddress}:{Type}:{$clusterName}:{OS}:{translate(Directory, ':', '$')}:{ProcessNumber}" onclick="return clicked(this, event)">
<xsl:attribute name="checked">true</xsl:attribute>
</input>
</xsl:when>
<xsl:otherwise>
<input type="checkbox" name="Addresses_i{position()}" value="{Netaddress}:{Type}:{$clusterName}:{OS}:{translate(Directory, ':', '$')}:{ProcessNumber}" onclick="return clicked(this, event)"/>
<input type="checkbox" name="Addresses.{position()-1}" value="{Netaddress}:{Type}:{$clusterName}:{OS}:{translate(Directory, ':', '$')}:{ProcessNumber}" onclick="return clicked(this, event)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
Expand Down
7 changes: 4 additions & 3 deletions esp/eclwatch/ws_XSLT/services.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
function onLoad()
{
initSelection('resultsTable');
document.getElementsByName('Addresses.itemcount')[0].value = totalItems;
initPreflightControls();
onRowCheck(true);
//alert(totalItems);
}
function toggleDetails(id)
{
Expand Down Expand Up @@ -193,7 +193,8 @@
<th>Network Address</th>
<th>Directory</th>
</tr>


<input type="hidden" name="Addresses.itemcount" value=""/>
<xsl:call-template name="showMachines">
<xsl:with-param name="caption" select="'DALI Servers'"/>
<xsl:with-param name="nodes" select="TpDalis/TpDali"/>
Expand Down Expand Up @@ -353,7 +354,7 @@
</xsl:if>
<td width="1%" valign="top">
<xsl:if test="$showCheckbox">
<input type="checkbox" name="Addresses_i{count(preceding::TpMachine)}"
<input type="checkbox" name="Addresses.{count(preceding::TpMachine)}"
value="{Netaddress}|{ConfigNetaddress}:{Type}:{$compName}:{OS}:{translate(Directory, ':', '$')}" onclick="return clicked(this, event)">
<xsl:if test="$checked">
<xsl:attribute name="checked">true</xsl:attribute>
Expand Down
16 changes: 9 additions & 7 deletions esp/eclwatch/ws_XSLT/targetclusters.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@
function onLoad()
{
document.getElementsByName('TargetClusters.itemcount')[0].value = countTCs;
initSelection('resultsTable');
if (countTCs > 0)
{
for (i=0; i<countTCs; i++)
{
var ch = document.getElementById('TargetClusters_i'+i);
var ch = document.getElementById('TargetClusters.'+i);
if (ch && ch.checked)
{
clusterChecked++;
Expand Down Expand Up @@ -229,11 +230,12 @@
<body class="yui-skin-sam" onload="nof5();onLoad();">
<h3>Target Clusters:</h3>
<form id="listitems" action="/ws_machine/GetTargetClusterInfo" method="post">
<xsl:for-each select="TpTargetClusters/TpTargetCluster">
<xsl:call-template name="show-cluster">
<xsl:with-param name="type" select="Type"/>
<xsl:with-param name="name" select="Name"/>
</xsl:call-template>
<input type="hidden" name="TargetClusters.itemcount" value=""/>
<xsl:for-each select="TpTargetClusters/TpTargetCluster">
<xsl:call-template name="show-cluster">
<xsl:with-param name="type" select="Type"/>
<xsl:with-param name="name" select="Name"/>
</xsl:call-template>
</xsl:for-each>
<xsl:call-template name="ShowPreflightControls">
<xsl:with-param name="method" select="'GetMachineInfo'"/>
Expand Down Expand Up @@ -264,7 +266,7 @@
<table id="resultsTable" class="sort-table" width="100%">
<tr class="grey">
<td valign="top" width="20">
<input type="checkbox" id="TargetClusters_i{count(preceding::TpTargetCluster)}" name="TargetClusters_i{count(preceding::TpTargetCluster)}"
<input type="checkbox" id="TargetClusters.{count(preceding::TpTargetCluster)}" name="TargetClusters.{count(preceding::TpTargetCluster)}"
value="{$type}:{$name}" title="Select this target cluster" onclick="return clickTCCheckbox('{$type}', '{$name}', this);"></input>
</td>
<td align="left" width="20">
Expand Down
14 changes: 7 additions & 7 deletions esp/scm/ws_topology.ecm
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,19 @@ ESPStruct TpQueue
ESPStruct TpServices
{
ESParray<ESPstruct TpDali> TpDalis;
ESParray<ESPstruct TpDfuServer> TpDfuServers;
ESParray<ESPstruct TpDkcSlave> TpDkcSlaves;
ESParray<ESPstruct TpDropZone> TpDropZones;
ESParray<ESPstruct TpEclAgent> TpEclAgents;
ESParray<ESPstruct TpEclServer> TpEclServers;
ESParray<ESPstruct TpEclServer> TpEclCCServers;
ESParray<ESPstruct TpEclAgent> TpEclAgents;
[min_ver("1.16")] ESParray<ESPstruct TpEclScheduler> TpEclSchedulers;
ESParray<ESPstruct TpEspServer> TpEspServers;
ESParray<ESPstruct TpDfuServer> TpDfuServers;
ESParray<ESPstruct TpSashaServer> TpSashaServers;
ESParray<ESPstruct TpMySqlServer> TpMySqlServers;
ESParray<ESPstruct TpLdapServer> TpLdapServers;
ESParray<ESPstruct TpDropZone> TpDropZones;
ESParray<ESPstruct TpFTSlave> TpFTSlaves;
ESParray<ESPstruct TpDkcSlave> TpDkcSlaves;
ESParray<ESPstruct TpGenesisServer> TpGenesisServers;
ESParray<ESPstruct TpLdapServer> TpLdapServers;
ESParray<ESPstruct TpMySqlServer> TpMySqlServers;
ESParray<ESPstruct TpSashaServer> TpSashaServers;
};

// ===========================================================================
Expand Down
5 changes: 3 additions & 2 deletions esp/services/ws_machine/machines.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
</xsl:if>
<input type="hidden" name="Path" value="{$reqInfo/Path}"/>
<input type="hidden" name="Cluster" value="{$clusterName}"/>
<input type="hidden" name="Addresses.itemcount" value="{count(Machines/MachineInfoEx)}"/>
<xsl:choose>
<xsl:when test="Exceptions">
<h1><xsl:value-of select="Exceptions"/></h1>
Expand Down Expand Up @@ -383,10 +384,10 @@
</xsl:if-->
<xsl:choose>
<xsl:when test="string(ComponentName)='AgentExec'">
<input type="checkbox" name="Addresses_i{position()}" value="{Address}|{ConfigAddress}:EclAgentProcess:eclagent:{OS}:{translate(ComponentPath, ':', '$')}" onclick="return clicked(this, event)" checked="true"/>
<input type="checkbox" name="Addresses.{position()-1}" value="{Address}|{ConfigAddress}:EclAgentProcess:eclagent:{OS}:{translate(ComponentPath, ':', '$')}" onclick="return clicked(this, event)" checked="true"/>
</xsl:when>
<xsl:otherwise>
<input type="checkbox" name="Addresses_i{position()}" value="{Address}|{ConfigAddress}:{ProcessType}:{ComponentName}:{OS}:{translate(ComponentPath, ':', '$')}:{ProcessNumber}" onclick="return clicked(this, event)" checked="true"/>
<input type="checkbox" name="Addresses.{position()-1}" value="{Address}|{ConfigAddress}:{ProcessType}:{ComponentName}:{OS}:{translate(ComponentPath, ':', '$')}:{ProcessNumber}" onclick="return clicked(this, event)" checked="true"/>
</xsl:otherwise>
</xsl:choose>
</td>
Expand Down
64 changes: 39 additions & 25 deletions esp/services/ws_machine/ws_machineService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
############################################################################## */

#include <vector>
#include <math.h>
#include "ws_machineService.hpp"
#include "jarray.hpp"
Expand Down Expand Up @@ -508,8 +509,9 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
}
}

typedef multimap<unsigned, string> AddressMap;
AddressMap addressMap; //maps <numeric address> to <process>:<comp name>:<os>:<path>
std::vector<unsigned> numAddrVector;
std::vector<std::string> propsVector;
BoolHash uniqueRequestValues;
UnsignedArray threadHandles;
set<string> columnSet;
IpAddress ipAddr;
Expand All @@ -535,43 +537,55 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
configAddress = address;
}

StringBuffer sProcessType;
StringBuffer sCompName;
OpSysType os = OS_Windows;
StringBuffer sPath;
unsigned processNumber = 0;
if (reqInfo.getGetSoftwareInfo())
parseProperties( props, sProcessType, sCompName, os, sPath, processNumber);

IpAddress ipAddr;
unsigned numIps = ipAddr.ipsetrange(address);
//address is like 192.168.1.4-6:ThorSlaveProcess:thor1:2:path1
//so process each address in the range
for (unsigned j=0;j<numIps;j++)

if (!ipAddr.isIp4())
IPV6_NOT_IMPLEMENTED();

while (numIps--)
{
if (!ipAddr.isIp4())
IPV6_NOT_IMPLEMENTED();
unsigned numAddr;
if (ipAddr.getNetAddress(sizeof(numAddr),&numAddr)!=sizeof(numAddr))
IPV6_NOT_IMPLEMENTED(); // Not quite right exception, but will use when IPv4 hack sanity check fails

//if no mapping exists for numAddr yet or if we are using filters and props are different then
//insert in the map
AddressMap::const_iterator i = addressMap.find(numAddr);
bool bInsert = (i == addressMap.end()) ||
(reqInfo.getGetSoftwareInfo() && 0 != strcmp((*i).second.c_str(), props));
if (bInsert)
{
StringBuffer sBuf;
if (configAddress && *configAddress)
sBuf.appendf("%s:%s", configAddress, props);
addressMap.insert(pair<unsigned, string>(numAddr, sBuf.str()));
}
throw MakeStringException(ECLWATCH_INVALID_INPUT, "Invalid network address.");

ipAddr.ipincrement(1);

StringBuffer valuesToBeChecked;
valuesToBeChecked.append(numAddr);
if (reqInfo.getGetSoftwareInfo())
valuesToBeChecked.appendf(":%s:%s:%d", sProcessType.str(), sCompName.str(), processNumber);
if (uniqueRequestValues.getValue(valuesToBeChecked.str()))
continue;

StringBuffer propsToBeUsed;
propsToBeUsed.appendf("%s:%s", configAddress, props);

numAddrVector.push_back(numAddr);
propsVector.push_back(propsToBeUsed.str());
uniqueRequestValues.setValue(valuesToBeChecked.str(), true);
}
free(address);
}


AddressMap::const_iterator iBeginAddr = addressMap.begin();
AddressMap::const_iterator iEndAddr = addressMap.end();
for (AddressMap::const_iterator iAddr = iBeginAddr; iAddr != iEndAddr; iAddr++)
std::vector<unsigned>::iterator iAddr = numAddrVector.begin();
std::vector<unsigned>::iterator iEndAddr = numAddrVector.end();
std::vector<std::string>::iterator iProps = propsVector.begin();
for (; iAddr != iEndAddr; iAddr++, iProps++)
{
IpAddress ipAddr;

unsigned numAddr = (*iAddr).first; // TBD IPv6
unsigned numAddr = *iAddr; // TBD IPv6
ipAddr.setNetAddress(sizeof(numAddr),&numAddr);
StringBuffer address;
ipAddr.getIpText(address);
Expand All @@ -582,7 +596,7 @@ void Cws_machineEx::RunMachineQuery(IEspContext &context, StringArray &addresses
StringBuffer sPath;
unsigned processNumber = 0;

const char *configAddress = (*iAddr).second.c_str();
const char *configAddress = (*iProps).c_str();
char* props = (char*) strchr(configAddress, ':');
if (props)
*props++ = '\0';
Expand Down
9 changes: 6 additions & 3 deletions initfiles/examples/IMDB/FileActors.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ ThreeColumns := into_three(raw_male)+into_three(raw_female);
// to be able to see the data format without having to wade through all the low level code.

// Here we encapsulate the code to pull data out from between boundary markers such as (){} etc
FindWithin(string Src,String ToFind,String ToEnd) :=
IF ( Std.Str.Find(Src,ToFind,1) > 0,
Src[Std.Str.Find(Src,ToFind,1)+length(ToFind)..Std.Str.Find(Src,ToEnd,1)-1],
FindWithin(string Src, String ToFind, String ToEnd) := FUNCTION
startpos := Std.Str.Find(Src,ToFind,1);
l := length(ToFind);
RETURN IF ( startpos > 0,
Src[startpos+l..Std.Str.Find(Src[startpos+l..],ToEnd,1)+startpos+l-2],
'' );
END;

// This transform plucks the data field by field out of the 'filmname' which has 'magic symbols' in the 3 column format
IMDB.LayoutActors tActors(ThreeColumns L) := TRANSFORM
Expand Down
9 changes: 7 additions & 2 deletions system/security/LdapSecurity/ldapconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class CLoadBalancer : public CInterface, implements IInterface
}
};

bool LdapServerDown(int rc)
inline bool LdapServerDown(int rc)
{
return rc==LDAP_SERVER_DOWN||rc==LDAP_UNAVAILABLE||rc==LDAP_TIMEOUT;
}
Expand Down Expand Up @@ -5103,14 +5103,19 @@ int LdapUtils::getServerInfo(const char* ldapserver, int ldapport, StringBuffer&
StringBuffer onedn;
while((curdn = domains[i]) != NULL)
{
if(*curdn != '\0' && (strncmp(curdn, "dc=", 3) == 0 || strncmp(curdn, "DC=", 3) == 0))
if(*curdn != '\0' && (strncmp(curdn, "dc=", 3) == 0 || strncmp(curdn, "DC=", 3) == 0) && strstr(curdn,"DC=ForestDnsZones")==0 && strstr(curdn,"DC=DomainDnsZones")==0 )
{
if(domainDN.length() == 0)
{
StringBuffer curdomain;
LdapUtils::getName(curdn, curdomain);
if(onedn.length() == 0)
{
DBGLOG("Queried '%s', selected basedn '%s'",curdn, curdomain.str());
onedn.append(curdomain.str());
}
else
DBGLOG("Ignoring %s", curdn);
if(!domainname || !*domainname || stricmp(curdomain.str(), domainname) == 0)
domainDN.append(curdn);
}
Expand Down

0 comments on commit 1fe3026

Please sign in to comment.