On Thu, Dec 31, 2009 at 13:13 +0000, Michael Shalayeff wrote:
> On Wed, Dec 30, 2009 at 07:23:00PM +0000, konrad merz wrote:
> > Hey,
> > 
> > during writing on icb (client) I discoverd a bug by sending /topic w/o an
> > argument to the daemon, which leads to a segfault.
> 
> i do not think we should wait till this gets "reimplemented"
> and fix it first. then we can wait till it's "reimplemented"

then fix it everywhere not in one place. apart from that it's not
clear if returning "No topic set for %s" is supported by the existing
clients.

as it is, this diff makes no sense at all.

> i do not see anything wrong w/ the fix unless mikeb can
> argue otherwise...
> 
> > The segfault of one process leads to a endless loop of the dns which allways
> > returns to the 'dns read'.
> 
> yes the exit is better since any kind of failure indicates problem
> at the parent process... (short read or failure or eof)
> 
> Index: usr.sbin/icbd/cmd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/icbd/cmd.c,v
> retrieving revision 1.19
> diff -u -p -r1.19 cmd.c
> --- usr.sbin/icbd/cmd.c       23 Jun 2009 13:39:33 -0000      1.19
> +++ usr.sbin/icbd/cmd.c       30 Dec 2009 19:06:18 -0000
> @@ -227,9 +227,15 @@ icb_cmd_topic(struct icb_cmdarg *ca)
>       char buf[ICB_MAXGRPLEN + ICB_MAXTOPICLEN + 25];
>       struct icb_group *ig = ca->sess->group;
>  
> -     if (strlen(ca->arg) == 0) {
> -             (void)snprintf(buf, sizeof buf, "Topic for %s is \"%s\"",
> -                 ig->name, ig->topic);
> +     if (ca->arg == NULL) {
> +             if (strlen(ig->topic) > 0)
> +                     (void)snprintf(buf, sizeof buf,
> +                         "Topic for %s is \"%s\"",
> +                         ig->name, ig->topic);
> +             else
> +                     (void)snprintf(buf, sizeof buf, "No topic set for %s",
> +                         ig->name);
> +             
>               icb_status(ca->sess, STATUS_TOPIC, buf);
>               return;
>       }
> Index: usr.sbin/icbd/dns.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/icbd/dns.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 dns.c
> --- usr.sbin/icbd/dns.c       23 Jun 2009 13:39:33 -0000      1.1
> +++ usr.sbin/icbd/dns.c       30 Dec 2009 19:06:18 -0000
> @@ -114,7 +114,7 @@ dns_dispatch(int fd, short event, void *
>  
>       if (read(fd, &ss, ss_len) != ss_len) {
>               syslog(LOG_ERR, "dns read: %m");
> -             return;
> +             exit(1);
>       }
>  
>       if ((gerr = getnameinfo(sa, sa->sa_len,

Reply via email to