Sorry for long delay.

Using empty sting for hostname in PPTP is intentional.  So I will fix
the man page.  Thank you for your report.

On Tue, 8 Mar 2016 11:20:40 +0000
Joe Holden <mail+li...@m.jwh.me.uk> wrote:
> Below is a patch that corrects pptp to set the pptp hostname as the
> system hostname, as per the man page and l2tp:
> 
> diff --git a/usr.sbin/npppd/pptp/pptp_ctrl.c
> b/usr.sbin/npppd/pptp/pptp_ctrl.c
> index 1dfdc03..722b2a0 100644
> --- a/usr.sbin/npppd/pptp/pptp_ctrl.c
> +++ b/usr.sbin/npppd/pptp/pptp_ctrl.c
> @@ -721,6 +721,7 @@ pptp_ctrl_send_SCCRP(pptp_ctrl *_this, int result,
> int error)
>         struct pptp_scc *scc;
>         char logbuf[512];
>         const char *val;
> +       char hbuf[NI_MAXHOST + NI_MAXSERV + 16];
> 
>         scc = bytebuffer_pointer(_this->send_buf);
>         lpkt = bytebuffer_remaining(_this->send_buf);
> @@ -749,8 +750,10 @@ pptp_ctrl_send_SCCRP(pptp_ctrl *_this, int
> result, int error)
>          * 63 character */
>         /* host name */
> 
> -       if ((val = PPTP_CTRL_CONF(_this)->hostname) == NULL)
> -               val = "";
> +       if ((val = PPTP_CTRL_CONF(_this)->hostname) == NULL) {
> +               gethostname(hbuf, sizeof(hbuf));
> +               val = hbuf;
> +       }
>         strlcpy(scc->host_name, val, sizeof(scc->host_name));
> 
>         /* vender name */
> 

Reply via email to