/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "llist.h"
#include "array.h"
#include "net.h"
#include "istream.h"
#include "mail-user.h"
#include "mail-error.h"
#include "mail-storage.h"
#include "imap-url.h"
#include "imap-msgpart-url.h"
#include "imap-urlauth-private.h"
#include "imap-urlauth-fetch.h"
#include "imap-urlauth-connection.h"
struct imap_urlauth_fetch_url {
char *url;
};
struct imap_urlauth_fetch {
unsigned int refcount;
void *context;
/* local urls */
unsigned int pending_requests;
struct {
char *url;
char *bodypartstruct;
char *error;
};
{
}
}
}
{
if (ufetch->pending_requests > 0)
}
{
}
struct imap_urlauth_fetch *
{
return ufetch;
}
{
}
{
return;
/* dont leave the connection in limbo; make sure continue is called */
if (ufetch->waiting_service)
}
{
}
static void
const char *error)
{
int ret;
T_BEGIN {
} T_END;
if (ret == 0) {
} else if (ret < 0) {
}
}
static void
{
int ret;
if (debug)
if (url_flags == 0)
/* fetch URL */
} else {
}
if (ret <= 0) {
if (ret == 0) {
if (debug)
}
}
/* fetch metadata */
if (success &&
(url_flags & IMAP_URLAUTH_FETCH_FLAG_BODYPARTSTRUCTURE) != 0) {
if (ret <= 0) {
if (ret == 0) {
if (debug)
}
}
}
/* if requested, read the message part the URL points to */
(url_flags & IMAP_URLAUTH_FETCH_FLAG_BINARY) != 0)) {
if (ret <= 0) {
if (ret == 0) {
if (debug)
}
}
}
i_debug("Fetched URLAUTH yielded empty result");
else {
}
}
return;
}
if (ret == 0) {
} else {
if (ret < 0)
}
}
static int
void *context)
{
(struct imap_urlauth_fetch *)context;
}
return 0;
}
}
/* report failure only once */
} else if (ret == 0) {
}
return ret;
}
{
/* parse the url */
if (mail_user->mail_debug)
return 1;
}
}
{
int ret = 0;
/* if access user and target user match, handle fetch request locally */
if (ufetch->waiting_local) {
} else T_BEGIN {
} T_END;
/* don't try to fetch remote URLs that are already known to fail access */
if (mail_user->mail_debug)
}
/* create request for url */
ret = -1;
}
if (ret >= 0)
return ret;
}
{
int ret;
return FALSE;
/* not currently waiting for anything */
return ufetch->pending_requests > 0;
}
/* we finished a request */
if (!ufetch->waiting_local) {
/* not waiting for local request handling */
return ufetch->pending_requests > 0;
}
/* finished local request */
}
/* handle pending remote reply */
if (ret < 0) {
return FALSE;
}
if (ret == 0) {
return TRUE;
}
}
/* handle pending local urls */
T_BEGIN {
} T_END;
if (ufetch->waiting_local)
return TRUE;
}
return ufetch->pending_requests > 0;
}
{
bool pending;
return pending;
}
{
return ufetch->pending_requests > 0;
}