doveadm-util.c revision 530b5909a99e7575156496f1b8e4d1ff5b058484
/* Copyright (c) 2009-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "net.h"
#include "time-util.h"
#include "master-service.h"
#include "module-dir.h"
#include "doveadm-settings.h"
#include "doveadm-mail.h"
#include "doveadm-util.h"
#include <time.h>
#include <dirent.h>
#include <ctype.h>
#define DOVEADM_TCP_CONNECT_TIMEOUT_SECS 30
void doveadm_load_modules(void)
{
struct module_dir_load_settings mod_set;
/* some doveadm plugins have dependencies to mail plugins. we can load
only those whose dependencies have been loaded earlier, the rest are
ignored. */
}
void doveadm_unload_modules(void)
{
}
bool doveadm_has_unloaded_plugin(const char *name)
{
struct dirent *d;
const char *plugin_name;
/* first check that it's not actually loaded */
return FALSE;
}
return FALSE;
plugin_name += 8;
break;
}
}
return found;
}
{
}
const char *doveadm_plugin_getenv(const char *name)
{
const char *const *envs;
unsigned int i, count;
return NULL;
for (i = 0; i < count; i += 2) {
return envs[i+1];
}
return NULL;
}
static int
{
unsigned int ips_count;
if (ret != 0) {
i_fatal("Lookup of host %s failed: %s",
}
if (fd == -1) {
i_fatal("connect(%s:%u) failed: %m",
}
alarm(0);
return fd;
}
{
const char *host;
i_fatal("Port not known for %s. Either set proxy_port "
}
}
int doveadm_connect_with_default_port(const char *path,
{
int fd;
/* we'll assume UNIX sockets typically have an absolute path,
or at the very least '/' somewhere. */
else {
if (fd == -1)
}
return fd;
}
int doveadm_connect(const char *path)
{
return doveadm_connect_with_default_port(path, 0);
}
int i_strccdascmp(const char *a, const char *b)
{
while(*a != '\0' && *b != '\0') {
if ((*a == ' ' || *a == '-') && *a != *b && *b != ' ' && *b != '-') {
if (i_toupper(*(a+1)) == *(b)) a++;
else break;
} else if ((*b == ' ' || *b == '-') && *a != *b && *a != ' ' && *a != '-') {
if (*a == i_toupper(*(b+1))) b++;
else break;
} else if (!((*a == ' ' || *a == '-') &&
(*b == ' ' || *b == '-')) &&
(*a != *b)) break;
a++; b++;
}
return *a-*b;
}