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

Richard Sharpe realrichardsharpe at
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",

                                                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 read error = Connection reset by peer.

and the is not very useful.

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

Richard Sharpe

More information about the samba-technical mailing list