On Sun, Oct 17, 2021 at 06:40:47PM +1300, Peter wrote:

> Just had someone come into the IRC chat with this issue and I was able 
> to reproduce it quite easily, this is with Postfix 3.6.2.  If your 
> /etc/services has smtps listed but not submissions (or vice-versa) and 
> you uncomment or add the relevant section to master.cf then postfix 
> gives an error like the following at startup:
> 
> Oct 17 18:28:59 CentOS8 postfix/master[79810]: fatal: 
> 127.0.0.1:submissions: Servname not supported for ai_socktype
> Oct 17 18:29:00 CentOS8 postfix/master[79809]: fatal: daemon 
> initialization failure
> Oct 17 18:29:01 CentOS8 postfix/postfix-script[79811]: fatal: mail 
> system startup failed

The feature appears to have been released in an incomplete form.
I don't see any code in Postfix to actually use "known_tcp_ports"
to load the underlying hash table.

Also, while numeric service names work with getaddrinfo(3), I
don't believe they work with with getservbyname(3):

    --- a/src/posttls-finger/posttls-finger.c
    +++ b/src/posttls-finger/posttls-finger.c
    @@ -1495 +1496 @@ static char *parse_destination(char *destination, char 
*def_service,
    -       if ((sp = getservbyname(service, protocol)) != 0)
    +       if ((sp = getservbyname(filter_known_tcp_port(service), protocol)) 
!= 0)
    --- a/src/smtp/smtp_connect.c
    +++ b/src/smtp/smtp_connect.c
    @@ -363 +364 @@ static char *smtp_parse_destination(char *destination, char 
*def_service,
    -       if ((sp = getservbyname(service, protocol)) == 0)
    +       if ((sp = getservbyname(filter_known_tcp_port(service), protocol)) 
== 0)
    --- a/src/util/find_inet.c
    +++ b/src/util/find_inet.c
    @@ -92 +93 @@ int     find_inet_port(const char *service, const char 
*protocol)
    -       if ((sp = getservbyname(service, protocol)) == 0)
    +       if ((sp = getservbyname(filter_known_tcp_port(service), protocol)) 
== 0)
    --- a/src/util/myaddrinfo.c
    +++ b/src/util/myaddrinfo.c
    @@ -284 +285 @@ static int find_service(const char *service, int socktype)
    -    if ((sp = getservbyname(service, proto)) != 0) {
    +    if ((sp = getservbyname(filter_known_tcp_port(service), proto)) != 0) {
    @@ -447 +448 @@ int     hostname_to_sockaddr_pf(const char *hostname, int 
pf,
    -    err = getaddrinfo(hostname, service, &hints, res);
    +    err = getaddrinfo(hostname, filter_known_tcp_port(service), &hints, 
res);
    @@ -563 +564 @@ int     hostaddr_to_sockaddr(const char *hostaddr, const 
char *service,
    -    err = getaddrinfo(hostaddr, service, &hints, res);
    +    err = getaddrinfo(hostaddr, filter_known_tcp_port(service), &hints, 
res);

So even when the parameter is properly loaded, only the last two changes
would work as expected.

-- 
    Viktor.

Reply via email to