Re: problem with lirc over network under Ubuntu 18.04

Alec Leamas <[email protected]> Sun, 30 Dec 2018 21:50:07 +0100
Newsgroups gmane.comp.hardware.lirc
Message-ID <[email protected]>
On 30/12/18 16:02, André Weidemann wrote:
> On 29.12.2018 17:02, Alec Leamas wrote:

> I was about to give up when I decided to take a short look into the
> source of daemons/lircd.cpp.
> At line 850 it reads:
>     if (r != 0) {
>         log_perror_err("Name lookup failure connecting to %s",
>                    peer->host);
>         goto errexit;
>     }
> 

> According to this line "peer->host" must contain "192.168.3.125V" Which
> could explain the lookup failure.

> I dug a bit more and might have found a fix...
> Applying below patch lets lircd connect to the remote host:
> 
> --- daemons/lircd.cpp.org       2018-12-30 15:44:13.879049870 +0100
> +++ daemons/lircd.cpp   2018-12-30 15:44:35.206522371 +0100
> @@ -790,7 +790,7 @@
>         struct servent* service;
>         char server[strlen(server_arg) + 1];
> 
> -       strncpy(server, server_arg, sizeof(server) - 1);
> +       strncpy(server, server_arg, sizeof(server));
> 
>         if (peern < MAX_PEERS) {
>                 peers[peern] = (struct peer_connection*) malloc(sizeof(
> 
> 
> The output then reads (note the "...Connected to..." line):



Indeed. Thanks for debugging this, I hav not been able to reproduce the
error. probably because my my memory is initialized to 0. The patch is
perfectly fine.

The issue is filed as [1], and the patch pushed to master. It will be
backported to next Debian update Real Soon (tm). I will also publish an
updated bionic package on my launchpad ppa [2] (will take some time).

Unfortunately, I forgot to give you credit in the patch. Sorry for that

Cheers!
--alec

PS: Back later on the rest... DS

[1] https://sourceforge.net/p/lirc/tickets/343/
[2] https://launchpad.net/~leamas-alec/+archive/ubuntu/lirc-0.10