I made a try to implement a basic way of socket servers (pfinet and pflocal) overriding, as described below. Comments are solicited.
1) Add two new environment variables: SERVERS_SOCKET_LOCAL for the pf_local socket server and SERVERS_SOCKET_INET for the pf_inet server. The value of each variable should be set to a colon-separated list, and each element of the list is a file path that specifies a overriding server.
2) Hack _hurd_socket_server in "hurd/hurdsock.c" of Glibc to check for the two environment variables.
For example, when looking up the socket server of pf_inet domain, _hurd_socket_server first checks SERVERS_SOCKET_INET:
(1) if SERVERS_SOCKET_INET is not set or is set to null, then just queries and returns the port of the default pf_inet server as usual;
(2) or else, repeatedly tries querying each overriding server in the server list defined by SERVERS_SOCKET_INET, until the first existing overriding server is found (or none is found).
Two limitations of the implementation (which I think are not important) are:
(1) Since the library keeps all the server socket ports it has ever looked up, changes of the environmental variables after socket ports initiation will not take effect.
(2) _hurd_socket_server just try to find the first exsiting overriding server, but can not check whether the server is a correct socket server to skip invalid ones and try others behind (of course, the socket interface can always notify the user if current socket server is invalid).
I am also not quite sure on two issues:
(1) Should we disable the overrding mechanism for SUID or SGID processes (e.g. substituting __secure_getenv for getenv).
(2) If all overriding servers in the list are not present, need we return another error than EPFNOSUPPORT (I think it is enough to remind the user, though it means "Protocol family not supported". The libc interface will notify the user "Bad file descriptor") used previously when the default server is absent?
The modified hurd/hurdsock.c is attached to this mail. I have tested it with Glibc-2.5.