Can compile for dovecot-2.3.2.1
ezPappi opened this issue · comments
make
cc -Wall -W -shared -fPIC -DHAVE_CONFIG_H -I../dovecot-2.3.2.1 -I../dovecot-2.3.2.1/src/lib -I../dovecot-2.3.2.1/src/lib-index -I../dovecot-2.3.2.1/src/lib-mail -I../dovecot-2.3.2.1/src/lib-storage -I../dovecot-2.3.2.1/src/lib-storage/index -I../dovecot-2.3.2.1/src/lib-storage/index/maildir -L/usr/lib/dovecot drac-plugin-new.c -o drac_plugin.so -ldrac
drac-plugin-new.c: In function ‘drac_mail_user_created’:
drac-plugin-new.c:65:13: error: ‘struct mail_user’ has no member named ‘remote_ip’
if (user->remote_ip == NULL) {
^~
In file included from drac-plugin-new.c:16:
drac-plugin-new.c:71:25: error: ‘struct mail_user’ has no member named ‘remote_ip’
if(IPADDR_IS_V4(user->remote_ip) || IPADDR_IS_V6(user->remote_ip)) {
^~
../dovecot-2.3.2.1/src/lib/net.h:41:28: note: in definition of macro ‘IPADDR_IS_V4’
#define IPADDR_IS_V4(ip) ((ip)->family == AF_INET)
^~
drac-plugin-new.c:71:58: error: ‘struct mail_user’ has no member named ‘remote_ip’
if(IPADDR_IS_V4(user->remote_ip) || IPADDR_IS_V6(user->remote_ip)) {
^~
../dovecot-2.3.2.1/src/lib/net.h:42:28: note: in definition of macro ‘IPADDR_IS_V6’
#define IPADDR_IS_V6(ip) ((ip)->family == AF_INET6)
^~
drac-plugin-new.c:73:25: error: ‘struct mail_user’ has no member named ‘remote_ip’
memcpy(&ip, user->remote_ip, sizeof(ip));
^~
make: *** [Makefile:17: drac_plugin.so] Error 1
Fixed that with following changes to the drac_mail_user_created function:
static void drac_mail_user_created(struct mail_user *user)
{
const char *dractout_str;
char *ep;
if (user->conn.remote_ip == NULL) {
i_debug("%s Not a remote login", __FUNCTION__);
return;
}
/* check address family */
if(IPADDR_IS_V4(user->conn.remote_ip) || IPADDR_IS_V6(user->conn.remote_ip)) {
/* get remote IP address... uum... */
memcpy(&ip, user->conn.remote_ip, sizeof(ip));
/* get DRAC server name */
drachost = mail_user_plugin_getenv(user, "dracdserver");
if(drachost == NULL) {
drachost = DRAC_HOST;
}
/* get timeout secs */
dractout_str = mail_user_plugin_getenv(user, "dracdtimeout");
if(dractout_str == NULL) {
dractout = DRAC_TIMEOUT_SECS;
} else {
dractout = strtoul(dractout_str, &ep, 10);
/* bad format -> use default value */
if(ep != NULL && *ep != '\0') {
i_warning("%s: bad dracdtimeout (%s). using default %d",
__FUNCTION__, dractout_str, DRAC_TIMEOUT_SECS);
dractout = DRAC_TIMEOUT_SECS;
}
}
i_debug("%s: dracdserver=%s, timeout=%ldsecs", __FUNCTION__,
drachost, dractout);
/* connect to DRAC server */
drac_timeout(NULL);
#undef timeout_add
#define timeout_add(msecs, callback, context)
timeout_add(msecs, FILE, LINE, callback, context)
to_drac = timeout_add(1000*dractout, drac_timeout, NULL);
} else {
i_error("%s: Only IPv4 and IPv6 addresses are supported", FUNCTION);
}
}
Fixed in 4984568