get_peer_name on disconnected considered harmful to people reading log files ...

Richard Sharpe realrichardsharpe at gmail.com
Thu Jul 19 14:08:29 MDT 2012


Hi folks,

in lib/util_sock.c:read_fd_with_timeout we do the following on an error path:

                        if (readret == -1) {
                                save_errno = errno;
                                if (fd == get_client_fd()) {
                                        /* Try and give an error message
                                         * saying what client failed. */
                                        DEBUG(0,("read_fd_with_timeout: "
                                                "client %s read error = %s.\n",

get_peer_addr(fd,addr,sizeof(addr)),
                                                strerror(save_errno) ));

However, if the socket is disconnected because the client has gone
away, we get messages like this in the log file:

> Jul 16 09:02:24 xxxxyyyzzz smbd[24638]:   read_fd_with_timeout: client 0.0.0.0 read error = Connection reset by peer.

and the 0.0.0.0 is not very useful.

More useful would be to stash away the actual IP address when we
accept the socket and use that.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list