Example #1
0
static int
folder_pop_get_authority (mu_folder_t folder, mu_authority_t *pauth)
{
  int status = 0;
  if (folder->authority == NULL)
    {
      /* assert (folder->url); */
      if (folder->url == NULL)
	return EINVAL;

      if (folder->url->auth == NULL
	  || strcmp (folder->url->auth, "*") == 0)
	{
	  status = mu_authority_create (&folder->authority, NULL, folder);
	  mu_authority_set_authenticate (folder->authority, _pop_user, folder);
	}
      /*
	"+apop" could be supported.
	Anything else starting with "+" is an extension mechanism.
	Without a "+" it's a SASL mechanism.
      */
      else if (mu_c_strcasecmp (folder->url->auth, "+APOP") == 0)
	{
	  status = mu_authority_create (&folder->authority, NULL, folder);
	  mu_authority_set_authenticate (folder->authority, _pop_apop, folder);
	}
      else
	{
	  status = MU_ERR_BAD_AUTH_SCHEME;
	}
    }
  if (pauth)
    *pauth = folder->authority;
  return status;
}
Example #2
0
static PyObject *
api_authority_create (PyObject *self, PyObject *args)
{
  int status;
  PyAuthority *py_auth;
  PyTicket *py_ticket;

  if (!PyArg_ParseTuple (args, "O!O!",
			 &PyAuthorityType, &py_auth,
			 &PyTicketType, &py_ticket))
    return NULL;

  status = mu_authority_create (&py_auth->auth, py_ticket->ticket, NULL);
  return _ro (PyInt_FromLong (status));
}