~ubuntu-branches/ubuntu/oneiric/openvpn/oneiric

« back to all changes in this revision

Viewing changes to socket.c

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2008-10-07 16:30:44 UTC
  • mfrom: (1.1.11 upstream) (10.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20081007163044-ixx04wg588z1972e
Tags: 2.1~rc11-1ubuntu1
* Merge with Debian (LP: #279655), remaining diffs:
  - debian/openvpn.init.d: Added 'status' action to init script, show
    per-VPN result messages and add "--script-security 2" by default for
    backwards compatibility
  - debian/control: Added lsb-base>=3.2-14 depend to allow status_of_proc()
* Fixes regression when calling commands with arguments (LP: #277447)

Show diffs side-by-side

added added

removed removed

Lines of Context:
294
294
  }
295
295
}
296
296
 
 
297
static bool
 
298
dns_addr_safe (const char *addr)
 
299
{
 
300
  if (addr)
 
301
    {
 
302
      const size_t len = strlen (addr);
 
303
      return len > 0 && len <= 255 && string_class (addr, CC_ALNUM|CC_DASH|CC_DOT, 0);
 
304
    }
 
305
  else
 
306
    return false;
 
307
}
 
308
 
 
309
bool
 
310
ip_or_dns_addr_safe (const char *addr, const bool allow_fqdn)
 
311
{
 
312
  if (ip_addr_dotted_quad_safe (addr))
 
313
    return true;
 
314
  else if (allow_fqdn)
 
315
    return dns_addr_safe (addr);
 
316
  else
 
317
    return false;
 
318
}
 
319
 
297
320
static void
298
321
update_remote (const char* host,
299
322
               struct openvpn_sockaddr *addr,
1528
1551
  const char *ip = print_sockaddr_ex (&info->lsa->actual.dest, NULL, 0, gc);
1529
1552
  const char *port = print_sockaddr_ex (&info->lsa->actual.dest, NULL, PS_DONT_SHOW_ADDR|PS_SHOW_PORT, gc);
1530
1553
  if (include_cmd)
1531
 
    argv_printf (argv, "%s %s %s",
 
1554
    argv_printf (argv, "%sc %s %s",
1532
1555
                 info->ipchange_command,
1533
1556
                 ip,
1534
1557
                 port);