Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-08-21 20:05:31 +0000
committerThomas Watson2008-08-21 20:05:31 +0000
commit828c9602eee47421f5402d6d6620a21c5b27c094 (patch)
tree800e794ebbef422f925ca491d8ca0f7f2b7aeac5
parent80fc69a928aa48a242287f27d56c2e8574d33116 (diff)
downloadrt.equinox.bundles-828c9602eee47421f5402d6d6620a21c5b27c094.tar.gz
rt.equinox.bundles-828c9602eee47421f5402d6d6620a21c5b27c094.tar.xz
rt.equinox.bundles-828c9602eee47421f5402d6d6620a21c5b27c094.zip
Bug 241663 [user admin] Incorrect Password Save/Loadv20080825-1800
-rw-r--r--bundles/org.eclipse.equinox.useradmin/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.useradmin/src/org/eclipse/equinox/internal/useradmin/UserAdminStore.java27
2 files changed, 24 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.useradmin/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.useradmin/META-INF/MANIFEST.MF
index aa22d80ab..7ae7473ba 100644
--- a/bundles/org.eclipse.equinox.useradmin/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.useradmin/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Bundle-ManifestVersion: 2
Bundle-Vendor: %bundleVendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.100.qualifier
Bundle-Activator: org.eclipse.equinox.internal.useradmin.Activator
Bundle-Copyright: %bundleCopyright
Bundle-SymbolicName: org.eclipse.equinox.useradmin
diff --git a/bundles/org.eclipse.equinox.useradmin/src/org/eclipse/equinox/internal/useradmin/UserAdminStore.java b/bundles/org.eclipse.equinox.useradmin/src/org/eclipse/equinox/internal/useradmin/UserAdminStore.java
index 62d08083e..e739b40f5 100644
--- a/bundles/org.eclipse.equinox.useradmin/src/org/eclipse/equinox/internal/useradmin/UserAdminStore.java
+++ b/bundles/org.eclipse.equinox.useradmin/src/org/eclipse/equinox/internal/useradmin/UserAdminStore.java
@@ -27,6 +27,7 @@ public class UserAdminStore {
static protected final String propertiesNode = "properties"; //$NON-NLS-1$
static protected final String credentialsNode = "credentials"; //$NON-NLS-1$
static protected final String membersNode = "members"; //$NON-NLS-1$
+ static private final String typesNode = "types"; //$NON-NLS-1$
static protected final String basicString = "basic"; //$NON-NLS-1$
static protected final String requiredString = "required"; //$NON-NLS-1$
static protected final String typeString = "type"; //$NON-NLS-1$
@@ -99,6 +100,8 @@ public class UserAdminStore {
public Object run() throws BackingStoreException {
Preferences propertyNode = rootNode.node(role.getName() + "/" + propertiesNode); //$NON-NLS-1$
propertyNode.clear();
+ if (propertyNode.nodeExists(typesNode))
+ propertyNode.node(typesNode).removeNode();
propertyNode.flush();
return (null);
}
@@ -114,11 +117,14 @@ public class UserAdminStore {
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws BackingStoreException {
Preferences propertyNode = rootNode.node(role.getName() + "/" + propertiesNode); //$NON-NLS-1$
+ Preferences propertyTypesNode = propertyNode.node(typesNode);
if (value instanceof String) {
propertyNode.put(key, (String) value);
+ propertyTypesNode.putBoolean(key, true);
} else //must be a byte array, then
{
propertyNode.putByteArray(key, (byte[]) value);
+ propertyTypesNode.putBoolean(key, true);
}
propertyNode.flush();
return (null);
@@ -136,6 +142,8 @@ public class UserAdminStore {
public Object run() throws BackingStoreException {
Preferences propertyNode = rootNode.node(role.getName() + "/" + propertiesNode); //$NON-NLS-1$
propertyNode.remove(key);
+ if (propertyNode.nodeExists(typesNode))
+ propertyNode.node(typesNode).remove(key);
propertyNode.flush();
return (null);
}
@@ -152,6 +160,8 @@ public class UserAdminStore {
public Object run() throws BackingStoreException {
Preferences credentialNode = rootNode.node(role.getName() + "/" + credentialsNode); //$NON-NLS-1$
credentialNode.clear();
+ if (credentialNode.nodeExists(typesNode))
+ credentialNode.node(typesNode).removeNode();
credentialNode.flush();
return (null);
}
@@ -168,11 +178,14 @@ public class UserAdminStore {
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws BackingStoreException {
Preferences credentialNode = rootNode.node(role.getName() + "/" + credentialsNode); //$NON-NLS-1$
+ Preferences credentialTypesNode = credentialNode.node(typesNode);
if (value instanceof String) {
credentialNode.put(key, (String) value);
+ credentialTypesNode.putBoolean(key, true);
} else //assume it is a byte array
{
credentialNode.putByteArray(key, (byte[]) value);
+ credentialTypesNode.putBoolean(key, false);
}
credentialNode.flush();
return (null);
@@ -191,6 +204,8 @@ public class UserAdminStore {
public Object run() throws BackingStoreException {
Preferences credentialNode = rootNode.node(role.getName() + "/" + credentialsNode); //$NON-NLS-1$
credentialNode.remove(key);
+ if (credentialNode.nodeExists(typesNode))
+ credentialNode.node(typesNode).remove(key);
credentialNode.flush();
return (null);
}
@@ -284,10 +299,12 @@ public class UserAdminStore {
Object value;
//load properties
+ Preferences propsTypesNode = propsNode.node(typesNode);
for (int i = 0; i < keys.length; i++) {
- value = propsNode.getByteArray(keys[i], null);
- if (value == null)
+ if (propsTypesNode.getBoolean(keys[i], true))
value = propsNode.get(keys[i], null);
+ else
+ value = propsNode.getByteArray(keys[i], null);
properties.put(keys[i], value, false);
}
@@ -295,12 +312,14 @@ public class UserAdminStore {
if (type == org.osgi.service.useradmin.Role.USER || type == org.osgi.service.useradmin.Role.GROUP) {
Object credValue;
Preferences credNode = node.node(credentialsNode);
+ Preferences credTypesNode = credNode.node(UserAdminStore.typesNode);
keys = credNode.keys();
UserAdminHashtable credentials = (UserAdminHashtable) ((User) role).getCredentials();
for (int i = 0; i < keys.length; i++) {
- credValue = credNode.getByteArray(keys[i], null);
- if (credValue == null)
+ if (credTypesNode.getBoolean(keys[i], true))
credValue = credNode.get(keys[i], null);
+ else
+ credValue = credNode.getByteArray(keys[i], null);
credentials.put(keys[i], credValue, false);
}
}

Back to the top