From 66fece64f43548ff0e1074109f912fccf77d3cd2 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 26 Feb 2013 21:24:09 -0800 Subject: [PATCH] Ticket #269: Do not requery connection when updating. --- .../guacamole/net/auth/mysql/ConnectionDirectory.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/ConnectionDirectory.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/ConnectionDirectory.java index abf5c43af..c9c928677 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/ConnectionDirectory.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/ConnectionDirectory.java @@ -199,12 +199,15 @@ public class ConnectionDirectory implements Directory{ @Override public void update(Connection object) throws GuacamoleException { + // If connection not actually from this auth provider, we can't handle + // the update + if (!(object instanceof MySQLConnection)) + throw new GuacamoleException("Connection not from database."); + // Verify permission to update permissionCheckService.verifyConnectionUpdateAccess(this.user_id, object.getIdentifier()); - // TODO: Rely on update() to be given MySQLConnection - MySQLConnection mySQLConnection = - providerService.getExistingMySQLConnection(object); + MySQLConnection mySQLConnection = (MySQLConnection) object; // Create database object for insert net.sourceforge.guacamole.net.auth.mysql.model.Connection connection =