You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Ignacio J. Ortega" <na...@siapi.es> on 2001/02/19 12:45:34 UTC
RE: [PATCH] JDBCRealm on Tomcat 3.2.1 does not work with MS SQL S
erver
It's done on CVS, about 2 weeks ago..
It's solved for 3.2.2 and up, and in 4.0 and up...
Saludos ,
Ignacio J. Ortega
> -----Mensaje original-----
> De: Larry Rogers [mailto:rogersl@sprynet.com]
> Enviado el: lunes 19 de febrero de 2001 6:39
> Para: tomcat-dev@jakarta.apache.org
> Asunto: [PATCH] JDBCRealm on Tomcat 3.2.1 does not work with MS SQL
> Server
>
>
> This is my first patch to submit. I'm sorry I don't have a
> diff file to
> go with it.
>
> Anyway, when using Tomcat 3.2.1 JDBCRealm with Microsoft SQL
> Server, the
> credential check fails when the correct username and password are
> submitted by the user. After Tomcat receives the credentials
> from the
> user, it queries the user table in the database for what the password
> should be for the username received from the browser. When
> it compares
> the password from the browser to the one from the database, the
> comparison does not pass, even though the password is correct.
>
> This is caused by the way SQL Server returns a string with trailing
> spaces for the password query. The problem occurs for column type of
> char or varchar as well.
>
> The patch involves changing the following line from JDBCRealm.java
>
> if (credentials.equals(rs1.getString(1))) {
>
> to read as follows
>
> if (credentials.equals(rs1.getString(1).trim())) {
>
> This will trim the padded spaces from the password received from SQL
> Server before comparing it to the password submitted by the user, and
> the comparison will pass.
>
> Thanks,
> Larry
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-dev-help@jakarta.apache.org
>
>