os/security/authorisation/userpromptservice/policies/inc/policies.rh
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* Resource header for User Prompt Service Policy files.
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file policies.rh
sl@0
    22
 @publishedPartner
sl@0
    23
 @released
sl@0
    24
*/
sl@0
    25
sl@0
    26
#ifndef POLICIES_RH
sl@0
    27
#define POLICIES_RH
sl@0
    28
sl@0
    29
#include <ups/ups.hrh>
sl@0
    30
sl@0
    31
/** 
sl@0
    32
This resource header file defines the structures and constants required by User
sl@0
    33
Prompt Service policy files.
sl@0
    34
sl@0
    35
A policy file is specific to an single service provided by a specific system
sl@0
    36
server and determines whether clients requesting that service from the system
sl@0
    37
server should be silently accepted/denied or require the user to be prompted.
sl@0
    38
sl@0
    39
A policy file consists of an arbitrary number of policies. The User Prompt
sl@0
    40
Service searches through the file in order attempting to match.
sl@0
    41
sl@0
    42
* The secure id of the client application.
sl@0
    43
* The destination field  (e.g. a phone number) provided by the system server. 
sl@0
    44
* If the policy only applies if the security check implemented by the system
sl@0
    45
  server passed/failed.
sl@0
    46
sl@0
    47
The first matching policy is the policy that is used so policies must be 
sl@0
    48
ordered from most specific to least specific.
sl@0
    49
sl@0
    50
The policies for a given service are defined by a single policy file and must
sl@0
    51
be named as follows ups_SystemServerSid_ServiceUid.rsc
sl@0
    52
sl@0
    53
Where the UID or SID is an 8 digit hexadecimal number.
sl@0
    54
sl@0
    55
A policy file has the following structure
sl@0
    56
sl@0
    57
UID2 KUidUpsPolicyResourceFile  // Identifies this as a UPS policy file
sl@0
    58
UID3 0xXXXXXXXX                 // Uniquely defines this policy file.
sl@0
    59
                                // The UID should be reserved using the
sl@0
    60
                                // Symbian Signed protected UID allocator.
sl@0
    61
sl@0
    62
RESOURCE POLICIES mypolicies
sl@0
    63
    {
sl@0
    64
    header = POLICY_HEADER 
sl@0
    65
        {
sl@0
    66
        // header definition
sl@0
    67
        };
sl@0
    68
policies = 
sl@0
    69
    {
sl@0
    70
    POLICY
sl@0
    71
        {
sl@0
    72
        // definition of policy 1
sl@0
    73
        },
sl@0
    74
    POLICY
sl@0
    75
        {
sl@0
    76
        // definition of policy 2
sl@0
    77
        }
sl@0
    78
    // etc
sl@0
    79
    };
sl@0
    80
}
sl@0
    81
*/
sl@0
    82
sl@0
    83
/**
sl@0
    84
Defines whether a dialog should be displayed and if so, the
sl@0
    85
set of options that should be presented in the dialog.
sl@0
    86
sl@0
    87
If just KYes or just KNo is defined then a prompt won't be displayed
sl@0
    88
and the request will be silently accepted/denied.
sl@0
    89
*/
sl@0
    90
sl@0
    91
#define KYes        0x0001
sl@0
    92
#define KNo         0x0002
sl@0
    93
#define KSession    0x0004 // Implicitly "yes", name kept for compatibility
sl@0
    94
#define KSessionYes 0x0004 // New name, same value/meaning as old Session option
sl@0
    95
#define KAlways     0x0008
sl@0
    96
#define KNever      0x0010
sl@0
    97
#define KSessionNo  0x0020
sl@0
    98
sl@0
    99
/** Secure ID (SID) classes defined by Symbian Signed.  
sl@0
   100
sl@0
   101
SID classes partition the UID range into 16 classes based on the most
sl@0
   102
significant nybble of the UID number.  
sl@0
   103
E.g. V9 protected UID allocates are always allocated from Class 2
sl@0
   104
sl@0
   105
Typically, policies would be based on the protected range (classes 0 - 7)
sl@0
   106
or the unprotected range (classes 8 - F). This is Software Install only
sl@0
   107
allows the installation of executables with protected SIDs if the package
sl@0
   108
is signed. Consequently, the identity of an application may only accurately
sl@0
   109
be verified via the SIS registry if the application has a protected SID.
sl@0
   110
sl@0
   111
See also - Symbian Signed UID FAQ
sl@0
   112
*/
sl@0
   113
#define KSidClass0  0x00000001
sl@0
   114
#define KSidClass1  0x00000002
sl@0
   115
#define KSidClass2  0x00000004
sl@0
   116
#define KSidClass3  0x00000008
sl@0
   117
#define KSidClass4  0x00000010
sl@0
   118
#define KSidClass5  0x00000020
sl@0
   119
#define KSidClass6  0x00000040
sl@0
   120
#define KSidClass7  0x00000080
sl@0
   121
#define KSidClass8  0x00000100
sl@0
   122
#define KSidClass9  0x00000200
sl@0
   123
#define KSidClassA  0x00000400
sl@0
   124
#define KSidClassB  0x00000800
sl@0
   125
#define KSidClassC  0x00001000
sl@0
   126
#define KSidClassD  0x00002000
sl@0
   127
#define KSidClassE  0x00004000
sl@0
   128
#define KSidClassF  0x00008000
sl@0
   129
sl@0
   130
// Commonly used SID class definitions
sl@0
   131
#define KProtectedSids      KSidClass0|KSidClass1|KSidClass2|KSidClass3|KSidClass4|KSidClass5|KSidClass6|KSidClass7
sl@0
   132
#define KUnprotectedSids    KSidClass8|KSidClass9|KSidClassA|KSidClassB|KSidClassC|KSidClassD|KSidClassE|KSidClassF
sl@0
   133
#define KAllSids            0x0000FFFF
sl@0
   134
sl@0
   135
sl@0
   136
/**
sl@0
   137
Specifies whether authorisation from the User Prompt Service is required for 
sl@0
   138
requests from clients that passed the system server's security check.
sl@0
   139
sl@0
   140
Note that protected SID checks are based on the SID of the application excutable
sl@0
   141
issuing the request, not the UID of the package owning that executable.
sl@0
   142
sl@0
   143
If a policy file is not defined for a system server or service then a default
sl@0
   144
value of ECheckNever will be used because this is compatible with the existing
sl@0
   145
platform security behavior.
sl@0
   146
*/
sl@0
   147
ENUM TAuthorisationPolicy
sl@0
   148
  {		
sl@0
   149
	/**
sl@0
   150
	Ignore the system server (platsec) checks, and always ask the UPS what to do.
sl@0
   151
	*/
sl@0
   152
	EAlwaysCheck = 0,	
sl@0
   153
	
sl@0
   154
	/**
sl@0
   155
	For application executables with a protected SID,  launched from the
sl@0
   156
	Z drive, where the system server checks have passed, allow the request.
sl@0
   157
	Otherwise call the UPS which may still choose to  allow the request.
sl@0
   158
	
sl@0
   159
	For all other executables, ignore the system server (platsec) checks, and 
sl@0
   160
	always ask the UPS what to do.
sl@0
   161
	*/		 
sl@0
   162
	ECheckPostManufacture = 1,
sl@0
   163
	
sl@0
   164
	/** 
sl@0
   165
	For application executables with a protected SID (regardless of drive), where
sl@0
   166
	the system server checks have passed, allow the request.
sl@0
   167
	Otherwise call the UPS which may still choose to  allow the request.
sl@0
   168
	
sl@0
   169
	For all other executables, ignore the system server (platsec) checks, and 
sl@0
   170
	always ask the UPS what to do.
sl@0
   171
	*/
sl@0
   172
	ECheckUnprotectedSids = 2,
sl@0
   173
	
sl@0
   174
	/** 
sl@0
   175
	If the system server checks passed, allow the request.
sl@0
   176
	If they failed, call the UPS which may still choose to  allow the request.
sl@0
   177
	*/
sl@0
   178
	ECheckIfFailed = 3,
sl@0
   179
	
sl@0
   180
	/** 
sl@0
   181
	If the system server checks passed, allow the request.
sl@0
   182
	If the system server checks failed, reject the request.
sl@0
   183
		
sl@0
   184
	Never query the UPS - just use existing security check result implemented
sl@0
   185
	by system server.
sl@0
   186
	*/
sl@0
   187
	ENeverCheck = 4
sl@0
   188
    }
sl@0
   189
sl@0
   190
STRUCT POLICY_HEADER
sl@0
   191
    {
sl@0
   192
	// The major version number of THIS policy file.
sl@0
   193
	// When policy files are upgraded or eclipsed the UPS deletes all decision
sl@0
   194
	// records for the system server server SID and service ID where the major
sl@0
   195
	// version in the decision record is not equal to the major version 
sl@0
   196
	// number in the policy file.
sl@0
   197
	WORD majorversion = 0;
sl@0
   198
sl@0
   199
	// The minor version number of THIS policy file.
sl@0
   200
	WORD minorversion = 0;
sl@0
   201
sl@0
   202
	// Determines whether a system server must request authorisation from the
sl@0
   203
	// User Prompt Service even if the client application passed the system
sl@0
   204
	// server's security check.
sl@0
   205
    BYTE authorisationpolicy = ECheckPostManufacture;
sl@0
   206
    
sl@0
   207
    // Defines the implementation UID of the default policy evaluator.
sl@0
   208
    // This MUST be defined and non-zero.
sl@0
   209
    LONG  policyevaluator = 0;
sl@0
   210
sl@0
   211
    // Defines the implementation UID of the default dialog creator.
sl@0
   212
    // This MUST be defined and non-zero.
sl@0
   213
    LONG  dialogcreator = 0;    
sl@0
   214
    }
sl@0
   215
sl@0
   216
/**
sl@0
   217
Allows policies to be matched according to whether the client process
sl@0
   218
passed security check defined by the system server.
sl@0
   219
Typically, this corresponds to whether the client has the correct capabilities
sl@0
   220
for the requested service. However, system servers are free to use features
sl@0
   221
other than capabilities in their security check.
sl@0
   222
sl@0
   223
E.g. If the client has the correct capabilities for the requested service then
sl@0
   224
the "Always" and "Never" options will be enabled in the policy; otherwise, a
sl@0
   225
different policy will be matched where the prompt is limited to one-shot
sl@0
   226
permissions ("Yes" and "No").
sl@0
   227
sl@0
   228
*/
sl@0
   229
ENUM TSystemServerSecurity
sl@0
   230
   { 
sl@0
   231
   /**
sl@0
   232
   The policy applies regardless of whether the client process passed the
sl@0
   233
   system server's security check.
sl@0
   234
   */
sl@0
   235
   ESystemServerSecurityPassedOrFailed = 0,
sl@0
   236
   /**
sl@0
   237
   The policy only applies if the client process failed the system server's
sl@0
   238
   security check.
sl@0
   239
   */
sl@0
   240
   ESystemServerSecurityFailed = 1,
sl@0
   241
   /**
sl@0
   242
   The policy only applies if the client process passed the system server's
sl@0
   243
   security check.
sl@0
   244
   */
sl@0
   245
   ESystemServerSecurityPassed = 2
sl@0
   246
   }
sl@0
   247
sl@0
   248
// Defines a single policy
sl@0
   249
STRUCT POLICY
sl@0
   250
    {
sl@0
   251
    // A bitmask that defines the set of SID classes that this policy applies to.
sl@0
   252
    // Typically, this field is used if a policy applies 
sl@0
   253
	// All clients with a protected SID		- KProtectedSids
sl@0
   254
    // All clients with an unprotected SID	- KUnprotectedSids
sl@0
   255
	// All clients							- KAllSids
sl@0
   256
    LONG    sid_classes = KAllSids;
sl@0
   257
sl@0
   258
    // An array of LONGs that defines a set of specific client application SIDs 
sl@0
   259
	// that this policy applies to.
sl@0
   260
    // If this field is populated then the sid_classes field will be ignored.
sl@0
   261
    LONG    sid_list[];
sl@0
   262
sl@0
   263
	// By default policies apply regardless of whether the client process
sl@0
   264
	// requesting the service passed or failed the system server's security
sl@0
   265
	// check. i.e. whether the client process has the correct capabilities.
sl@0
   266
    BYTE    systemserversecurity = ESystemServerSecurityPassedOrFailed;
sl@0
   267
sl@0
   268
    // A wildcard string to match against destination supplied by system server
sl@0
   269
	// Wildcard rules are defined by TDesC::MatchF
sl@0
   270
    LTEXT   destination = "*";
sl@0
   271
sl@0
   272
    // A bit field that controls which buttons may be displayed.
sl@0
   273
    // KYes, KNo, KSessionYes, KSessionNo, KAlways, KNever
sl@0
   274
    LONG    options = KYes|KNo;
sl@0
   275
sl@0
   276
    // If non-zero, this field overrides the implementation UID
sl@0
   277
    // of the default policy evaluator for this policy.
sl@0
   278
    LONG    policyevaluator = 0;
sl@0
   279
sl@0
   280
    // If non-zero, this field overrides the implementation UID
sl@0
   281
    // of the default dialog creator.
sl@0
   282
    LONG    dialogcreator = 0;
sl@0
   283
sl@0
   284
    // Flags specific to the policy evaluator
sl@0
   285
    WORD    flags = 0;
sl@0
   286
sl@0
   287
    // Reserved for future use, do not use
sl@0
   288
    WORD    reservedWord = 0;
sl@0
   289
sl@0
   290
    // Reserved for future use, do not use
sl@0
   291
    LLINK   reservedLink = 0;
sl@0
   292
    }
sl@0
   293
sl@0
   294
// Defines a set of policies and the implementations UIDs of the default
sl@0
   295
// policy evaluator and dialog creator plug-ins.
sl@0
   296
STRUCT POLICIES
sl@0
   297
    {
sl@0
   298
    // Version of the UPS policy format.
sl@0
   299
	// Policy files MUST NOT change this value.
sl@0
   300
    WORD version = 1;
sl@0
   301
sl@0
   302
    // reserved for future use, do not use
sl@0
   303
    LLINK reserved = 0;
sl@0
   304
sl@0
   305
    // A POLICY_HEADER structure
sl@0
   306
    STRUCT header;
sl@0
   307
sl@0
   308
    // An array of POLICY structures
sl@0
   309
    STRUCT policies[];
sl@0
   310
    }
sl@0
   311
sl@0
   312
#endif