MagickStatusType
flags;
- PolicyDomain
- domain;
-
- PolicyRights
- rights;
-
/*
Determine image type from filename prefix or suffix (e.g. image.jpg).
*/
(void) SetImageInfo(read_info,0,exception);
(void) CopyMagickString(filename,read_info->filename,MagickPathExtent);
(void) CopyMagickString(magick,read_info->magick,MagickPathExtent);
- domain=CoderPolicyDomain;
- rights=ReadPolicyRights;
- if (IsRightsAuthorized(domain,rights,read_info->magick) == MagickFalse)
- {
- errno=EPERM;
- (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
- "NotAuthorized","`%s'",read_info->filename);
- read_info=DestroyImageInfo(read_info);
- return((Image *) NULL);
- }
/*
Call appropriate image reader based on image type.
*/
sans_exception=DestroyExceptionInfo(sans_exception);
if (magick_info != (const MagickInfo *) NULL)
{
+ PolicyDomain
+ domain;
+
+ PolicyRights
+ rights;
+
+ domain=CoderPolicyDomain;
+ rights=ReadPolicyRights;
+ if (IsRightsAuthorized(domain,rights,magick_info->module) == MagickFalse)
+ {
+ errno=EPERM;
+ (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
+ "NotAuthorized","`%s'",read_info->filename);
+ read_info=DestroyImageInfo(read_info);
+ return((Image *) NULL);
+ }
if (GetMagickEndianSupport(magick_info) == MagickFalse)
read_info->endian=UndefinedEndian;
else
status,
temporary;
- PolicyDomain
- domain;
-
- PolicyRights
- rights;
-
/*
Determine image type from filename prefix or suffix (e.g. image.jpg).
*/
(void) CopyMagickString(filename,image->filename,MagickPathExtent);
(void) CopyMagickString(image->filename,write_info->filename,
MagickPathExtent);
- domain=CoderPolicyDomain;
- rights=WritePolicyRights;
- if (IsRightsAuthorized(domain,rights,write_info->magick) == MagickFalse)
- {
- sans_exception=DestroyExceptionInfo(sans_exception);
- write_info=DestroyImageInfo(write_info);
- errno=EPERM;
- ThrowBinaryException(PolicyError,"NotAuthorized",filename);
- }
/*
Call appropriate image writer based on image type.
*/
sans_exception=DestroyExceptionInfo(sans_exception);
if (magick_info != (const MagickInfo *) NULL)
{
+ PolicyDomain
+ domain;
+
+ PolicyRights
+ rights;
+
+ domain=CoderPolicyDomain;
+ rights=WritePolicyRights;
+ if (IsRightsAuthorized(domain,rights,magick_info->module) == MagickFalse)
+ {
+ write_info=DestroyImageInfo(write_info);
+ errno=EPERM;
+ ThrowBinaryException(PolicyError,"NotAuthorized",filename);
+ }
if (GetMagickEndianSupport(magick_info) == MagickFalse)
image->endian=UndefinedEndian;
else
PolicyRightsOptions[] =
{
{ "Undefined", UndefinedPolicyRights, UndefinedOptionFlag, MagickTrue },
+ { "All", AllPolicyRights, UndefinedOptionFlag, MagickFalse },
+ { "Execute", ExecutePolicyRights, UndefinedOptionFlag, MagickFalse },
{ "None", NoPolicyRights, UndefinedOptionFlag, MagickFalse },
{ "Read", ReadPolicyRights, UndefinedOptionFlag, MagickFalse },
{ "Write", WritePolicyRights, UndefinedOptionFlag, MagickFalse },
- { "Execute", ExecutePolicyRights, UndefinedOptionFlag, MagickFalse },
{ (char *) NULL, UndefinedPolicyRights, UndefinedOptionFlag, MagickFalse }
},
PreviewOptions[] =
LockSemaphoreInfo(policy_semaphore);
ResetLinkedListIterator(policy_cache);
p=(PolicyInfo *) GetNextValueInLinkedList(policy_cache);
- while ((p != (PolicyInfo *) NULL) && (authorized != MagickFalse))
+ while (p != (PolicyInfo *) NULL)
{
if ((p->domain == domain) &&
(GlobExpression(pattern,p->pattern,MagickFalse) != MagickFalse))
{
- if (((rights & ReadPolicyRights) != 0) &&
- ((p->rights & ReadPolicyRights) == 0))
- authorized=MagickFalse;
- if (((rights & WritePolicyRights) != 0) &&
- ((p->rights & WritePolicyRights) == 0))
- authorized=MagickFalse;
- if (((rights & ExecutePolicyRights) != 0) &&
- ((p->rights & ExecutePolicyRights) == 0))
- authorized=MagickFalse;
+ if ((rights & ReadPolicyRights) != 0)
+ authorized=(p->rights & ReadPolicyRights) != 0;
+ if ((rights & WritePolicyRights) != 0)
+ authorized=(p->rights & WritePolicyRights) != 0;
+ if ((rights & ExecutePolicyRights) != 0)
+ authorized=(p->rights & ExecutePolicyRights) != 0;
}
p=(PolicyInfo *) GetNextValueInLinkedList(policy_cache);
}