You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ch...@apache.org on 2001/06/24 19:06:03 UTC

cvs commit: jakarta-james/src/xdocs/stylesheets project.xml

charlesb    01/06/24 10:06:03

  Modified:    src/java/org/apache/james/nntpserver AuthState.java
                        NNTPHandler.java NNTPServer.java
               src/xdocs index.xml
               src/xdocs/stylesheets project.xml
  Log:
  Fixed NNTP auth
  
  Revision  Changes    Path
  1.2       +21 -5     jakarta-james/src/java/org/apache/james/nntpserver/AuthState.java
  
  Index: AuthState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/AuthState.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AuthState.java	2001/05/15 14:41:32	1.1
  +++ AuthState.java	2001/06/24 17:06:00	1.2
  @@ -26,22 +26,38 @@
       private final UsersRepository repo;
       private String user;
       private String password;
  +    private boolean userSet = false;
  +    private boolean passwordSet = false;
  +
       public AuthState(boolean requiredAuth,UsersRepository repo) {
           this.requiredAuth = requiredAuth;
           this.repo = repo;
       }
   
       public boolean isAuthenticated() {
  -        if ( requiredAuth )
  -            return repo.test(user,password);
  -        else
  +        if ( requiredAuth ) {
  +            if  (userSet && passwordSet ) {
  +                return repo.test(user,password);
  +            } else {
  +                return false;
  +            }
  +	} else {
               return true;
  +        }
       }
  +
       public void setUser(String user) {
  -        this.user = user;
  +        if (user != null && user.trim().length() != 0) {
  +            this.user = user;
  +            userSet = true;
  +        }
           this.password = null;
       }
  +
       public void setPassword(String password) {
  -        this.password = password;
  +        if (password != null && password.trim().length() != 0) {
  +            this.password = password;
  +            passwordSet = true;
  +        }
       }
   }
  
  
  
  1.2       +18 -6     jakarta-james/src/java/org/apache/james/nntpserver/NNTPHandler.java
  
  Index: NNTPHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/NNTPHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPHandler.java	2001/05/15 14:41:32	1.1
  +++ NNTPHandler.java	2001/06/24 17:06:01	1.2
  @@ -63,6 +63,8 @@
   public class NNTPHandler extends BaseConnectionHandler
       implements ConnectionHandler, Composable, Configurable, Target {
   
  +    private final static boolean DEEP_DEBUG = true;
  +
       // timeout controllers
       private TimeScheduler scheduler;
   
  @@ -80,11 +82,6 @@
       private NNTPGroup group;
       private NNTPRepository repo;
   
  -    public void configure( Configuration configuration ) throws ConfigurationException {
  -        super.configure(configuration);
  -        authRequired=configuration.getChild("authRequired").getValueAsBoolean(false);
  -        authState = new AuthState(authRequired,users);
  -    }
   
       public void compose( final ComponentManager componentManager )
           throws ComponentException
  @@ -99,6 +96,17 @@
               .lookup("org.apache.james.nntpserver.repository.NNTPRepository");
       }
   
  +
  +    public void configure( Configuration configuration )
  +           throws ConfigurationException {
  +        super.configure(configuration);
  +        authRequired =
  +            configuration.getChild("authRequired").getValueAsBoolean(false);
  +        getLogger().debug("Auth required state is :" + authRequired);
  +        authState = new AuthState(authRequired,users);
  +    }
  +
  +
       public void handleConnection( Socket connection ) throws IOException {
           try {
               this.socket = connection;
  @@ -171,8 +179,12 @@
           final String command = tokens.nextToken();
   
           //System.out.println("allowed="+isAllowed(command)+","+authState.isAuthenticated());
  -        if ( isAllowed(command) == false )
  +        if (! isAllowed(command) ){
  +	    if (DEEP_DEBUG) {
  +		getLogger().debug("Command not allowed.");
  +	    }
               return true;
  +	}
           if ( command.equalsIgnoreCase("MODE") && tokens.hasMoreTokens() &&
                tokens.nextToken().equalsIgnoreCase("READER") )
               doMODEREADER();
  
  
  
  1.2       +1 -1      jakarta-james/src/java/org/apache/james/nntpserver/NNTPServer.java
  
  Index: NNTPServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/NNTPServer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPServer.java	2001/05/15 14:41:32	1.1
  +++ NNTPServer.java	2001/06/24 17:06:01	1.2
  @@ -47,7 +47,7 @@
           if( useTLS.equals( "TRUE" ) )
               m_serverSocketType = "ssl";
   
  -        super.configure( configuration.getChild( "nntphandler" ) );
  +        super.configure( configuration.getChild( "handler" ) );
           getLogger().info("configured NNTPServer to run at : "+m_port);
       }
   
  
  
  
  1.3       +1 -1      jakarta-james/src/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/xdocs/index.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- index.xml	2001/05/21 12:13:21	1.2
  +++ index.xml	2001/06/24 17:06:02	1.3
  @@ -3,7 +3,7 @@
   <document>
   
    <properties>
  -  <title>Java Apache Mail Enterprise Server</title>
  +  <title>- Overview</title>
     <author email="sergek@lokitech.com">Serge Knystautas</author>
    </properties>
   
  
  
  
  1.4       +1 -1      jakarta-james/src/xdocs/stylesheets/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/xdocs/stylesheets/project.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- project.xml	2001/05/21 13:24:41	1.3
  +++ project.xml	2001/06/24 17:06:03	1.4
  @@ -2,7 +2,7 @@
   <project name="JAMES"
           href="http://jakarta.apache.org/james/">
   
  -    <title>The Jakarta James Site</title>
  +    <title>Jakarta James</title>
       <logo href="/images/james-logo.jpg">JAMES - Java Apache Mail Enterprise Server</logo>
   
       <body>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org