On the other hand, a simple program that performs `chroot("/var/spool/postfix")` and calls `getservbyname()` _works correctly_ on hirsute (C code in attachment):
crosser@pccross:~/src$ sudo ./getsrvname
[sudo] password for crosser:
s_name="smtp", s_port=25, s_proto="tcp"
Note though that in such form the the program does not try to use NSS, it just opens `/etc/services` directly. While postfix's `smtp` goes through nsswitch, as can be seen in the strace log from my previous attachment.
I did some more investigation, and did not find an explanation, but I am writing it here to maybe save somebody else some effort.
Postfix uses normal(?) `getservbyname( service, protocol)` in the file src/smtp/ smtp_connect. c line 363:
if ((sp = getservbyname( service, protocol)) == 0)
msg_ fatal(" unknown service: %s/%s", service, protocol);
and I see this message in the log.
On the other hand, a simple program that performs `chroot( "/var/spool/ postfix" )` and calls `getservbyname()` _works correctly_ on hirsute (C code in attachment):
crosser@ pccross: ~/src$ sudo ./getsrvname
[sudo] password for crosser:
s_name="smtp", s_port=25, s_proto="tcp"
Note though that in such form the the program does not try to use NSS, it just opens `/etc/services` directly. While postfix's `smtp` goes through nsswitch, as can be seen in the strace log from my previous attachment.