Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 323347
Collapse All | Expand All

(-)a/build-kernel/bin/dmk.bat (-7 / +2 lines)
Lines 49-60 rem ------------------------------ Link Here
49
  shift
49
  shift
50
  rem The shift must be here :()
50
  rem The shift must be here :()
51
51
52
  rem Check further file that needs to exist
53
  for %%I in ("%KERNEL_HOME%\bin\jmxPermissions.vbs") do if not exist "%%~I" (
54
    echo File "%%~I" does not exist but is required to continue.
55
    exit /B 1
56
  )
57
58
  rem Set defaults
52
  rem Set defaults
59
    set CONFIG_DIR=%KERNEL_HOME%\config
53
    set CONFIG_DIR=%KERNEL_HOME%\config
60
    set CLEAN_FLAG=
54
    set CLEAN_FLAG=
Lines 125-131 rem ------------------------------ Link Here
125
119
126
  
120
  
127
  rem Adjust permissions if necessary
121
  rem Adjust permissions if necessary
128
    cscript //NoLogo "%KERNEL_HOME%\bin\jmxPermissions.vbs" "%CONFIG_DIR%\"
122
	takeown /F "%CONFIG_DIR%\org.eclipse.virgo.kernel.jmxremote.access.properties" > nul
123
	echo Y| cacls "%CONFIG_DIR%\org.eclipse.virgo.kernel.jmxremote.access.properties" /G "%USERDOMAIN%\%USERNAME%":F > nul
129
124
130
  rem Adjust options now all are known
125
  rem Adjust options now all are known
131
    if "%KEYSTORE_PATH%"=="" set KEYSTORE_PATH=%CONFIG_DIR%\keystore
126
    if "%KEYSTORE_PATH%"=="" set KEYSTORE_PATH=%CONFIG_DIR%\keystore
(-)a/build-kernel/bin/jmxPermissions.vbs (-71 lines)
Lines 1-70 Link Here
1
configFolder = Wscript.Arguments.Item(0)
2
3
'WScript.Echo "Fixing permissions on " & configFolder
4
5
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") 'Load up WMI with the right dll
6
7
Dim files(0)
8
files(0) = "org.eclipse.virgo.kernel.jmxremote.access.properties"
9
10
For Each file In files
11
	updateInheritance(configFolder & file)
12
	updateOwnership(configFolder & file)
13
	updatePermissions(configFolder & file)
14
Next 
15
16
Sub updateInheritance(file)
17
	'WScript.Echo "Updating inheritance of " & file
18
	
19
	Const SE_DACL_PRESENT = 4
20
	Const SE_DACL_PROTECTED = 4096
21
	Const SE_SELF_RELATIVE = 32768
22
23
	Set objFileSecSetting = objWMIService.Get("Win32_LogicalFileSecuritySetting.Path='" & file & "'")
24
    objFileSecSetting.GetSecurityDescriptor objSecurityDescriptor
25
26
	objSecurityDescriptor.ControlFlags = SE_DACL_PRESENT + SE_DACL_PROTECTED + SE_SELF_RELATIVE
27
28
	Set objMethod = objFileSecSetting.Methods_("SetSecurityDescriptor")
29
	Set objInParam = objMethod.inParameters.SpawnInstance_()
30
	objInParam.Properties_.item("Descriptor") = objSecurityDescriptor
31
	objFileSecSetting.ExecMethod_ "SetSecurityDescriptor", objInParam
32
	
33
	'WScript.Echo "Updated inheritance of " & file
34
End Sub
35
36
Sub updateOwnership(file)
37
	'WScript.Echo "Updating ownership of " & file
38
	Set objDataFile = objWMIService.Get("CIM_DataFile.Name='" & file & "'")
39
40
	Set objMethod = objDataFile.Methods_("TakeOwnerShipEx")
41
	Set objInParam = objMethod.inParameters.SpawnInstance_()
42
43
	objDataFile.ExecMethod_ "TakeOwnerShipEx", objInParam
44
45
	'WScript.Echo "Updated ownership of " & file
46
End Sub
47
48
Sub updatePermissions(file)	
49
	'WScript.Echo "Updating permissions of " & file
50
	
51
	Set objFileSecSetting = objWMIService.Get("Win32_LogicalFileSecuritySetting.Path='" & file & "'")
52
    objFileSecSetting.GetSecurityDescriptor objSecurityDescriptor
53
54
	Set WshNetwork = WScript.CreateObject("WScript.Network")
55
	Dim specificAce(0)
56
	For Each ace in objSecurityDescriptor.DACL
57
		If ace.Trustee.Name = WshNetwork.UserName Then
58
			Set specificAce(0) = ace
59
		End If
60
	Next
61
	
62
	objSecurityDescriptor.DACL = specificAce
63
64
	Set objMethod = objFileSecSetting.Methods_("SetSecurityDescriptor")
65
	Set objInParam = objMethod.inParameters.SpawnInstance_()
66
	objInParam.Properties_.item("Descriptor") = objSecurityDescriptor
67
	objFileSecSetting.ExecMethod_ "SetSecurityDescriptor", objInParam
68
	
69
	'WScript.Echo "Updated permissions of " & file
70
End Sub
71
- 

Return to bug 323347