Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Qpsmtpd::Command(3)   User Contributed Perl Documentation  Qpsmtpd::Command(3)

NAME
       Qpsmtpd::Command	- parse	arguments to SMTP commands

DESCRIPTION
       Qpsmtpd::Command	provides just one public sub routine: parse().

       This sub	expects	two or three arguments.	The first is the name of the
       SMTP command (such as HELO, MAIL, ...). The second must be the
       remaining of the	line the client	sent.

       If no third argument is given (or it's not a reference to a CODE) it
       parses the line according to RFC	1869 (SMTP Service Extensions) for the
       MAIL and	RCPT commands and splitting by spaces (" ") for	all other.

       Any module can supply it's own parsing routine by returning a sub
       routine reference from a	hook_*_parse. This sub will be called with
       $self, $cmd and $line.

       On successfull parsing it MUST return OK	(the constant from
       Qpsmtpd::Constants) success as first argument and a list	of values,
       which will be the arguments to the hook for this	command.

       If parsing failed, the second returned value (if	any) will be returned
       to the client as	error message.

EXAMPLE
       Inside a	plugin

	sub hook_unrecognized_command_parse {
	   my ($self, $transaction, $cmd) = @_;
	   return (OK, \&bdat_parser) if ($cmd eq 'bdat');
	}

	sub bdat_parser	{
	   my ($self,$cmd,$line) = @_;
	   # ..	do something with $line...
	   return (DENY, "Invalid arguments")
	     if	$some_reason_why_there_is_a_syntax_error;
	   return (OK, @args);
	}

	sub hook_unrecognized_command {
	   my ($self, $transaction, $cmd, @args) = @_;
	   return (DECLINED) if	($self->qp->connection->hello eq 'helo');
	   return (DECLINED) unless ($cmd eq 'bdat');
	   ....
	}

perl v5.24.1			  2013-12-17		   Qpsmtpd::Command(3)

NAME | DESCRIPTION | EXAMPLE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Qpsmtpd::Command&sektion=3&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help