smfi_setconn Function

Purpose

The smfi_setconn function sets the socket through which this filter can communicate with the sendmail command.

Syntax

#include <libmilter/mfapi.h>
int smfi_setconn(
char *oconn;
);

Description

The smfi_setconn function must be called before calling the smfi_main function.

The filters must not be run as root when communicating over UNIX or local domain sockets.

The permissions for UNIX or local sockets must be set to 0600 (read or write permission only for owner or group of sockets) or 0660 (read/write permission for the sockets owner and group). These permissions are useful if the sendmail RunAsUser option is used.

The permissions for a UNIX or local domain socket are determined by the umask, which must be set to 007 or 077. For operating systems like Solaris operating system that do not use permissions of the socket, place the socket in a protected directory.

Arguments

Table 1. Arguments
Item Description
oconn The address of the desired communication socket. The address must be a NULL-terminated string in proto:address format:

* {unix|local}:/path
/to/file -- A named pipe.
* inet:port
@{hostname|ip-address} -- An IPV4 socket.
* inet6:port
@{hostname|ip-address} -- An IPV6 socket. 

Return values

The smfi_setconn function does not fail, if it is an invalid address. However, the smfi_setconn function fails to set the socket if there is no memory. The failure is detected only in smfi_main function.

Related information

libmilter_smfi_main.html