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 395274 | Differences between
and this patch

Collapse All | Expand All

(-)defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/DirBundleFile.java (-6 / +7 lines)
Lines 28-36 Link Here
28
	private static final String POINTER_SAME_DIRECTORY_2 = "//";//$NON-NLS-1$
28
	private static final String POINTER_SAME_DIRECTORY_2 = "//";//$NON-NLS-1$
29
	private static final String POINTER_UPPER_DIRECTORY = "..";//$NON-NLS-1$
29
	private static final String POINTER_UPPER_DIRECTORY = "..";//$NON-NLS-1$
30
30
31
	private static final String PROPERTY_STRICT_BUNDLE_ENTRY_PATH = "osgi.strictBundleEntryPath";//$NON-NLS-1$
32
	private static final String PROPERTY_STRICT_BUNDLE_ENTRY_PATH_DEFAULT_VALUE = "false";//$NON-NLS-1$
33
34
	private final boolean enableStrictBundleEntryPath;
31
	private final boolean enableStrictBundleEntryPath;
35
32
36
	/**
33
	/**
Lines 38-49 Link Here
38
	 * @param basefile the base file
35
	 * @param basefile the base file
39
	 * @throws IOException
36
	 * @throws IOException
40
	 */
37
	 */
41
	public DirBundleFile(File basefile) throws IOException {
38
	public DirBundleFile(File basefile, boolean enableStrictBundleEntryPath) throws IOException {
42
		super(basefile);
39
		super(getBaseFile(basefile, enableStrictBundleEntryPath));
43
		if (!BundleFile.secureAction.exists(basefile) || !BundleFile.secureAction.isDirectory(basefile)) {
40
		if (!BundleFile.secureAction.exists(basefile) || !BundleFile.secureAction.isDirectory(basefile)) {
44
			throw new IOException(NLS.bind(AdaptorMsg.ADAPTOR_DIRECTORY_EXCEPTION, basefile));
41
			throw new IOException(NLS.bind(AdaptorMsg.ADAPTOR_DIRECTORY_EXCEPTION, basefile));
45
		}
42
		}
46
		this.enableStrictBundleEntryPath = Boolean.parseBoolean(BundleFile.secureAction.getProperty(PROPERTY_STRICT_BUNDLE_ENTRY_PATH, PROPERTY_STRICT_BUNDLE_ENTRY_PATH_DEFAULT_VALUE));
43
		this.enableStrictBundleEntryPath = enableStrictBundleEntryPath;
44
	}
45
46
	private static File getBaseFile(File basefile, boolean enableStrictBundleEntryPath) throws IOException {
47
		return enableStrictBundleEntryPath ? secureAction.getCanonicalFile(basefile) : basefile;
47
	}
48
	}
48
49
49
	public File getFile(String path, boolean nativeCode) {
50
	public File getFile(String path, boolean nativeCode) {
(-)defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java (-4 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2011 IBM Corporation and others.
2
 * Copyright (c) 2005, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 16-21 Link Here
16
import java.lang.reflect.InvocationTargetException;
16
import java.lang.reflect.InvocationTargetException;
17
import java.lang.reflect.Method;
17
import java.lang.reflect.Method;
18
import java.net.*;
18
import java.net.*;
19
import java.security.AccessController;
19
import java.util.*;
20
import java.util.*;
20
import org.eclipse.core.runtime.adaptor.EclipseStarter;
21
import org.eclipse.core.runtime.adaptor.EclipseStarter;
21
import org.eclipse.core.runtime.adaptor.LocationManager;
22
import org.eclipse.core.runtime.adaptor.LocationManager;
Lines 31-36 Link Here
31
import org.eclipse.osgi.framework.internal.core.Constants;
32
import org.eclipse.osgi.framework.internal.core.Constants;
32
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
33
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
33
import org.eclipse.osgi.framework.util.KeyedHashSet;
34
import org.eclipse.osgi.framework.util.KeyedHashSet;
35
import org.eclipse.osgi.framework.util.SecureAction;
34
import org.eclipse.osgi.internal.loader.BundleLoader;
36
import org.eclipse.osgi.internal.loader.BundleLoader;
35
import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
37
import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
36
import org.eclipse.osgi.service.datalocation.Location;
38
import org.eclipse.osgi.service.datalocation.Location;
Lines 49-54 Link Here
49
	private static final String OPTION_RESOLVER_READER = RUNTIME_ADAPTOR + "/resolver/reader/timing"; //$NON-NLS-1$	
51
	private static final String OPTION_RESOLVER_READER = RUNTIME_ADAPTOR + "/resolver/reader/timing"; //$NON-NLS-1$	
50
	private static final String PROP_FRAMEWORK_EXTENSIONS = "osgi.framework.extensions"; //$NON-NLS-1$
52
	private static final String PROP_FRAMEWORK_EXTENSIONS = "osgi.framework.extensions"; //$NON-NLS-1$
51
	private static final String PROP_BUNDLE_STORE = "osgi.bundlestore"; //$NON-NLS-1$
53
	private static final String PROP_BUNDLE_STORE = "osgi.bundlestore"; //$NON-NLS-1$
54
55
	static final SecureAction secureAction = AccessController.doPrivileged(SecureAction.createSecureAction());
56
	private static final String PROPERTY_STRICT_BUNDLE_ENTRY_PATH = "osgi.strictBundleEntryPath";//$NON-NLS-1$
57
	private static final String PROPERTY_STRICT_BUNDLE_ENTRY_PATH_DEFAULT_VALUE = "false";//$NON-NLS-1$
52
	// The name of the bundle data directory
58
	// The name of the bundle data directory
53
	static final String DATA_DIR_NAME = "data"; //$NON-NLS-1$
59
	static final String DATA_DIR_NAME = "data"; //$NON-NLS-1$
54
	static final String LIB_TEMP = "libtemp"; //$NON-NLS-1$
60
	static final String LIB_TEMP = "libtemp"; //$NON-NLS-1$
Lines 740-749 Link Here
740
		// No factories configured or they declined to create the bundle file; do default
746
		// No factories configured or they declined to create the bundle file; do default
741
		if (result == null && content instanceof File) {
747
		if (result == null && content instanceof File) {
742
			File file = (File) content;
748
			File file = (File) content;
743
			if (isDirectory(data, base, file))
749
			if (isDirectory(data, base, file)) {
744
				result = new DirBundleFile(file);
750
				boolean strictPath = Boolean.parseBoolean(secureAction.getProperty(PROPERTY_STRICT_BUNDLE_ENTRY_PATH, PROPERTY_STRICT_BUNDLE_ENTRY_PATH_DEFAULT_VALUE));
745
			else
751
				result = new DirBundleFile(file, strictPath);
752
			} else {
746
				result = new ZipBundleFile(file, data, mruList);
753
				result = new ZipBundleFile(file, data, mruList);
754
			}
747
		}
755
		}
748
756
749
		if (result == null && content instanceof String) {
757
		if (result == null && content instanceof String) {
(-)security/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
2
 * Copyright (c) 2006, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 248-254 Link Here
248
			throw new IllegalArgumentException("null content"); //$NON-NLS-1$
248
			throw new IllegalArgumentException("null content"); //$NON-NLS-1$
249
		BundleFile contentBundleFile;
249
		BundleFile contentBundleFile;
250
		if (content.isDirectory())
250
		if (content.isDirectory())
251
			contentBundleFile = new DirBundleFile(content);
251
			contentBundleFile = new DirBundleFile(content, false);
252
		else
252
		else
253
			contentBundleFile = new ZipBundleFile(content, null);
253
			contentBundleFile = new ZipBundleFile(content, null);
254
		SignedBundleFile result = new SignedBundleFile(null, VERIFY_ALL);
254
		SignedBundleFile result = new SignedBundleFile(null, VERIFY_ALL);

Return to bug 395274