/ Zope / Apsis / Pound Mailing List / Archive / 2009 / 2009-12 / hostnames in poundctl

[ << ] [ >> ]

[ Re: [Pound Mailing List] BlueCoat vs Pound / ... ] [ Open letter to Robert Segall / Jean-Pierre van ... ]

hostnames in poundctl
Jason Kronstat <jason(at)directathletics.com>
2009-12-04 05:47:54 [ SNIP ]
Hi,

I'm not much of a C programmer but I wanted to see hostnames instead of
addresses in poundctl output and I'm finding this patch (to poundctl.c in
version 2.4.5) does the job on linux (ipv4). I figured I'm not the only one
who wants this (or perhaps one of you will tell me why this is a bad idea).

Thanks to Robert for a great program.

- Jason

$ diff -c  poundctl.c poundctl.c.orig
*** poundctl.c    2009-12-03 23:29:42.000000000 -0500
--- poundctl.c.orig    2009-12-03 23:29:34.000000000 -0500
***************
*** 84,94 ****
          port = 0;
          break;
      }
!
!     char hostname[NI_MAXHOST] = "";
!     getnameinfo(addr->ai_addr, addr->ai_addrlen, hostname, 1025, NULL, 0,
0);
!
!     snprintf(res, UNIX_PATH_MAX - 1, "%s:%d", hostname, port);
  #else
  #error "Pound needs inet_ntop()"
  #endif
--- 84,90 ----
          port = 0;
          break;
      }
!     snprintf(res, UNIX_PATH_MAX - 1, "%s:%d", buf, port);
  #else
  #error "Pound needs inet_ntop()"
  #endif


Shorter patch:

87,91c87
<
<     char hostname[NI_MAXHOST] = "";
<     getnameinfo(addr->ai_addr, addr->ai_addrlen, hostname, 1025, NULL, 0,
0);
<
<     snprintf(res, UNIX_PATH_MAX - 1, "%s:%d", hostname, port);
---
>     snprintf(res, UNIX_PATH_MAX - 1, "%s:%d", buf, port);

Attachments:  
text.html text/html 1544 Bytes

Re: [Pound Mailing List] hostnames in poundctl
Dave Steinberg <dave(at)redterror.net>
2009-12-04 16:29:39 [ SNIP ]
Jason Kronstat wrote:
> Hi,
> 
> I'm not much of a C programmer but I wanted to see hostnames instead of
> addresses in poundctl output and I'm finding this patch (to poundctl.c in
> version 2.4.5) does the job on linux (ipv4). I figured I'm not the only one
> who wants this (or perhaps one of you will tell me why this is a bad idea).
> 
> Thanks to Robert for a great program.

Could you make this optional, or at least add an option to disable it? 
Not everybody may have DNS configured for their internal names.

Regards,
-- 
Dave Steinberg
http://www.geekisp.com/
http://www.steinbergcomputing.com/

Re: [Pound Mailing List] hostnames in poundctl
Robert Segall <roseg(at)apsis.ch>
2009-12-07 17:19:49 [ SNIP ]
On Fri, 2009-12-04 at 10:29 -0500, Dave Steinberg wrote:
> Jason Kronstat wrote:
> > Hi,
> > 
> > I'm not much of a C programmer but I wanted to see hostnames instead of
> > addresses in poundctl output and I'm finding this patch (to poundctl.c in
> > version 2.4.5) does the job on linux (ipv4). I figured I'm not the only one
> > who wants this (or perhaps one of you will tell me why this is a bad idea).
> > 
> > Thanks to Robert for a great program.
> 
> Could you make this optional, or at least add an option to disable it? 
> Not everybody may have DNS configured for their internal names.
> 
> Regards,

Thank to the OP for the patch. I suspect we'll add this, with a run-time
flag to enable it rather than by default.
-- 
Robert Segall
Apsis GmbH
Postfach, Uetikon am See, CH-8707
Tel: +41-44-920 4904


MailBoxer