Qsmtp  0.30dev
Macros | Functions | Variables
syntax.c File Reference

syntax checking helper functions More...

#include <qsmtpd/syntax.h>
#include <log.h>
#include <netio.h>
#include <qsmtpd/commands.h>
#include <qsmtpd/qsmtpd.h>
#include <string.h>
#include <syslog.h>

Macros

#define MAXBADCMDS   5
 

Functions

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

Variables

int badcmds
 

Detailed Description

syntax checking helper functions

This file contains functions to needed to handle syntax errors in input commands.

Macro Definition Documentation

#define MAXBADCMDS   5

maximum number of illegal commands in a row

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