40#include "magick/studio.h"
41#include "magick/cache-private.h"
42#include "magick/client.h"
43#include "magick/configure.h"
44#include "magick/exception.h"
45#include "magick/exception-private.h"
46#include "magick/hashmap-private.h"
47#include "magick/locale_.h"
48#include "magick/magick-private.h"
49#include "magick/memory_.h"
50#include "magick/memory-private.h"
51#include "magick/monitor.h"
52#include "magick/monitor-private.h"
53#include "magick/option.h"
54#include "magick/policy.h"
55#include "magick/policy-private.h"
56#include "magick/resource_.h"
57#include "magick/semaphore.h"
58#include "magick/stream-private.h"
59#include "magick/string_.h"
60#include "magick/string-private.h"
61#include "magick/timer-private.h"
62#include "magick/token.h"
63#include "magick/utility.h"
64#include "magick/utility-private.h"
65#include "magick/xml-tree.h"
66#include "magick/xml-tree-private.h"
67#if defined(MAGICKCORE_XML_DELEGATE)
68# include <libxml/parser.h>
69# include <libxml/tree.h>
75#define PolicyFilename "policy.xml"
125static const PolicyMapInfo
128 { UndefinedPolicyDomain, UndefinedPolicyRights, (
const char *) NULL,
129 (
const char *) NULL, (
const char *) NULL }
133 *policy_cache = (LinkedListInfo *) NULL;
141static MagickBooleanType
142 IsPolicyCacheInstantiated(ExceptionInfo *),
143 LoadPolicyCache(LinkedListInfo *,
const char *,
const char *,
const size_t,
145 SetMagickSecurityPolicyValue(
const PolicyDomain,
const char *,
const char *,
174static LinkedListInfo *AcquirePolicyCache(
const char *filename,
175 ExceptionInfo *exception)
189 cache=NewLinkedList(0);
190 if (cache == (LinkedListInfo *) NULL)
191 ThrowFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed");
193#if MAGICKCORE_ZERO_CONFIGURATION_SUPPORT
194 magick_unreferenced(filename);
195 status=LoadPolicyCache(cache,ZeroConfigurationPolicy,
"[zero-configuration]",0,
197 if (status == MagickFalse)
198 CatchException(exception);
207 options=GetConfigureOptions(filename,exception);
208 option=(
const StringInfo *) GetNextValueInLinkedList(options);
209 while (option != (
const StringInfo *) NULL)
211 status&=LoadPolicyCache(cache,(
const char *) GetStringInfoDatum(option),
212 GetStringInfoPath(option),0,exception);
213 if (status == MagickFalse)
214 CatchException(exception);
215 option=(
const StringInfo *) GetNextValueInLinkedList(options);
217 options=DestroyConfigureOptions(options);
223 for (i=0; i < (ssize_t) (
sizeof(PolicyMap)/
sizeof(*PolicyMap)); i++)
232 policy_info=(PolicyInfo *) AcquireMagickMemory(
sizeof(*policy_info));
233 if (policy_info == (PolicyInfo *) NULL)
235 (void) ThrowMagickException(exception,GetMagickModule(),
236 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
237 p->name == (
char *) NULL ?
"" : p->name);
238 CatchException(exception);
242 (void) memset(policy_info,0,
sizeof(*policy_info));
243 policy_info->path=(
char *)
"[built-in]";
244 policy_info->domain=p->domain;
245 policy_info->rights=p->rights;
246 policy_info->name=(
char *) p->name;
247 policy_info->pattern=(
char *) p->pattern;
248 policy_info->value=(
char *) p->value;
249 policy_info->exempt=MagickTrue;
250 policy_info->signature=MagickCoreSignature;
251 status&=AppendValueToLinkedList(cache,policy_info);
252 if (status == MagickFalse)
254 (void) ThrowMagickException(exception,GetMagickModule(),
255 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
256 p->name == (
char *) NULL ?
"" : p->name);
257 CatchException(exception);
260 if (status == MagickFalse)
261 CatchException(exception);
290static PolicyInfo *GetPolicyInfo(
const char *name,ExceptionInfo *exception)
293 policyname[MagickPathExtent],
305 assert(exception != (ExceptionInfo *) NULL);
306 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
307 return((PolicyInfo *) NULL);
312 if (name != (
const char *) NULL)
313 (void) CopyMagickString(policyname,name,MagickPathExtent);
314 for (q=policyname; *q !=
'\0'; q++)
316 if (isspace((
int) ((
unsigned char) *q)) == 0)
318 (void) CopyMagickString(q,q+1,MagickPathExtent);
324 domain=UndefinedPolicyDomain;
325 for (q=policyname; *q !=
'\0'; q++)
330 domain=(PolicyDomain) ParseCommandOption(MagickPolicyDomainOptions,
331 MagickTrue,policyname);
332 (void) CopyMagickString(policyname,q+1,MagickPathExtent);
338 policy=(PolicyInfo *) NULL;
339 LockSemaphoreInfo(policy_semaphore);
340 ResetLinkedListIterator(policy_cache);
341 p=GetHeadElementInLinkedList(policy_cache);
342 if ((name == (
const char *) NULL) || (LocaleCompare(name,
"*") == 0))
344 UnlockSemaphoreInfo(policy_semaphore);
345 if (p != (ElementInfo *) NULL)
346 policy=(PolicyInfo *) p->value;
349 while (p != (ElementInfo *) NULL)
351 policy=(PolicyInfo *) p->value;
352 if ((domain == UndefinedPolicyDomain) || (policy->domain == domain))
353 if (LocaleCompare(policyname,policy->name) == 0)
357 if (p == (ElementInfo *) NULL)
358 policy=(PolicyInfo *) NULL;
360 (
void) SetHeadElementInLinkedList(policy_cache,p);
361 UnlockSemaphoreInfo(policy_semaphore);
392MagickExport
const PolicyInfo **GetPolicyInfoList(
const char *pattern,
393 size_t *number_policies,ExceptionInfo *exception)
407 assert(pattern != (
char *) NULL);
408 assert(number_policies != (
size_t *) NULL);
409 if (IsEventLogging() != MagickFalse)
410 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",pattern);
412 p=GetPolicyInfo(
"*",exception);
413 if (p == (
const PolicyInfo *) NULL)
414 return((
const PolicyInfo **) NULL);
415 policies=(
const PolicyInfo **) AcquireQuantumMemory((
size_t)
416 GetNumberOfElementsInLinkedList(policy_cache)+1UL,
sizeof(*policies));
417 if (policies == (
const PolicyInfo **) NULL)
418 return((
const PolicyInfo **) NULL);
422 LockSemaphoreInfo(policy_semaphore);
423 ResetLinkedListIterator(policy_cache);
424 p=(
const PolicyInfo *) GetNextValueInLinkedList(policy_cache);
425 for (i=0; p != (
const PolicyInfo *) NULL; )
427 if ((p->stealth == MagickFalse) &&
428 (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
430 p=(
const PolicyInfo *) GetNextValueInLinkedList(policy_cache);
432 UnlockSemaphoreInfo(policy_semaphore);
433 policies[i]=(PolicyInfo *) NULL;
434 *number_policies=(size_t) i;
466static char *AcquirePolicyString(
const char *source,
const size_t pad)
475 if (source != (
char *) NULL)
476 length+=strlen(source);
477 destination=(
char *) NULL;
479 destination=(
char *) AcquireMagickMemory((length+pad)*
sizeof(*destination));
480 if (destination == (
char *) NULL)
481 ThrowFatalException(ResourceLimitFatalError,
"UnableToAcquireString");
482 if (source != (
char *) NULL)
483 (void) memcpy(destination,source,length*
sizeof(*destination));
484 destination[length]=
'\0';
488MagickExport
char **GetPolicyList(
const char *pattern,
size_t *number_policies,
489 ExceptionInfo *exception)
503 assert(pattern != (
char *) NULL);
504 assert(number_policies != (
size_t *) NULL);
505 if (IsEventLogging() != MagickFalse)
506 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",pattern);
508 p=GetPolicyInfo(
"*",exception);
509 if (p == (
const PolicyInfo *) NULL)
510 return((
char **) NULL);
511 policies=(
char **) AcquireQuantumMemory((
size_t)
512 GetNumberOfElementsInLinkedList(policy_cache)+1UL,
sizeof(*policies));
513 if (policies == (
char **) NULL)
514 return((
char **) NULL);
518 LockSemaphoreInfo(policy_semaphore);
519 ResetLinkedListIterator(policy_cache);
520 p=(
const PolicyInfo *) GetNextValueInLinkedList(policy_cache);
521 for (i=0; p != (
const PolicyInfo *) NULL; )
523 if ((p->stealth == MagickFalse) &&
524 (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
525 policies[i++]=AcquirePolicyString(p->name,1);
526 p=(
const PolicyInfo *) GetNextValueInLinkedList(policy_cache);
528 UnlockSemaphoreInfo(policy_semaphore);
529 policies[i]=(
char *) NULL;
530 *number_policies=(size_t) i;
556MagickExport
char *GetPolicyValue(
const char *name)
567 assert(name != (
const char *) NULL);
568 if (IsEventLogging() != MagickFalse)
569 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",name);
570 exception=AcquireExceptionInfo();
571 policy_info=GetPolicyInfo(name,exception);
572 exception=DestroyExceptionInfo(exception);
573 if (policy_info == (PolicyInfo *) NULL)
574 return((
char *) NULL);
575 value=policy_info->value;
576 if ((value == (
const char *) NULL) || (*value ==
'\0'))
577 return((
char *) NULL);
578 return(AcquirePolicyString(value,1));
604static MagickBooleanType IsPolicyCacheInstantiated(ExceptionInfo *exception)
606 if (policy_cache == (LinkedListInfo *) NULL)
608 GetMaxMemoryRequest();
610 ActivateSemaphoreInfo(&policy_semaphore);
611 LockSemaphoreInfo(policy_semaphore);
612 if (policy_cache == (LinkedListInfo *) NULL)
613 policy_cache=AcquirePolicyCache(PolicyFilename,exception);
614 UnlockSemaphoreInfo(policy_semaphore);
616 return(policy_cache != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
648static inline MagickBooleanType ParseNamespace(
const char *qualified_pattern,
649 char **name,
char **pattern)
658 if ((qualified_pattern == (
const char *) NULL) || (name == (
char **) NULL) ||
659 (pattern == (
char **) NULL))
662 *pattern=(
char *) NULL;
663 separator=strstr(qualified_pattern,
"::");
664 if (separator == (
const char *) NULL)
666 *pattern=AcquireString(qualified_pattern);
667 return(*pattern != (
char *) NULL ? MagickTrue : MagickFalse);
669 length=(size_t) (separator-qualified_pattern);
670 *name=(
char *) AcquireQuantumMemory(length+1,
sizeof(
char));
671 if (*name == (
char *) NULL)
673 (void) CopyMagickString(*name,qualified_pattern,length+1);
675 *pattern=AcquireString(p);
676 if (*pattern == (
char *) NULL)
678 *name=DestroyString(*name);
685MagickExport MagickBooleanType IsRightsAuthorized(
const PolicyDomain domain,
686 const PolicyRights rights,
const char *qualified_pattern)
689 *name = (
char *) NULL,
690 *pattern = (
char *) NULL,
691 *real_pattern = (
char *) NULL;
694 **policies = (
const PolicyInfo **) NULL;
700 matched_any = MagickFalse;
703 effective_rights = AllPolicyRights;
711 if ((GetLogEventMask() & PolicyEvent) != 0)
712 (void) LogMagickEvent(PolicyEvent,GetMagickModule(),
713 "Domain: %s; rights=%s; pattern=\"%s\" ...",
714 CommandOptionToMnemonic(MagickPolicyDomainOptions,domain),
715 CommandOptionToMnemonic(MagickPolicyRightsOptions,rights),
720 exception=AcquireExceptionInfo();
721 policies=GetPolicyInfoList(
"*",&count,exception);
722 exception=DestroyExceptionInfo(exception);
723 if (policies == (
const PolicyInfo **) NULL)
725 if (ParseNamespace(qualified_pattern,&name,&pattern) == MagickFalse)
730 for (i=0; i < (ssize_t) count; i++)
733 *policy = policies[i];
738 if (policy->domain != domain)
740 if ((name != (
char *) NULL) && (LocaleCompare(name,policy->name) != 0))
742 if ((policy->domain == PathPolicyDomain) &&
743 (real_pattern == (
const char *) NULL))
744 real_pattern=realpath_utf8(pattern);
745 match=GlobExpression(real_pattern != (
char*) NULL ? real_pattern : pattern,
746 policy->pattern,MagickFalse);
747 if (match == MagickFalse)
749 matched_any=MagickTrue;
750 effective_rights=policy->rights;
752 policies=(
const PolicyInfo **) RelinquishMagickMemory((
void *) policies);
753 if (pattern != (
char *) NULL)
754 pattern=DestroyString(pattern);
755 if (name != (
char *) NULL)
756 name=DestroyString(name);
757 if (real_pattern != (
char *) NULL)
758 real_pattern=DestroyString(real_pattern);
762 if (matched_any == MagickFalse)
764 if ((rights & ReadPolicyRights) &&
765 !(effective_rights & ReadPolicyRights))
767 if ((rights & WritePolicyRights) &&
768 !(effective_rights & WritePolicyRights))
770 if ((rights & ExecutePolicyRights) &&
771 !(effective_rights & ExecutePolicyRights))
800MagickExport MagickBooleanType ListPolicyInfo(FILE *file,
801 ExceptionInfo *exception)
819 if (file == (
const FILE *) NULL)
821 policy_info=GetPolicyInfoList(
"*",&number_policies,exception);
822 if (policy_info == (
const PolicyInfo **) NULL)
824 path=(
const char *) NULL;
825 for (i=0; i < (ssize_t) number_policies; i++)
827 if (policy_info[i]->stealth != MagickFalse)
829 if (((path == (
const char *) NULL) ||
830 (LocaleCompare(path,policy_info[i]->path) != 0)) &&
831 (policy_info[i]->path != (
char *) NULL))
832 (void) FormatLocaleFile(file,
"\nPath: %s\n",policy_info[i]->path);
833 path=policy_info[i]->path;
834 domain=CommandOptionToMnemonic(MagickPolicyDomainOptions,
835 policy_info[i]->domain);
836 (void) FormatLocaleFile(file,
" Policy: %s\n",domain);
837 if ((policy_info[i]->domain == CachePolicyDomain) ||
838 (policy_info[i]->domain == ResourcePolicyDomain) ||
839 (policy_info[i]->domain == SystemPolicyDomain))
841 if (policy_info[i]->name != (
char *) NULL)
842 (void) FormatLocaleFile(file,
" name: %s\n",policy_info[i]->name);
843 if (policy_info[i]->value != (
char *) NULL)
844 (void) FormatLocaleFile(file,
" value: %s\n",policy_info[i]->value);
848 (void) FormatLocaleFile(file,
" rights: ");
849 if (policy_info[i]->rights == NoPolicyRights)
850 (void) FormatLocaleFile(file,
"None ");
851 if ((policy_info[i]->rights & ReadPolicyRights) != 0)
852 (void) FormatLocaleFile(file,
"Read ");
853 if ((policy_info[i]->rights & WritePolicyRights) != 0)
854 (void) FormatLocaleFile(file,
"Write ");
855 if ((policy_info[i]->rights & ExecutePolicyRights) != 0)
856 (void) FormatLocaleFile(file,
"Execute ");
857 (void) FormatLocaleFile(file,
"\n");
858 if (policy_info[i]->pattern != (
char *) NULL)
859 (void) FormatLocaleFile(file,
" pattern: %s\n",
860 policy_info[i]->pattern);
863 policy_info=(
const PolicyInfo **) RelinquishMagickMemory((
void *)
899static MagickBooleanType LoadPolicyCache(LinkedListInfo *cache,
const char *xml,
900 const char *filename,
const size_t depth,ExceptionInfo *exception)
903 keyword[MagickPathExtent],
921 (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
922 "Loading policy file \"%s\" ...",filename);
923 if (xml == (
char *) NULL)
926 policy_info=(PolicyInfo *) NULL;
927 token=AcquirePolicyString(xml,MagickPathExtent);
928 extent=strlen(token)+MagickPathExtent;
929 for (q=(
const char *) xml; *q !=
'\0'; )
934 (void) GetNextToken(q,&q,extent,token);
937 (void) CopyMagickString(keyword,token,MagickPathExtent);
938 if (LocaleNCompare(keyword,
"<!DOCTYPE",9) == 0)
943 while ((LocaleNCompare(q,
"]>",2) != 0) && (*q !=
'\0'))
944 (void) GetNextToken(q,&q,extent,token);
947 if (LocaleNCompare(keyword,
"<!--",4) == 0)
952 while ((LocaleNCompare(q,
"->",2) != 0) && (*q !=
'\0'))
953 (void) GetNextToken(q,&q,extent,token);
956 if (LocaleCompare(keyword,
"<include") == 0)
961 while (((*token !=
'/') && (*(token+1) !=
'>')) && (*q !=
'\0'))
963 (void) CopyMagickString(keyword,token,MagickPathExtent);
964 (void) GetNextToken(q,&q,extent,token);
967 (void) GetNextToken(q,&q,extent,token);
968 if (LocaleCompare(keyword,
"file") == 0)
970 if (depth > MagickMaxRecursionDepth)
971 (void) ThrowMagickException(exception,GetMagickModule(),
972 ConfigureError,
"IncludeElementNestedTooDeeply",
"`%s'",token);
976 path[MagickPathExtent],
979 GetPathComponent(filename,HeadPath,path);
981 (void) ConcatenateMagickString(path,DirectorySeparator,
983 if (*token == *DirectorySeparator)
984 (void) CopyMagickString(path,token,MagickPathExtent);
986 (
void) ConcatenateMagickString(path,token,MagickPathExtent);
987 xml=FileToXML(path,~0UL);
988 if (xml != (
char *) NULL)
990 status&=LoadPolicyCache(cache,xml,path,depth+1,
992 xml=(
char *) RelinquishMagickMemory(xml);
999 if (LocaleCompare(keyword,
"<policy") == 0)
1004 policy_info=(PolicyInfo *) AcquireMagickMemory(
sizeof(*policy_info));
1005 if (policy_info == (PolicyInfo *) NULL)
1006 ThrowFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed");
1007 (void) memset(policy_info,0,
sizeof(*policy_info));
1008 policy_info->path=AcquirePolicyString(filename,1);
1009 policy_info->exempt=MagickFalse;
1010 policy_info->signature=MagickCoreSignature;
1013 if (policy_info == (PolicyInfo *) NULL)
1015 if ((LocaleCompare(keyword,
"/>") == 0) ||
1016 (LocaleCompare(keyword,
"</policy>") == 0))
1018 status=AppendValueToLinkedList(cache,policy_info);
1019 if (status == MagickFalse)
1020 (void) ThrowMagickException(exception,GetMagickModule(),
1021 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
1023 policy_info=(PolicyInfo *) NULL;
1026 (void) GetNextToken(q,(
const char **) NULL,extent,token);
1029 (void) GetNextToken(q,&q,extent,token);
1030 (void) GetNextToken(q,&q,extent,token);
1036 if (LocaleCompare((
char *) keyword,
"domain") == 0)
1038 policy_info->domain=(PolicyDomain) ParseCommandOption(
1039 MagickPolicyDomainOptions,MagickTrue,token);
1047 if (LocaleCompare((
char *) keyword,
"name") == 0)
1049 policy_info->name=AcquirePolicyString(token,1);
1057 if (LocaleCompare((
char *) keyword,
"pattern") == 0)
1059 policy_info->pattern=AcquirePolicyString(token,1);
1067 if (LocaleCompare((
char *) keyword,
"rights") == 0)
1069 policy_info->rights=(PolicyRights) ParseCommandOption(
1070 MagickPolicyRightsOptions,MagickTrue,token);
1078 if (LocaleCompare((
char *) keyword,
"stealth") == 0)
1080 policy_info->stealth=IsMagickTrue(token);
1088 if (LocaleCompare((
char *) keyword,
"value") == 0)
1090 policy_info->value=AcquirePolicyString(token,1);
1099 token=(
char *) RelinquishMagickMemory(token);
1100 if (status == MagickFalse)
1101 CatchException(exception);
1102 return(status != 0 ? MagickTrue : MagickFalse);
1123MagickExport MagickBooleanType PolicyComponentGenesis(
void)
1126 policy_semaphore=AllocateSemaphoreInfo();
1149static void *DestroyPolicyElement(
void *policy_info)
1154 p=(PolicyInfo *) policy_info;
1155 if (p->exempt == MagickFalse)
1157 if (p->value != (
char *) NULL)
1158 p->value=DestroyString(p->value);
1159 if (p->pattern != (
char *) NULL)
1160 p->pattern=DestroyString(p->pattern);
1161 if (p->name != (
char *) NULL)
1162 p->name=DestroyString(p->name);
1163 if (p->path != (
char *) NULL)
1164 p->path=DestroyString(p->path);
1166 p=(PolicyInfo *) RelinquishMagickMemory(p);
1167 return((
void *) NULL);
1170MagickExport
void PolicyComponentTerminus(
void)
1173 ActivateSemaphoreInfo(&policy_semaphore);
1174 LockSemaphoreInfo(policy_semaphore);
1175 if (policy_cache != (LinkedListInfo *) NULL)
1176 policy_cache=DestroyLinkedList(policy_cache,DestroyPolicyElement);
1177 UnlockSemaphoreInfo(policy_semaphore);
1178 DestroySemaphoreInfo(&policy_semaphore);
1208static MagickBooleanType ValidateSecurityPolicy(
const char *policy,
1209 const char *url,ExceptionInfo *exception)
1211#if defined(MAGICKCORE_XML_DELEGATE)
1218 document=xmlReadMemory(policy,(
int) strlen(policy),url,NULL,
1219 XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
1220 if (document == (xmlDocPtr) NULL)
1222 (void) ThrowMagickException(exception,GetMagickModule(),ConfigureError,
1223 "PolicyValidationException",
"'%s'",url);
1224 return(MagickFalse);
1226 xmlFreeDoc(document);
1235MagickExport MagickBooleanType SetMagickSecurityPolicy(
const char *policy,
1236 ExceptionInfo *exception)
1250 assert(exception != (ExceptionInfo *) NULL);
1251 if (policy == (
const char *) NULL)
1252 return(MagickFalse);
1253 if (ValidateSecurityPolicy(policy,PolicyFilename,exception) == MagickFalse)
1254 return(MagickFalse);
1255 status=LoadPolicyCache(policy_cache,policy,
"[user-policy]",0,exception);
1256 if (status == MagickFalse)
1261 user_policies=NewLinkedList(0);
1262 status=LoadPolicyCache(user_policies,policy,
"[user-policy]",0,exception);
1263 if (status == MagickFalse)
1265 user_policies=DestroyLinkedList(user_policies,DestroyPolicyElement);
1266 return(MagickFalse);
1268 ResetLinkedListIterator(user_policies);
1269 p=(PolicyInfo *) GetNextValueInLinkedList(user_policies);
1270 while (p != (PolicyInfo *) NULL)
1272 if ((p->name != (
char *) NULL) && (p->value != (
char *) NULL))
1273 (void) SetMagickSecurityPolicyValue(p->domain,p->name,p->value,exception);
1274 p=(PolicyInfo *) GetNextValueInLinkedList(user_policies);
1276 user_policies=DestroyLinkedList(user_policies,DestroyPolicyElement);
1313static MagickBooleanType SetMagickSecurityPolicyValue(
const PolicyDomain domain,
1314 const char *name,
const char *value,ExceptionInfo *exception)
1316 magick_unreferenced(exception);
1317 assert(exception != (ExceptionInfo *) NULL);
1318 if ((name == (
const char *) NULL) || (value == (
const char *) NULL))
1319 return(MagickFalse);
1322 case CachePolicyDomain:
1324 if (LocaleCompare(name,
"memory-map") == 0)
1326 if (LocaleCompare(value,
"anonymous") != 0)
1327 return(MagickFalse);
1328 ResetCacheAnonymousMemory();
1329 ResetStreamAnonymousMemory();
1334 case ResourcePolicyDomain:
1339 type=ParseCommandOption(MagickResourceOptions,MagickFalse,name);
1345 limit=MagickResourceInfinity;
1346 if (LocaleCompare(
"unlimited",value) != 0)
1347 limit=StringToMagickSizeType(value,100.0);
1348 if ((ResourceType) type == TimeResource)
1349 limit=(MagickSizeType) ParseMagickTimeToLive(value);
1350 return(SetMagickResourceLimit((ResourceType) type,limit));
1354 case SystemPolicyDomain:
1356 if (LocaleCompare(name,
"max-memory-request") == 0)
1361 limit=MagickResourceInfinity;
1362 if (LocaleCompare(
"unlimited",value) != 0)
1363 limit=StringToMagickSizeType(value,100.0);
1364 SetMaxMemoryRequest(limit);
1367 if (LocaleCompare(name,
"memory-map") == 0)
1369 if (LocaleCompare(value,
"anonymous") != 0)
1370 return(MagickFalse);
1371 ResetVirtualAnonymousMemory();
1374 if (LocaleCompare(name,
"precision") == 0)
1379 limit=StringToInteger(value);
1380 SetMagickPrecision(limit);
1385 case CoderPolicyDomain:
1386 case DelegatePolicyDomain:
1387 case FilterPolicyDomain:
1388 case ModulePolicyDomain:
1389 case PathPolicyDomain:
1393 return(MagickFalse);