Michael Jumper created GUACAMOLE-505:
----------------------------------------

             Summary: Individual user query fails after two or more login 
history entries exist
                 Key: GUACAMOLE-505
                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-505
             Project: Guacamole
          Issue Type: Bug
          Components: guacamole-auth-jdbc-sqlserver
    Affects Versions: 0.9.14
            Reporter: Michael Jumper


[As reported on the mailing 
lists|https://lists.apache.org/thread.html/4bec430479b0363f55d471c7f9ed395dc536fc5aece012f3a39ed104@%3Cuser.guacamole.apache.org%3E],
 the SQL Server extension currently fails after any particular user has logged 
in two or more times. This is due to [a stray {{LEFT JOIN}} within the 
"selectOne" query specific to SQL 
Server|https://github.com/apache/guacamole-client/blob/1e1679e5cea0df69b26e7d78ff10e59f15d124e2/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml#L201]:

{code:xml}

    <!-- Select single user by username -->
    <select id="selectOne" resultMap="UserResultMap">

        SELECT
            [guacamole_user].user_id,
            [guacamole_user].username,
            password_hash,
            password_salt,
            password_date,
            disabled,
            expired,
            access_window_start,
            access_window_end,
            valid_from,
            valid_until,
            timezone,
            full_name,
            email_address,
            organization,
            organizational_role,
            (
                SELECT MAX(start_date)
                FROM [guacamole_user_history]
                WHERE [guacamole_user_history].user_id = 
[guacamole_user].user_id
            ) AS last_active
        FROM [guacamole_user]
        LEFT JOIN [guacamole_user_history] ON [guacamole_user_history].user_id 
= [guacamole_user].user_id
        WHERE
            [guacamole_user].username = #{username,jdbcType=VARCHAR}

    </select>
{code}

This {{LEFT JOIN}} should have been removed as part of commit 
[394a289|https://github.com/apache/guacamole-client/commit/394a289879dba9273f976a9174ad4eec45b674c2].



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to