Qsmtp  0.30dev
Functions | Variables
syntax.h File Reference

functions to handle syntax error in the commands an SMTP client sends More...

Go to the source code of this file.

Functions

int hasinput (const int quitloop)
 check if there is already more input from network available More...
 
void check_max_bad_commands (void)
 check if the amount of bad commands was reached More...
 
void sync_pipelining (void)
 check if there are already commands in the pipeline More...
 
void wait_for_quit (void)
 run the SMTP command loop but only accept QUIT More...
 

Variables

int badcmds
 

Detailed Description

functions to handle syntax error in the commands an SMTP client sends

Function Documentation

void check_max_bad_commands ( void  )

check if the amount of bad commands was reached

If the client has sent too many consecutive bad commands the connection will be terminated.

int hasinput ( const int  quitloop)

check if there is already more input from network available

Parameters
quitloopif set the command will loop until the client disconnects if there is input data
Returns
error code if data is available or error happens
Return values
0if no input
EBOGUSif quitloop is 0 and there is input

This function should only be used in situations where the client should NOT have sent any more data, i.e. where he must wait for our reply before sending more. This is a sign of a broken SMTP engine on the other side, the input should not be used anymore.

This function will return an error code regardless of the setting of quitloop when something on our side goes wrong.

void sync_pipelining ( void  )

check if there are already commands in the pipeline

This function should be called directly after the last command in a pipelined command group, before the command sends out it's response. If there is something in the command pipeline all following commands will be handled as errors until the client disconnects.

This function will only return if everything is fine.

This may be called regardless if the session is using ESMTP or not.

void wait_for_quit ( void  )

run the SMTP command loop but only accept QUIT

This will reject all commands but quit with "bad sequence of commands", possibly closing the connection if seeing too many of them.

Variable Documentation

int badcmds

bad commands in a row