fixes with incorrect data has been written to the port;
This commit is contained in:
parent
1facc7f484
commit
b833c9891e
13
src/main.c
13
src/main.c
@ -125,7 +125,7 @@ int main(int argc, char **argv)
|
|||||||
/* main loop */
|
/* main loop */
|
||||||
while(eport_read(stdin, msgbuf, msgbuflen) > 0) {
|
while(eport_read(stdin, msgbuf, msgbuflen) > 0) {
|
||||||
opt = eport_ejabberd_msgread(msgbuf, msgbuflen, &m);
|
opt = eport_ejabberd_msgread(msgbuf, msgbuflen, &m);
|
||||||
if(opt > 0) {
|
if(opt < 0) {
|
||||||
abort_parsing:
|
abort_parsing:
|
||||||
fprintf(stderr, "Error: message isn't valid.\nExiting.\n");
|
fprintf(stderr, "Error: message isn't valid.\nExiting.\n");
|
||||||
ssllib_free();
|
ssllib_free();
|
||||||
@ -140,7 +140,7 @@ int main(int argc, char **argv)
|
|||||||
/* connect to IMAPs */
|
/* connect to IMAPs */
|
||||||
if(tls_connect(imap_host, imap_port, &connection)) {
|
if(tls_connect(imap_host, imap_port, &connection)) {
|
||||||
fprintf(stderr, "Error: unable to connect to IMAPs.\n");
|
fprintf(stderr, "Error: unable to connect to IMAPs.\n");
|
||||||
opt = -1;
|
opt = 0;
|
||||||
} else {
|
} else {
|
||||||
opt = imap_auth(&connection, &m);
|
opt = imap_auth(&connection, &m);
|
||||||
tls_close(&connection);
|
tls_close(&connection);
|
||||||
@ -152,7 +152,7 @@ int main(int argc, char **argv)
|
|||||||
/* connect to SMTPs */
|
/* connect to SMTPs */
|
||||||
if(tls_connect(smtp_host, smtp_port, &connection)) {
|
if(tls_connect(smtp_host, smtp_port, &connection)) {
|
||||||
fprintf(stderr, "Error: unable to connect to SMTPs.\n");
|
fprintf(stderr, "Error: unable to connect to SMTPs.\n");
|
||||||
opt = -1;
|
opt = 0;
|
||||||
} else {
|
} else {
|
||||||
opt = smtp_checkuser(&connection, &m, smtp_host);
|
opt = smtp_checkuser(&connection, &m, smtp_host);
|
||||||
tls_close(&connection);
|
tls_close(&connection);
|
||||||
@ -164,7 +164,7 @@ int main(int argc, char **argv)
|
|||||||
case EJA_REMOVEUSER3:
|
case EJA_REMOVEUSER3:
|
||||||
/* still aren't supported by the program */
|
/* still aren't supported by the program */
|
||||||
fprintf(stderr, "Error: This type of message are not supported.\n");
|
fprintf(stderr, "Error: This type of message are not supported.\n");
|
||||||
opt = -1;
|
opt = 0;
|
||||||
break;
|
break;
|
||||||
case EJA_UNKNOWN:
|
case EJA_UNKNOWN:
|
||||||
default: /* something goes wrong with message */
|
default: /* something goes wrong with message */
|
||||||
@ -173,7 +173,10 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* finally, reply ... */
|
/* finally, reply ... */
|
||||||
eport_write(stdout, (char *)((int16_t *)&opt), sizeof(int16_t));
|
opt = ((int16_t)opt << 8) | (((int16_t)opt >> 8) & 0xff);
|
||||||
|
eport_write(stdout, (char *)(&opt), sizeof(int16_t));
|
||||||
|
/* clear the buffer */
|
||||||
|
memset(msgbuf, 0, msgbuflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssllib_free();
|
ssllib_free();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user