⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 policy.cgi

📁 xen 3.2.2 源码
💻 CGI
📖 第 1 页 / 共 5 页
字号:
			print '      </ChineseWallTypes>'		print '    </VirtualMachineLabel>'	print '  </SubjectLabels>'def sendPLObjXml( ):	global formResNames, allResStes	# Resources...	if len( formResNames[1] ) == 0:		return	print '  <ObjectLabels>'	for resName in formResNames[1]:		print '    <ResourceLabel>'		print '      <Name>' + resName + '</Name>'		formVar = allResStes[resName]		if len( formVar[1] ) > 0:			print '      <SimpleTypeEnforcementTypes>'			for ste in formVar[1]:				print '        <Type>' + ste + '</Type>'			print '      </SimpleTypeEnforcementTypes>'		print '    </ResourceLabel>'	print '  </ObjectLabels>'# Set up initial HTML variablesheadTitle = 'Xen Policy Generation'# Form variables#   The format of these variables is as follows:#   [ p0, p1, p2, p3, p4, p5 ]#     p0 = input type#     p1 = the current value of the variable#     p2 = the hidden input name attribute#     p3 = the name attribute#     p4 = the value attribute#     p5 = text to associate with the tagformPolicyName    = [ 'text',			'',			'h_policyName',			'i_policyName',			'',			'',		    ]formPolicyUrl     = [ 'text',			'',			'h_policyUrl',			'i_policyUrl',			'',			'',			]formPolicyRef    = [ 'text',			'',			'h_policyRef',			'i_policyRef',			'',			'',			]formPolicyDate    = [ 'text',			getCurrentTime( ),			'h_policyDate',			'i_policyDate',			'',			'',		    ]formPolicyNSUrl   = [ 'text',			'',			'h_policyNSUrl',			'i_policyNSUrl',			'',			'',			]formPolicyOrder   = [ 'radiobutton-all',			'v_ChWall',			'h_policyOrder',			'i_policyOrder',			[ 'v_Ste', 'v_ChWall' ],			[ 'Simple Type Enforcement', 'Chinese Wall' ],		    ]formPolicyUpdate  = [ 'button',			'',			'',			'i_PolicyUpdate',			'Update',			'',		    ]formSteTypes      = [ 'list',			[],			'h_steTypes',			'i_steTypes',			'',			'',		    ]formSteDel        = [ 'button',			'',			'',			'i_steDel',			'Delete',			'',		    ]formSteType       = [ 'text',			'',			'',			'i_steType',			'',			'',		    ]formSteAdd        = [ 'button',			'',			'',			'i_steAdd',			'New',			'',		    ]formChWallTypes   = [ 'list',			[],			'h_chwallTypes',			'i_chwallTypes',			'',			'',		    ]formChWallDel     = [ 'button',			'',			'',			'i_chwallDel',			'Delete',			'',		    ]formChWallType    = [ 'text',			'',			'',			'i_chwallType',			'',			'',		    ]formChWallAdd     = [ 'button',			'',			'',			'i_chwallAdd',			'New',			'',		    ]formCSNames       = [ '',			[],			'h_csNames',			'',			'',			'',		    ]formCSName        = [ 'text',			'',			'',			'i_csName',			'',			'',		    ]formCSAdd         = [ 'button',			'',			'',			'i_csAdd',			'New',			'',		    ]formXmlGen          = [ 'button',			'',			'',			'i_xmlGen',			'Generate XML',			'',		    ]formDefaultButton = [ 'button',			'',			'',			'i_defaultButton',			'.',			'',		    ]# This is a set of templates used for each conflict set#   Each conflict set is initially assigned these templates,#   then each form attribute value is changed to append#   "_conflict-set-name" for uniquenesstemplateCSDel     = [ 'button',			'',			'',			'i_csDel',			'Delete',			'',		    ]allCSDel          = {};templateCSMTypes  = [ 'list',			[],			'h_csmTypes',			'i_csmTypes',			'',			'',		    ]templateCSMDel    = [ 'button',			'',			'',			'i_csmDel',			'Delete',			'',		    ]templateCSMType   = [ 'list',			[],			'',			'i_csmType',			'',			'',		    ]templateCSMAdd    = [ 'button',			'',			'',			'i_csmAdd',			'Add',			'',		    ]allCSMTypes       = {};allCSMDel         = {};allCSMType        = {};allCSMAdd         = {};formVmNames       = [ '',			[],			'h_vmNames',			'',			'',			'',		    ]formVmDel         = [ 'button',			'',			'',			'i_vmDel',			'Delete',			'',		    ]formVmName        = [ 'text',			'',			'',			'i_vmName',			'',			'',		    ]formVmAdd         = [ 'button',			'',			'',			'i_vmAdd',			'New',			'',		    ]formVmNameDom0    = [ '',			'',			'h_vmDom0',			'',			'',			'',		    ]# This is a set of templates used for each virtual machine#   Each virtual machine is initially assigned these templates,#   then each form attribute value is changed to append#   "_virtual-machine-name" for uniqueness.templateVmDel     = [ 'button',			'',			'',			'i_vmDel',			'Delete',			'',		    ]templateVmDom0    = [ 'button',			'',			'',			'i_vmDom0',			'SetDom0',			'',		    ]allVmDel          = {};allVmDom0         = {};templateVmChWs    = [ 'list',			[],			'h_vmChWs',			'i_vmChWs',			'',			'',		    ]templateVmChWDel  = [ 'button',			'',			'',			'i_vmChWDel',			'Delete',			'',		    ]templateVmChW     = [ 'list',			[],			'',			'i_vmChW',			'',			'',		    ]templateVmChWAdd  = [ 'button',			'',			'',			'i_vmChWAdd',			'Add',			'',		    ]allVmChWs         = {};allVmChWDel       = {};allVmChW          = {};allVmChWAdd       = {};templateVmStes    = [ 'list',			[],			'h_vmStes',			'i_vmStes',			'',			'',		    ]templateVmSteDel  = [ 'button',			'',			'',			'i_vmSteDel',			'Delete',			'',		    ]templateVmSte     = [ 'list',			[],			'',			'i_vmSte',			'',			'',		    ]templateVmSteAdd  = [ 'button',			'',			'',			'i_vmSteAdd',			'Add',			'',		    ]allVmStes         = {};allVmSteDel       = {};allVmSte          = {};allVmSteAdd       = {};formResNames      = [ '',			[],			'h_resNames',			'',			'',			'',		    ]formResDel        = [ 'button',			'',			'',			'i_resDel',			'Delete',			'',		    ]formResName       = [ 'text',			'',			'',			'i_resName',			'',			'',		    ]formResAdd        = [ 'button',			'',			'',			'i_resAdd',			'New',			'',		    ]# This is a set of templates used for each resource#   Each resource is initially assigned these templates,#   then each form attribute value is changed to append#   "_resource-name" for uniqueness.templateResDel    = [ 'button',			'',			'',			'i_resDel',			'Delete',			'',		    ]allResDel         = {};templateResStes   = [ 'list',			[],			'h_resStes',			'i_resStes',			'',			'',		    ]templateResSteDel = [ 'button',			'',			'',			'i_resSteDel',			'Delete',			'',		    ]templateResSte    = [ 'list',			[],			'',			'i_resSte',			'',			'',		    ]templateResSteAdd = [ 'button',			'',			'',			'i_resSteAdd',			'Add',			'',		    ]allResStes        = {};allResSteDel      = {};allResSte         = {};allResSteAdd      = {};# A list of all form variables used for saving info across requestsformVariables     = [ formPolicyName,			formPolicyUrl,			formPolicyRef,			formPolicyDate,			formPolicyNSUrl,			formPolicyOrder,			formSteTypes,			formChWallTypes,			formCSNames,			formVmNames,			formVmNameDom0,			formResNames,		    ]policyXml         = ''xmlError          = 0xmlIncomplete     = 0xmlMessages       = []# Extract any form dataformData = cgi.FieldStorage( )# Process the formgetSavedData( )processRequest( )if formData.has_key( formXmlGen[3] ):	# Generate and send the XML file	checkXmlData( )	if xmlIncomplete == 0:		sendXmlHeaders( )		sendPolicyXml( )if (not formData.has_key( formXmlGen[3] )) or (xmlIncomplete == 1 ):	# Send HTML to continue processing the form	sendHtmlHeaders( )	sendPolicyHtml( )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -