if ((r = (*authenticator)(idata)) != IMAP_AUTH_UNAVAIL) return r; authenticator++;
methods = safe_strdup (ImapAuthenticators); method = methods;  while (method) { comma = strchr (method, ','); if (comma) *comma++ = '\0'; dprint (2, (debugfile, "imap_authenticate: Trying method %s\n", method)); authenticator = imap_authenticators;  while (authenticator->authenticate) { if (!authenticator->method || !ascii_strcasecmp (authenticator->method, method)) if ((r = authenticator->authenticate (idata, method)) != IMAP_AUTH_UNAVAIL) { FREE (&methods); return r; }  authenticator++; }  method = comma; }  FREE (&methods); } else {  dprint (2, (debugfile, "imap_authenticate: Using any available method.\n")); authenticator = imap_authenticators;  while (authenticator->authenticate) { if ((r = authenticator->authenticate (idata, NULL)) != IMAP_AUTH_UNAVAIL) return r; authenticator++; }
int imap_authenticate (IMAP_DATA* idata){  imap_auth_t* authenticator = imap_authenticators;  int r = -1;  while (*authenticator)  {    if ((r = (*authenticator)(idata)) != IMAP_AUTH_UNAVAIL)      return r;    authenticator++;  }  return r;}