MagickCore 7.1.2-32
Convert, Edit, Or Compose Bitmap Images
Loading...
Searching...
No Matches
policy-private.h
1/*
2 Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License. You may
6 obtain a copy of the License at
7
8 https://imagemagick.org/license/
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 MagickCore private policy methods.
17*/
18#ifndef MAGICKCORE_POLICY_PRIVATE_H
19#define MAGICKCORE_POLICY_PRIVATE_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25#include "MagickCore/quantum-private.h"
26#include "MagickCore/resource-private.h"
27#include "MagickCore/string-private.h"
28#include "MagickCore/utility-private.h"
29
30#if defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT)
31/*
32 Zero configuration security policy. Discussion @
33 https://imagemagick.org/script/security-policy.php.
34*/
35static const char
36 *ZeroConfigurationPolicy = \
37"<policymap> \
38</policymap>";
39#endif
40
41extern MagickExport MagickBooleanType
42 IsPathAuthorized(const PolicyRights,const char *);
43
44extern MagickPrivate MagickBooleanType
45 PolicyComponentGenesis(void);
46
47extern MagickPrivate void
48 PolicyComponentTerminus(void);
49
50static inline ssize_t GetShredPasses(void)
51{
52 char
53 *option;
54
55 ssize_t
56 policy_passes = 0,
57 env_passes = 0,
58 passes;
59
60 option=GetPolicyValue("system:shred");
61 if (option != (char *) NULL)
62 {
63 policy_passes=(ssize_t) StringToLong(option);
64 option=DestroyString(option);
65 if (policy_passes < 0)
66 return(0);
67 }
68 option=GetEnvironmentValue("MAGICK_SHRED_PASSES");
69 if (option != (char *) NULL)
70 {
71 env_passes=(ssize_t) StringToLong(option);
72 option=DestroyString(option);
73 if (env_passes < 0)
74 return(0);
75 }
76 passes=MagickMax(policy_passes,env_passes);
77 return(passes);
78}
79
80#if defined(__cplusplus) || defined(c_plusplus)
81}
82#endif
83
84#endif