cache_info->synchronize=IsStringTrue(value);
value=DestroyString(value);
}
- value=GetPolicyValue("synchronize");
+ value=GetPolicyValue("cache:synchronize");
if (value != (const char *) NULL)
{
cache_info->synchronize=IsStringTrue(value);
*/
cache_anonymous_memory=0;
value=GetPolicyValue("pixel-cache-memory");
+ if (value == (char *) NULL)
+ value=GetPolicyValue("cache:memory-map");
if (LocaleCompare(value,"anonymous") == 0)
{
#if defined(MAGICKCORE_HAVE_MMAP) && defined(MAP_ANONYMOUS)
Connect to distributed pixel cache and get session key.
*/
*session_key=0;
- shared_secret=GetPolicyValue("shared-secret");
+ shared_secret=GetPolicyValue("cache:shared-secret");
if (shared_secret == (char *) NULL)
{
shared_secret=DestroyString(shared_secret);
/*
Distributed pixel cache client.
*/
- shared_secret=GetPolicyValue("shared-secret");
+ shared_secret=GetPolicyValue("cache:shared-secret");
if (shared_secret == (char *) NULL)
ThrowFatalException(CacheFatalError,"shared secret expected");
p=session;
magick_precision=MagickPrecision;
limit=GetEnvironmentValue("MAGICK_PRECISION");
if (limit == (char *) NULL)
- limit=GetPolicyValue("precision");
+ limit=GetPolicyValue("system:precision");
if (limit != (char *) NULL)
{
magick_precision=StringToInteger(limit);
char
policyname[MagickPathExtent];
+ PolicyDomain
+ domain;
+
register PolicyInfo
*p;
(void) CopyMagickString(q,q+1,MagickPathExtent);
q--;
}
+ /*
+ Strip domain from policy name (e.g. resource:map).
+ */
+ domain=UndefinedPolicyDomain;
+ for (q=policyname; *q != '\0'; q++)
+ {
+ if (*q != ':')
+ continue;
+ *q='\0';
+ domain=(PolicyDomain) ParseCommandOption(MagickPolicyDomainOptions,
+ MagickTrue,policyname);
+ (void) CopyMagickString(policyname,q+1,MagickPathExtent);
+ }
/*
Search for policy tag.
*/
}
while (p != (PolicyInfo *) NULL)
{
- if (LocaleCompare(policyname,p->name) == 0)
- break;
+ if ((domain == UndefinedPolicyDomain) || (p->domain == domain))
+ if (LocaleCompare(policyname,p->name) == 0)
+ break;
p=(PolicyInfo *) GetNextValueInLinkedList(policy_cache);
}
if (p != (PolicyInfo *) NULL)
(GlobExpression(pattern,p->pattern,MagickFalse) != MagickFalse))
{
if ((rights & ReadPolicyRights) != 0)
- authorized=(p->rights & ReadPolicyRights) != 0;
+ authorized=(p->rights & ReadPolicyRights) != 0 ? MagickTrue :
+ MagickFalse;
if ((rights & WritePolicyRights) != 0)
- authorized=(p->rights & WritePolicyRights) != 0;
+ authorized=(p->rights & WritePolicyRights) != 0 ? MagickTrue :
+ MagickFalse;
if ((rights & ExecutePolicyRights) != 0)
- authorized=(p->rights & ExecutePolicyRights) != 0;
+ authorized=(p->rights & ExecutePolicyRights) != 0 ? MagickTrue :
+ MagickFalse;
}
p=(PolicyInfo *) GetNextValueInLinkedList(policy_cache);
}
PolicyInfo;
extern MagickExport char
- *GetPolicyValue(const char *name),
+ *GetPolicyValue(const char *),
**GetPolicyList(const char *,size_t *,ExceptionInfo *);
extern MagickExport const PolicyInfo
#endif
if (directory == (char *) NULL)
return(MagickTrue);
- value=GetPolicyValue("temporary-path");
+ value=GetPolicyValue("resource:temporary-path");
if (value != (char *) NULL)
{
(void) CloneString(&directory,value);
case WidthResource:
{
resource_info.width_limit=limit;
- value=GetPolicyValue("width");
+ value=GetPolicyValue("resource:width");
if (value != (char *) NULL)
resource_info.width_limit=MagickMin(limit,StringToSizeType(value,
100.0));
case HeightResource:
{
resource_info.height_limit=limit;
- value=GetPolicyValue("height");
+ value=GetPolicyValue("resource:height");
if (value != (char *) NULL)
resource_info.height_limit=MagickMin(limit,StringToSizeType(value,
100.0));
case AreaResource:
{
resource_info.area_limit=limit;
- value=GetPolicyValue("area");
+ value=GetPolicyValue("resource:area");
if (value != (char *) NULL)
resource_info.area_limit=MagickMin(limit,StringToSizeType(value,100.0));
break;
case MemoryResource:
{
resource_info.memory_limit=limit;
- value=GetPolicyValue("memory");
+ value=GetPolicyValue("resource:memory");
if (value != (char *) NULL)
resource_info.memory_limit=MagickMin(limit,StringToSizeType(value,
100.0));
case MapResource:
{
resource_info.map_limit=limit;
- value=GetPolicyValue("map");
+ value=GetPolicyValue("resource:map");
if (value != (char *) NULL)
resource_info.map_limit=MagickMin(limit,StringToSizeType(value,100.0));
break;
case DiskResource:
{
resource_info.disk_limit=limit;
- value=GetPolicyValue("disk");
+ value=GetPolicyValue("resource:disk");
if (value != (char *) NULL)
resource_info.disk_limit=MagickMin(limit,StringToSizeType(value,100.0));
break;
case FileResource:
{
resource_info.file_limit=limit;
- value=GetPolicyValue("file");
+ value=GetPolicyValue("resource:file");
if (value != (char *) NULL)
resource_info.file_limit=MagickMin(limit,StringToSizeType(value,100.0));
break;
case ThreadResource:
{
resource_info.thread_limit=limit;
- value=GetPolicyValue("thread");
+ value=GetPolicyValue("resource:thread");
if (value != (char *) NULL)
resource_info.thread_limit=MagickMin(limit,StringToSizeType(value,
100.0));
case ThrottleResource:
{
resource_info.throttle_limit=limit;
- value=GetPolicyValue("throttle");
+ value=GetPolicyValue("resource:throttle");
if (value != (char *) NULL)
resource_info.throttle_limit=MagickMax(limit,StringToSizeType(value,
100.0));
case TimeResource:
{
resource_info.time_limit=limit;
- value=GetPolicyValue("time");
+ value=GetPolicyValue("resource:time");
if (value != (char *) NULL)
resource_info.time_limit=MagickMin(limit,StringToSizeType(value,100.0));
ResetPixelCacheEpoch();
if ((path == (const char *) NULL) || (*path == '\0'))
return(MagickFalse);
- passes=GetPolicyValue("shred");
+ passes=GetPolicyValue("system:shred");
if (passes == (char *) NULL)
passes=GetEnvironmentValue("MAGICK_SHRED_PASSES");
if (passes == (char *) NULL)
<policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
-->
<policymap>
- <!-- <policy domain="system" name="pixel-cache-memory" value="anonymous"/> -->
<!-- <policy domain="system" name="shred" value="2"/> -->
<!-- <policy domain="system" name="precision" value="6"/> -->
- <!-- <policy domain="cache" name="synchronize" value="False"/> -->
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
<!-- <policy domain="resource" name="memory" value="2GiB"/> -->
<!-- <policy domain="resource" name="map" value="4GiB"/> -->
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
<!-- <policy domain="delegate" rights="none" pattern="HTTPS" /> -->
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
+ <!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
+ <!-- <policy domain="cache" name="synchronize" value="True"/> -->
<policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/>
</policymap>