40#include "MagickCore/studio.h"
41#include "MagickCore/cache-private.h"
42#include "MagickCore/client.h"
43#include "MagickCore/configure.h"
44#include "MagickCore/configure-private.h"
45#include "MagickCore/exception.h"
46#include "MagickCore/exception-private.h"
47#include "MagickCore/linked-list-private.h"
48#include "MagickCore/magick-private.h"
49#include "MagickCore/memory_.h"
50#include "MagickCore/memory-private.h"
51#include "MagickCore/monitor.h"
52#include "MagickCore/monitor-private.h"
53#include "MagickCore/option.h"
54#include "MagickCore/policy.h"
55#include "MagickCore/policy-private.h"
56#include "MagickCore/resource_.h"
57#include "MagickCore/resource-private.h"
58#include "MagickCore/semaphore.h"
59#include "MagickCore/stream-private.h"
60#include "MagickCore/string_.h"
61#include "MagickCore/string-private.h"
62#include "MagickCore/token.h"
63#include "MagickCore/timer-private.h"
64#include "MagickCore/utility.h"
65#include "MagickCore/utility-private.h"
66#include "MagickCore/xml-tree.h"
67#include "MagickCore/xml-tree-private.h"
68#if defined(MAGICKCORE_XML_DELEGATE)
69# include <libxml/parser.h>
70# include <libxml/tree.h>
76#define PolicyFilename "policy.xml"
126static const PolicyMapInfo
129 { UndefinedPolicyDomain, UndefinedPolicyRights, (
const char *) NULL,
130 (
const char *) NULL, (
const char *) NULL }
134 *policy_cache = (LinkedListInfo *) NULL;
142static MagickBooleanType
143 IsPolicyCacheInstantiated(ExceptionInfo *),
144 LoadPolicyCache(LinkedListInfo *,
const char *,
const char *,
const size_t,
173static LinkedListInfo *AcquirePolicyCache(
const char *filename,
174 ExceptionInfo *exception)
188 cache=NewLinkedList(0);
190#if MAGICKCORE_ZERO_CONFIGURATION_SUPPORT
191 magick_unreferenced(filename);
192 status=LoadPolicyCache(cache,ZeroConfigurationPolicy,
"[zero-configuration]",0,
194 if (status == MagickFalse)
195 CatchException(exception);
204 options=GetConfigureOptions(filename,exception);
205 option=(
const StringInfo *) GetNextValueInLinkedList(options);
206 while (option != (
const StringInfo *) NULL)
208 status=LoadPolicyCache(cache,(
const char *) GetStringInfoDatum(option),
209 GetStringInfoPath(option),0,exception);
210 if (status == MagickFalse)
211 CatchException(exception);
212 option=(
const StringInfo *) GetNextValueInLinkedList(options);
214 options=DestroyConfigureOptions(options);
220 for (i=0; i < (ssize_t) (
sizeof(PolicyMap)/
sizeof(*PolicyMap)); i++)
229 policy_info=(PolicyInfo *) AcquireMagickMemory(
sizeof(*policy_info));
230 if (policy_info == (PolicyInfo *) NULL)
232 (void) ThrowMagickException(exception,GetMagickModule(),
233 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
234 p->name == (
char *) NULL ?
"" : p->name);
235 CatchException(exception);
238 (void) memset(policy_info,0,
sizeof(*policy_info));
239 policy_info->path=(
char *)
"[built-in]";
240 policy_info->domain=p->domain;
241 policy_info->rights=p->rights;
242 policy_info->name=(
char *) p->name;
243 policy_info->pattern=(
char *) p->pattern;
244 policy_info->value=(
char *) p->value;
245 policy_info->exempt=MagickTrue;
246 policy_info->signature=MagickCoreSignature;
247 status=AppendValueToLinkedList(cache,policy_info);
248 if (status == MagickFalse)
250 (void) ThrowMagickException(exception,GetMagickModule(),
251 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
252 p->name == (
char *) NULL ?
"" : p->name);
253 CatchException(exception);
284static PolicyInfo *GetPolicyInfo(
const char *name,ExceptionInfo *exception)
287 policyname[MagickPathExtent],
299 assert(exception != (ExceptionInfo *) NULL);
300 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
301 return((PolicyInfo *) NULL);
306 if (name != (
const char *) NULL)
307 (void) CopyMagickString(policyname,name,MagickPathExtent);
308 for (q=policyname; *q !=
'\0'; q++)
310 if (isspace((
int) ((
unsigned char) *q)) == 0)
312 (void) CopyMagickString(q,q+1,MagickPathExtent);
318 domain=UndefinedPolicyDomain;
319 for (q=policyname; *q !=
'\0'; q++)
324 domain=(PolicyDomain) ParseCommandOption(MagickPolicyDomainOptions,
325 MagickTrue,policyname);
326 (void) CopyMagickString(policyname,q+1,MagickPathExtent);
332 policy=(PolicyInfo *) NULL;
333 LockSemaphoreInfo(policy_semaphore);
334 ResetLinkedListIterator(policy_cache);
335 p=GetHeadElementInLinkedList(policy_cache);
336 if ((name == (
const char *) NULL) || (LocaleCompare(name,
"*") == 0))
338 UnlockSemaphoreInfo(policy_semaphore);
339 if (p != (ElementInfo *) NULL)
340 policy=(PolicyInfo *) p->value;
343 while (p != (ElementInfo *) NULL)
345 policy=(PolicyInfo *) p->value;
346 if ((domain == UndefinedPolicyDomain) || (policy->domain == domain))
347 if (LocaleCompare(policyname,policy->name) == 0)
351 if (p == (ElementInfo *) NULL)
352 policy=(PolicyInfo *) NULL;
354 (
void) SetHeadElementInLinkedList(policy_cache,p);
355 UnlockSemaphoreInfo(policy_semaphore);
386MagickExport
const PolicyInfo **GetPolicyInfoList(
const char *pattern,
387 size_t *number_policies,ExceptionInfo *exception)
398 assert(pattern != (
char *) NULL);
399 assert(number_policies != (
size_t *) NULL);
400 if (IsEventLogging() != MagickFalse)
401 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",pattern);
403 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
404 return((
const PolicyInfo **) NULL);
405 policies=(
const PolicyInfo **) AcquireQuantumMemory((
size_t)
406 GetNumberOfElementsInLinkedList(policy_cache)+1UL,
sizeof(*policies));
407 if (policies == (
const PolicyInfo **) NULL)
408 return((
const PolicyInfo **) NULL);
409 LockSemaphoreInfo(policy_semaphore);
410 p=GetHeadElementInLinkedList(policy_cache);
411 for (i=0; p != (ElementInfo *) NULL; )
416 policy=(
const PolicyInfo *) p->value;
417 if ((policy->stealth == MagickFalse) &&
418 (GlobExpression(policy->name,pattern,MagickFalse) != MagickFalse))
419 policies[i++]=policy;
422 UnlockSemaphoreInfo(policy_semaphore);
424 policies=(
const PolicyInfo **) RelinquishMagickMemory((
void*) policies);
426 policies[i]=(PolicyInfo *) NULL;
427 *number_policies=(size_t) i;
459static char *AcquirePolicyString(
const char *source,
const size_t pad)
468 if (source != (
char *) NULL)
469 length+=strlen(source);
470 destination=(
char *) NULL;
473 destination=(
char *) AcquireMagickMemory((length+pad)*
sizeof(*destination));
474 if (destination == (
char *) NULL)
475 ThrowFatalException(ResourceLimitFatalError,
"UnableToAcquireString");
476 if (source != (
char *) NULL)
477 (void) memcpy(destination,source,length*
sizeof(*destination));
478 destination[length]=
'\0';
482MagickExport
char **GetPolicyList(
const char *pattern,
size_t *number_policies,
483 ExceptionInfo *exception)
494 assert(pattern != (
char *) NULL);
495 assert(number_policies != (
size_t *) NULL);
496 if (IsEventLogging() != MagickFalse)
497 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",pattern);
499 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
500 return((
char **) NULL);
501 policies=(
char **) AcquireQuantumMemory((
size_t)
502 GetNumberOfElementsInLinkedList(policy_cache)+1UL,
sizeof(*policies));
503 if (policies == (
char **) NULL)
504 return((
char **) NULL);
505 LockSemaphoreInfo(policy_semaphore);
506 p=GetHeadElementInLinkedList(policy_cache);
507 for (i=0; p != (ElementInfo *) NULL; )
512 policy=(
const PolicyInfo *) p->value;
513 if ((policy->stealth == MagickFalse) &&
514 (GlobExpression(policy->name,pattern,MagickFalse) != MagickFalse))
515 policies[i++]=AcquirePolicyString(policy->name,1);
518 UnlockSemaphoreInfo(policy_semaphore);
520 policies=(
char **) RelinquishMagickMemory(policies);
522 policies[i]=(
char *) NULL;
523 *number_policies=(size_t) i;
549MagickExport
char *GetPolicyValue(
const char *name)
560 assert(name != (
const char *) NULL);
561 if (IsEventLogging() != MagickFalse)
562 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",name);
563 exception=AcquireExceptionInfo();
564 policy_info=GetPolicyInfo(name,exception);
565 exception=DestroyExceptionInfo(exception);
566 if (policy_info == (PolicyInfo *) NULL)
567 return((
char *) NULL);
568 value=policy_info->value;
569 if ((value == (
const char *) NULL) || (*value ==
'\0'))
570 return((
char *) NULL);
571 return(AcquirePolicyString(value,1));
597static MagickBooleanType IsPolicyCacheInstantiated(ExceptionInfo *exception)
599 if (policy_cache == (LinkedListInfo *) NULL)
601 GetMaxMemoryRequest();
603 ActivateSemaphoreInfo(&policy_semaphore);
604 LockSemaphoreInfo(policy_semaphore);
605 if (policy_cache == (LinkedListInfo *) NULL)
606 policy_cache=AcquirePolicyCache(PolicyFilename,exception);
607 UnlockSemaphoreInfo(policy_semaphore);
609 return(policy_cache != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
641static inline MagickBooleanType ParseNamespace(
const char *qualified_pattern,
642 char **name,
char **pattern)
651 if ((qualified_pattern == (
const char *) NULL) || (name == (
char **) NULL) ||
652 (pattern == (
char **) NULL))
655 *pattern=(
char *) NULL;
656 separator=strstr(qualified_pattern,
"::");
657 if (separator == (
const char *) NULL)
659 *pattern=AcquireString(qualified_pattern);
660 return(*pattern != (
char *) NULL ? MagickTrue : MagickFalse);
662 length=(size_t) (separator-qualified_pattern);
663 *name=(
char *) AcquireQuantumMemory(length+1,
sizeof(
char));
664 if (*name == (
char *) NULL)
666 (void) CopyMagickString(*name,qualified_pattern,length+1);
668 *pattern=AcquireString(p);
669 if (*pattern == (
char *) NULL)
671 *name=DestroyString(*name);
678MagickExport MagickBooleanType IsRightsAuthorized(
const PolicyDomain domain,
679 const PolicyRights rights,
const char *qualified_pattern)
682 *name = (
char *) NULL,
683 *pattern = (
char *) NULL,
684 *real_pattern = (
char *) NULL;
687 **policies = (
const PolicyInfo **) NULL;
693 matched_any = MagickFalse;
696 effective_rights = AllPolicyRights;
704 if ((GetLogEventMask() & PolicyEvent) != 0)
705 (void) LogMagickEvent(PolicyEvent,GetMagickModule(),
706 "Domain: %s; rights=%s; pattern=\"%s\" ...",
707 CommandOptionToMnemonic(MagickPolicyDomainOptions,domain),
708 CommandOptionToMnemonic(MagickPolicyRightsOptions,rights),
713 exception=AcquireExceptionInfo();
714 policies=GetPolicyInfoList(
"*",&count,exception);
715 exception=DestroyExceptionInfo(exception);
716 if (policies == (
const PolicyInfo **) NULL)
718 if (ParseNamespace(qualified_pattern,&name,&pattern) == MagickFalse)
720 policies=(
const PolicyInfo **) RelinquishMagickMemory((
void *) policies);
726 for (i=0; i < (ssize_t) count; i++)
729 *policy = policies[i];
734 if (policy->domain != domain)
736 if ((name != (
char *) NULL) && (LocaleCompare(name,policy->name) != 0))
738 if ((policy->domain == PathPolicyDomain) &&
739 (real_pattern == (
const char *) NULL))
740 real_pattern=realpath_utf8(pattern);
741 match=GlobExpression(real_pattern != (
char*) NULL ? real_pattern : pattern,
742 policy->pattern,MagickFalse);
743 if (match == MagickFalse)
745 matched_any=MagickTrue;
746 effective_rights=policy->rights;
748 policies=(
const PolicyInfo **) RelinquishMagickMemory((
void *) policies);
749 if (pattern != (
char *) NULL)
750 pattern=DestroyString(pattern);
751 if (name != (
char *) NULL)
752 name=DestroyString(name);
753 if (real_pattern != (
char *) NULL)
754 real_pattern=DestroyString(real_pattern);
758 if (matched_any == MagickFalse)
760 if ((rights & ReadPolicyRights) &&
761 !(effective_rights & ReadPolicyRights))
763 if ((rights & WritePolicyRights) &&
764 !(effective_rights & WritePolicyRights))
766 if ((rights & ExecutePolicyRights) &&
767 !(effective_rights & ExecutePolicyRights))
796MagickExport MagickBooleanType ListPolicyInfo(FILE *file,
797 ExceptionInfo *exception)
815 if (file == (
const FILE *) NULL)
817 policy_info=GetPolicyInfoList(
"*",&number_policies,exception);
818 if (policy_info == (
const PolicyInfo **) NULL)
820 path=(
const char *) NULL;
821 for (i=0; i < (ssize_t) number_policies; i++)
823 if (policy_info[i]->stealth != MagickFalse)
825 if (((path == (
const char *) NULL) ||
826 (LocaleCompare(path,policy_info[i]->path) != 0)) &&
827 (policy_info[i]->path != (
char *) NULL))
828 (void) FormatLocaleFile(file,
"\nPath: %s\n",policy_info[i]->path);
829 path=policy_info[i]->path;
830 domain=CommandOptionToMnemonic(MagickPolicyDomainOptions,
831 policy_info[i]->domain);
832 (void) FormatLocaleFile(file,
" Policy: %s\n",domain);
833 if ((policy_info[i]->domain == CachePolicyDomain) ||
834 (policy_info[i]->domain == ResourcePolicyDomain) ||
835 (policy_info[i]->domain == SystemPolicyDomain))
837 if (policy_info[i]->name != (
char *) NULL)
838 (void) FormatLocaleFile(file,
" name: %s\n",policy_info[i]->name);
839 if (policy_info[i]->value != (
char *) NULL)
840 (void) FormatLocaleFile(file,
" value: %s\n",policy_info[i]->value);
844 (void) FormatLocaleFile(file,
" rights: ");
845 if (policy_info[i]->rights == NoPolicyRights)
846 (void) FormatLocaleFile(file,
"None ");
847 if ((policy_info[i]->rights & ReadPolicyRights) != 0)
848 (void) FormatLocaleFile(file,
"Read ");
849 if ((policy_info[i]->rights & WritePolicyRights) != 0)
850 (void) FormatLocaleFile(file,
"Write ");
851 if ((policy_info[i]->rights & ExecutePolicyRights) != 0)
852 (void) FormatLocaleFile(file,
"Execute ");
853 (void) FormatLocaleFile(file,
"\n");
854 if (policy_info[i]->pattern != (
char *) NULL)
855 (void) FormatLocaleFile(file,
" pattern: %s\n",
856 policy_info[i]->pattern);
859 policy_info=(
const PolicyInfo **) RelinquishMagickMemory((
void *)
895static MagickBooleanType LoadPolicyCache(LinkedListInfo *cache,
896 const char *policy,
const char *filename,
const size_t depth,
897 ExceptionInfo *exception)
900 keyword[MagickPathExtent],
918 (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
919 "Loading policy file \"%s\" ...",filename);
920 if (policy == (
char *) NULL)
923 policy_info=(PolicyInfo *) NULL;
924 token=AcquirePolicyString(policy,MagickPathExtent);
925 extent=strlen(token)+MagickPathExtent;
926 for (q=policy; *q !=
'\0'; )
931 (void) GetNextToken(q,&q,extent,token);
934 (void) CopyMagickString(keyword,token,MagickPathExtent);
935 if (LocaleNCompare(keyword,
"<!DOCTYPE",9) == 0)
940 while ((LocaleNCompare(q,
"]>",2) != 0) && (*q !=
'\0'))
941 (void) GetNextToken(q,&q,extent,token);
944 if (LocaleNCompare(keyword,
"<!--",4) == 0)
949 while ((LocaleNCompare(q,
"->",2) != 0) && (*q !=
'\0'))
950 (void) GetNextToken(q,&q,extent,token);
953 if (LocaleCompare(keyword,
"<include") == 0)
958 while (((*token !=
'/') && (*(token+1) !=
'>')) && (*q !=
'\0'))
960 (void) CopyMagickString(keyword,token,MagickPathExtent);
961 (void) GetNextToken(q,&q,extent,token);
964 (void) GetNextToken(q,&q,extent,token);
965 if (LocaleCompare(keyword,
"file") == 0)
967 if (depth > MagickMaxRecursionDepth)
968 (void) ThrowMagickException(exception,GetMagickModule(),
969 ConfigureError,
"IncludeElementNestedTooDeeply",
"`%s'",token);
973 path[MagickPathExtent],
976 GetPathComponent(filename,HeadPath,path);
978 (void) ConcatenateMagickString(path,DirectorySeparator,
980 if (*token == *DirectorySeparator)
981 (void) CopyMagickString(path,token,MagickPathExtent);
983 (
void) ConcatenateMagickString(path,token,MagickPathExtent);
984 file_xml=FileToXML(path,~0UL);
985 if (file_xml != (
char *) NULL)
987 status&=(MagickStatusType) LoadPolicyCache(cache,file_xml,
988 path,depth+1,exception);
989 file_xml=DestroyString(file_xml);
996 if (LocaleCompare(keyword,
"<policy") == 0)
1001 policy_info=(PolicyInfo *) AcquireCriticalMemory(
sizeof(*policy_info));
1002 (void) memset(policy_info,0,
sizeof(*policy_info));
1003 policy_info->path=AcquirePolicyString(filename,1);
1004 policy_info->exempt=MagickFalse;
1005 policy_info->signature=MagickCoreSignature;
1008 if (policy_info == (PolicyInfo *) NULL)
1010 if ((LocaleCompare(keyword,
"/>") == 0) ||
1011 (LocaleCompare(keyword,
"</policy>") == 0))
1013 status=AppendValueToLinkedList(cache,policy_info);
1014 if (status == MagickFalse)
1015 (void) ThrowMagickException(exception,GetMagickModule(),
1016 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
1018 policy_info=(PolicyInfo *) NULL;
1021 (void) GetNextToken(q,(
const char **) NULL,extent,token);
1024 (void) GetNextToken(q,&q,extent,token);
1025 (void) GetNextToken(q,&q,extent,token);
1031 if (LocaleCompare((
char *) keyword,
"domain") == 0)
1033 policy_info->domain=(PolicyDomain) ParseCommandOption(
1034 MagickPolicyDomainOptions,MagickTrue,token);
1042 if (LocaleCompare((
char *) keyword,
"name") == 0)
1044 policy_info->name=AcquirePolicyString(token,1);
1052 if (LocaleCompare((
char *) keyword,
"pattern") == 0)
1054 policy_info->pattern=AcquirePolicyString(token,1);
1062 if (LocaleCompare((
char *) keyword,
"rights") == 0)
1064 policy_info->rights=(PolicyRights) ParseCommandOption(
1065 MagickPolicyRightsOptions,MagickTrue,token);
1073 if (LocaleCompare((
char *) keyword,
"stealth") == 0)
1075 policy_info->stealth=IsStringTrue(token);
1083 if (LocaleCompare((
char *) keyword,
"value") == 0)
1085 policy_info->value=AcquirePolicyString(token,1);
1094 token=(
char *) RelinquishMagickMemory(token);
1095 return(status != 0 ? MagickTrue : MagickFalse);
1116MagickPrivate MagickBooleanType PolicyComponentGenesis(
void)
1119 policy_semaphore=AcquireSemaphoreInfo();
1142static void *DestroyPolicyElement(
void *policy_info)
1147 p=(PolicyInfo *) policy_info;
1148 if (p->exempt == MagickFalse)
1150 if (p->value != (
char *) NULL)
1151 p->value=DestroyString(p->value);
1152 if (p->pattern != (
char *) NULL)
1153 p->pattern=DestroyString(p->pattern);
1154 if (p->name != (
char *) NULL)
1155 p->name=DestroyString(p->name);
1156 if (p->path != (
char *) NULL)
1157 p->path=DestroyString(p->path);
1159 p=(PolicyInfo *) RelinquishMagickMemory(p);
1160 return((
void *) NULL);
1163MagickPrivate
void PolicyComponentTerminus(
void)
1166 ActivateSemaphoreInfo(&policy_semaphore);
1167 LockSemaphoreInfo(policy_semaphore);
1168 if (policy_cache != (LinkedListInfo *) NULL)
1169 policy_cache=DestroyLinkedList(policy_cache,DestroyPolicyElement);
1170 UnlockSemaphoreInfo(policy_semaphore);
1171 RelinquishSemaphoreInfo(&policy_semaphore);
1201static MagickBooleanType ValidateSecurityPolicy(
const char *policy,
1202 const char *url,ExceptionInfo *exception)
1204#if defined(MAGICKCORE_XML_DELEGATE)
1211 document=xmlReadMemory(policy,(
int) strlen(policy),url,NULL,
1212 XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
1213 if (document == (xmlDocPtr) NULL)
1215 (void) ThrowMagickException(exception,GetMagickModule(),ConfigureError,
1216 "PolicyValidationException",
"'%s'",url);
1217 return(MagickFalse);
1219 xmlFreeDoc(document);
1228MagickExport MagickBooleanType SetMagickSecurityPolicy(
const char *policy,
1229 ExceptionInfo *exception)
1243 assert(exception != (ExceptionInfo *) NULL);
1244 if (policy == (
const char *) NULL)
1245 return(MagickFalse);
1246 if (ValidateSecurityPolicy(policy,PolicyFilename,exception) == MagickFalse)
1247 return(MagickFalse);
1248 status=LoadPolicyCache(policy_cache,policy,
"[user-policy]",0,exception);
1249 if (status == MagickFalse)
1254 user_policies=NewLinkedList(0);
1255 status=LoadPolicyCache(user_policies,policy,
"[user-policy]",0,exception);
1256 if (status == MagickFalse)
1258 user_policies=DestroyLinkedList(user_policies,DestroyPolicyElement);
1259 return(MagickFalse);
1261 ResetLinkedListIterator(user_policies);
1262 p=(PolicyInfo *) GetNextValueInLinkedList(user_policies);
1263 while (p != (PolicyInfo *) NULL)
1265 if ((p->name != (
char *) NULL) && (p->value != (
char *) NULL))
1266 (void) SetMagickSecurityPolicyValue(p->domain,p->name,p->value,exception);
1267 p=(PolicyInfo *) GetNextValueInLinkedList(user_policies);
1269 user_policies=DestroyLinkedList(user_policies,DestroyPolicyElement);
1306MagickExport MagickBooleanType SetMagickSecurityPolicyValue(
1307 const PolicyDomain domain,
const char *name,
const char *value,
1308 ExceptionInfo *exception)
1310 magick_unreferenced(exception);
1311 assert(exception != (ExceptionInfo *) NULL);
1312 if ((name == (
const char *) NULL) || (value == (
const char *) NULL))
1313 return(MagickFalse);
1316 case CachePolicyDomain:
1318 if (LocaleCompare(name,
"memory-map") == 0)
1320 if (LocaleCompare(value,
"anonymous") != 0)
1321 return(MagickFalse);
1322 ResetCacheAnonymousMemory();
1323 ResetStreamAnonymousMemory();
1328 case ResourcePolicyDomain:
1333 type=ParseCommandOption(MagickResourceOptions,MagickFalse,name);
1339 limit=MagickResourceInfinity;
1340 if (LocaleCompare(
"unlimited",value) != 0)
1341 limit=StringToMagickSizeType(value,100.0);
1342 if ((ResourceType) type == TimeResource)
1343 limit=(MagickSizeType) ParseMagickTimeToLive(value);
1344 return(SetMagickResourceLimit((ResourceType) type,limit));
1348 case SystemPolicyDomain:
1350 if (LocaleCompare(name,
"max-memory-request") == 0)
1355 limit=MagickResourceInfinity;
1356 if (LocaleCompare(
"unlimited",value) != 0)
1357 limit=StringToMagickSizeType(value,100.0);
1358 SetMaxMemoryRequest(limit);
1361 if (LocaleCompare(name,
"max-profile-size") == 0)
1366 limit=MagickResourceInfinity;
1367 if (LocaleCompare(
"unlimited",value) != 0)
1368 limit=StringToMagickSizeType(value,100.0);
1369 SetMaxProfileSize(limit);
1372 if (LocaleCompare(name,
"memory-map") == 0)
1374 if (LocaleCompare(value,
"anonymous") != 0)
1375 return(MagickFalse);
1376 ResetVirtualAnonymousMemory();
1379 if (LocaleCompare(name,
"precision") == 0)
1384 limit=StringToInteger(value);
1385 SetMagickPrecision(limit);
1390 case CoderPolicyDomain:
1391 case DelegatePolicyDomain:
1392 case FilterPolicyDomain:
1393 case ModulePolicyDomain:
1394 case PathPolicyDomain:
1398 return(MagickFalse);