You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by na...@apache.org on 2001/02/06 03:08:43 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/request JDBCRealm.java

nacho       01/02/05 18:08:43

  Modified:    src/share/org/apache/tomcat/request Tag: tomcat_32
                        JDBCRealm.java
  Log:
  Bugzilla Bugs #307  #407  #532
  
  *Authentication failes using the JDBCRealm with Sybase ASE 11.9.2
  for Linux BugRat Report#560
  
  reported by: a.schweitz@2bconnected.nl (Allan Schweitz)
  
  *JDBCRealm: Call trim() on names and roles read
  out of database BugRat Report#707
  
  reported by arabung@experient.com (Adam Rabung)
  
  *JDBCRealm auth fails using interbase interclient
  
  reported by labiance@altavista.net
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.6   +10 -8     jakarta-tomcat/src/share/org/apache/tomcat/request/Attic/JDBCRealm.java
  
  Index: JDBCRealm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/Attic/JDBCRealm.java,v
  retrieving revision 1.9.2.5
  retrieving revision 1.9.2.6
  diff -u -r1.9.2.5 -r1.9.2.6
  --- JDBCRealm.java	2000/12/28 23:59:31	1.9.2.5
  +++ JDBCRealm.java	2001/02/06 02:08:43	1.9.2.6
  @@ -299,7 +299,7 @@
               ResultSet rs1 = preparedAuthenticate.executeQuery();
               boolean found = false;
               if (rs1.next()) {
  -                if (credentials.equals(rs1.getString(1))) {
  +                if (credentials.equals(rs1.getString(1).trim())) {
                       if (debug >= 2)
                           log(sm.getString("jdbcRealm.authenticateSuccess",
                                    username));
  @@ -364,7 +364,7 @@
             Vector vrol=new Vector();
   
             while (rs.next()) {
  -              vrol.addElement(rs.getString(1));
  +              vrol.addElement(rs.getString(1).trim());
             }
   
             String[] res=new String[vrol.size()];
  @@ -448,12 +448,14 @@
           String user=(String)cred.get("username");
           String password=(String)cred.get("password");
   	
  -	if( authenticate( user, password ) ) {
  -     	    if( debug > 0 ) log( "Auth ok, user=" + user );
  -	    req.setRemoteUser( user );
  -            Context ctx = req.getContext();
  -            if (ctx != null)
  -                req.setAuthType(ctx.getAuthMethod());
  +	if( user !=null && password !=null ){
  +            if ( authenticate( user, password ) ) {
  +                if( debug > 0 ) log( "Auth ok, user=" + user );
  +                req.setRemoteUser( user );
  +                Context ctx = req.getContext();
  +                if (ctx != null)
  +                    req.setAuthType(ctx.getAuthMethod());
  +            }
   	}
   	return 0;
       }