You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by hg...@apache.org on 2001/06/19 18:35:24 UTC

cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp14_worker.c

hgomez      01/06/19 09:35:23

  Modified:    jk/native/common jk_ajp14_worker.c
  Log:
  Minor fixes.
  init info (web_server_name/secret_key) need to be
  stored locally (if not there're lost by pool activity)
  also correct logon phase (didn't get the cmd byte)
  
  Revision  Changes    Path
  1.6       +31 -3     jakarta-tomcat-connectors/jk/native/common/jk_ajp14_worker.c
  
  Index: jk_ajp14_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14_worker.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jk_ajp14_worker.c	2001/06/18 14:15:27	1.5
  +++ jk_ajp14_worker.c	2001/06/19 16:35:20	1.6
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: AJP14 next generation Bi-directional protocol.             *
    * Author:      Henri Gomez <hg...@slib.fr>                               *
  - * Version:     $Revision: 1.5 $                                           *
  + * Version:     $Revision: 1.6 $                                           *
    ***************************************************************************/
   
   #include "jk_context.h"
  @@ -111,10 +111,20 @@
      	aw = pThis->worker_private;
   
   	/* Set Secret Key (used at logon time) */	
  -	aw->login->secret_key = jk_get_worker_secret_key(props, aw->name);
  +	aw->login->secret_key = strdup(jk_get_worker_secret_key(props, aw->name));
   
  +	if (aw->login->secret_key == NULL) {
  +		jk_log(l, JK_LOG_ERROR, "can't malloc secret_key\n");
  +		return JK_FALSE;
  +	}
  +	
   	/* Set WebServerName (used at logon time) */
  -	aw->login->web_server_name = we->server_name;
  +	aw->login->web_server_name = strdup(we->server_name);
  +
  +	if (aw->login->web_server_name == NULL) {
  +		jk_log(l, JK_LOG_ERROR, "can't malloc web_server\n");
  +		return JK_FALSE;
  +	}
   
   	if (get_endpoint(pThis, &je, l) == JK_FALSE)
   		return JK_FALSE;
  @@ -140,6 +150,17 @@
   	ajp_worker_t *aw = (*pThis)->worker_private;
   
   	if (aw->login) {
  +
  +		if (aw->login->web_server_name) {
  +			free(aw->login->web_server_name);
  +			aw->login->web_server_name = NULL;
  +		}
  +
  +		if (aw->login->secret_key) {
  +			free(aw->login->secret_key);
  +			aw->login->secret_key = NULL;
  +		}
  +
   		free(aw->login);
   		aw->login = NULL;
   	}
  @@ -157,6 +178,8 @@
   					   jk_msg_buf_t	   *msg,
   					   jk_logger_t     *l)
   {
  +	int	cmd;
  +
   	jk_login_service_t *jl = ae->worker->login;
   
   	ajp14_marshal_login_init_into_msgb(msg, jl, l);
  @@ -169,6 +192,11 @@
   	jk_log(l, JK_LOG_DEBUG, "Into ajp14:logon - wait init reply\n");
   
   	jk_b_reset(msg);
  +
  +	if ((cmd = jk_b_get_byte(msg)) != AJP14_LOGSEED_CMD) {
  +		jk_log(l, JK_LOG_ERROR, "Into ajp14:logon - awaited command %d, received command %d\n", AJP14_LOGSEED_CMD, cmd);
  +		return JK_FALSE;
  +	}
   
   	if (ajp_connection_tcp_get_message(ae, msg, l) != JK_TRUE)
   		return JK_FALSE;