Problem with sync_client

DEMBKOWSKI, Henryk (Henryk) hdembkowski at alcatel-lucent.com
Tue Dec 16 12:19:49 EST 2008


Hi,

I am trying to get working replication between two message servers, both with new Cyrus 2.3.13. 

>From logs it seems that sync_client "hangs up". I have the following functions flows for sync_client:

- main() calls replica_connect() to open connection to server

- replica_connect() calls backend_connect()

- backend_connect() calls ask_capability() since "banner is capability response"
  from protocol definition for "csync"

	static struct protocol_t csync_protocol =
	{ "csync", "csync",
	  { 1, "* OK" },  <==========================
	  { NULL, NULL, "* OK", NULL,
	    { { "* SASL ", CAPA_AUTH },
	      { "* STARTTLS", CAPA_STARTTLS },
	      { NULL, 0 } } },
	  { "STARTTLS", "OK", "NO", 0 },
	  { "AUTHENTICATE", INT_MAX, 0, "OK", "NO", "+ ", "*", NULL, 0 },
	  { "NOOP", NULL, "OK" },
	  { "EXIT", NULL, "OK" }
	};

  Below code from backend_connect() - ask_capability() is called with automatic==AUTO_BANNER

	    if (prot->banner.is_capa) {
	        /* try to get the capabilities from the banner */
	        mechlist = ask_capability(ret->out, ret->in, prot,
	                                  &ret->capability, AUTO_BANNER);
	        if (mechlist || ret->capability) {
	            /* found capabilities in banner -> don't ask */
	            ask = 0;
	        }
	    }

- sync_server returns the following banner  "OK ms04 Cyrus sync server v2.3.13"

- ask_capability() tries to find capabilities (from protocol definition for "csync") in banner. 
  So it tries to find "* SASL " or  "* STARTTLS" in "* OK ms04 Cyrus sync server v2.3.13"
  And it fails.

- therefore function backend_connect() calls once again ask_capability() - this time with automatic==AUTO_NO

	    if (ask) {
	        /* get the capabilities */
	        mechlist = ask_capability(ret->out, ret->in, prot,
	                                  &ret->capability, AUTO_NO);
	    }

- however this time it seems that function ask_capability() "hangs up". It never ends. 
  It tries to read stream but probably sync_server doesn't send anything.

	    do {
	        if (prot_fgets(str, sizeof(str), pin) == NULL) break;    <================================

	        /* look for capabilities in the string */
	        for (c = prot->capa_cmd.capa; c->str; c++) {
	            if ((tmp = strstr(str, c->str)) != NULL) {
	                *capa = *capa | c->flag;
	
	                if (c->flag == CAPA_AUTH) {
	                    if (prot->capa_cmd.parse_mechlist)
	                        ret = prot->capa_cmd.parse_mechlist(str, prot);
	                    else
	                        ret = xstrdup(tmp+strlen(c->str));
	                }
	            }
	        }
	        if (!resp) {
	            /* multiline response with no distinct end (IMAP banner) */
	            prot_NONBLOCK(pin);
	        }
	
	        /* look for the end of the capabilities */
	    } while (!resp || strncasecmp(str, resp, strlen(resp)));


Do you know what can be wrong?



Kind Regards,
Henryk


More information about the Info-cyrus mailing list