+ /*
+ * Determine the IP-Adress that the client used to reach us
+ * and the hostname associated with that address
+ */
+ if (!getsockname(afd, (struct sockaddr *) &server, &s_length))
+ {
+ csp->my_ip_addr_str = strdup(inet_ntoa(server.sin_addr));
+
+ host = gethostbyaddr((const char *)&server.sin_addr,
+ sizeof(server.sin_addr), AF_INET);
+ if (host == NULL)
+ {
+ log_error(LOG_LEVEL_ERROR, "Unable to get my own hostname: %E\n");
+ }
+ else
+ {
+ csp->my_hostname = strdup(host->h_name);
+ }
+ }
+