summaryrefslogtreecommitdiff
path: root/qpid/java/broker
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/broker')
-rw-r--r--qpid/java/broker/bin/bdbbackup21
-rw-r--r--qpid/java/broker/bin/qpid-passwd (renamed from qpid/java/broker/bin/passwd)9
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java22
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java3
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java3
5 files changed, 18 insertions, 40 deletions
diff --git a/qpid/java/broker/bin/bdbbackup b/qpid/java/broker/bin/bdbbackup
deleted file mode 100644
index 34743cd873..0000000000
--- a/qpid/java/broker/bin/bdbbackup
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-. qpid-run org.apache.qpid.server.store.berkeleydb.BDBBackup "$@"
diff --git a/qpid/java/broker/bin/passwd b/qpid/java/broker/bin/qpid-passwd
index c1bb05c082..6e64af6e70 100644
--- a/qpid/java/broker/bin/passwd
+++ b/qpid/java/broker/bin/qpid-passwd
@@ -18,4 +18,13 @@
# under the License.
#
+# Set classpath to include Qpid jar with all required jars in manifest
+QPID_LIBS=$QPID_HOME/lib/qpid-incubating.jar
+
+# Set other variables used by the qpid-run script before calling
+export JAVA=java \
+ JAVA_VM=-server \
+ JAVA_MEM=-Xmx1024m \
+ QPID_CLASSPATH=$QPID_LIBS
+
. qpid-run org.apache.qpid.server.security.Passwd "$@"
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java
index 8ade3cdd98..10adfdd9fc 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java
@@ -182,6 +182,7 @@ public class Base64MD5PasswordFilePrincipalDatabase implements PrincipalDatabase
try
{
_userUpdate.lock();
+ char[] orig = user.getPassword();
user.setPassword(password);
try
@@ -192,6 +193,8 @@ public class Base64MD5PasswordFilePrincipalDatabase implements PrincipalDatabase
{
_logger.error("Unable to save password file, password change for user'"
+ principal + "' will revert at restart");
+ //revert the password change
+ user.setPassword(orig);
return false;
}
return true;
@@ -210,22 +213,6 @@ public class Base64MD5PasswordFilePrincipalDatabase implements PrincipalDatabase
}
}
- private char[] convertPassword(String password) throws UnsupportedEncodingException
- {
- byte[] passwdBytes = password.getBytes(DEFAULT_ENCODING);
-
- char[] passwd = new char[passwdBytes.length];
-
- int index = 0;
-
- for (byte b : passwdBytes)
- {
- passwd[index++] = (char) b;
- }
-
- return passwd;
- }
-
public boolean createPrincipal(Principal principal, char[] password)
{
if (_users.get(principal.getName()) != null)
@@ -247,9 +234,10 @@ public class Base64MD5PasswordFilePrincipalDatabase implements PrincipalDatabase
}
catch (IOException e)
{
+ //remove the use on failure.
+ _users.remove(user.getName());
return false;
}
-
}
finally
{
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java
index 5170f6216c..c49f4e2a33 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java
@@ -39,6 +39,7 @@ import java.util.regex.Pattern;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
+import java.util.LinkedList;
import java.security.Principal;
/**
@@ -157,7 +158,7 @@ public class PlainPasswordFilePrincipalDatabase implements PrincipalDatabase
public List<Principal> getUsers()
{
- return null; //todo
+ return new LinkedList<Principal>(); //todo
}
public Principal getUser(String username)
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java
index 49cd71e978..73d58ca489 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java
@@ -31,6 +31,7 @@ import java.util.Properties;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
+import java.util.LinkedList;
import java.security.Principal;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -142,7 +143,7 @@ public class PropertiesPrincipalDatabase implements PrincipalDatabase
public List<Principal> getUsers()
{
- return null; //todo
+ return new LinkedList<Principal>(); //todo
}
public Principal getUser(String username)