Re: bug in busybox sed with non-ascii chars

2014-05-07 Thread Rich Felker
On Mon, May 05, 2014 at 08:08:32PM +0100, Sam Liddicott wrote:
> One of the advantages of utf-8 encoding was that it was easy to re-sync
> after an invalid sequence.
> 
> It's a bit of a waste to then not do that. Minus points for musl.

An application can resync, although the C multibyte interfaces are not
really designed to be used this way (and you have to be careful if the
locale's encoding might be state-dependent, e.g. some legacy CJK
encodings). However the implementation cannot silently resync behind
your back. Doing so introduces serious bugs, some of which may be
security-relevant, since you either silently miss seeing some bytes
from the input when processing input via conversion to wide
characters, or some invalid sequences appear to the application as
valid. Either possibility is dangerous. In particular, it's wrong for
the regex "." to match anything that's an illegal sequence, and wrong
for "^.*$" to match a line containing any illegal sequences (since the
"." can't match it).

> Can you not run sed with LANG=C or LANG=POSIX?

That's not what they're doing, but it's not a solution anyway. ISO C
leaves the character encoding of the C locale implementation-defined,
and the Rationale text from the 1995 amendments to C explicitly allows
for the possibility that the C locale's character encoding has
multibyte characters (e.g. is UTF-8).

musl presently does not support byte-based characters at all, only
UTF-8. This conforms to the current versions of ISO C and POSIX, but
the Austin Group has adopted a requirement that the C locale be "8
bit clean" as a future requirement, which musl will probably support
at some time in the future.

Rich
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: Anyone using udhcpc6

2014-05-07 Thread Matt Whitlock
On 6-May-2014, at 3:19 pm, "Harshad Prabhu (hprabhu)"  wrote:
> Let me know if anyone has added (any patches) / using  udhcpc6 support in 
> busybox.

I *would* be using udhcpc6 if it were working. I've tried, and I just can't 
make it recognize the DHCPv6 response from Comcast's CMTS. I'm using Dibbler as 
an alternative right now, but as soon as udhcpc6 supports obtaining an IPv6 
Prefix Delegation from a DHCPv6 server, I'd love to switch to it instead and 
eliminate the massive beast that is Dibbler.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] Only write leasefile if anything changed

2014-05-07 Thread Phil Sutter
Hi,

This patch is left unapplied for nearly two years now. Was it forgotten
or are there good reasons to reject it? If so, something one could fix?
:)

On Tue, May 08, 2012 at 04:09:34PM +0200, Phil Sutter wrote:
> Also, move the check for changed leases to before the select(), so
> changes will occur immediately instead only after select() returns the
> next time.
> 
> Signed-off-by: Phil Sutter 
> Signed-off-by: Nico Erfurth 
> ---
>  networking/udhcp/dhcpd.c |   10 +-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
> index dd55e70..356c81f 100644
> --- a/networking/udhcp/dhcpd.c
> +++ b/networking/udhcp/dhcpd.c
> @@ -298,6 +298,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
>  {
>   int server_socket = -1, retval, max_sock;
>   uint8_t *state;
> + uint8_t leases_changed = 0;
>   unsigned timeout_end;
>   unsigned num_ips;
>   unsigned opt;
> @@ -389,6 +390,11 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
>   uint32_t static_lease_nip;
>   struct dyn_lease *lease, fake_lease;
>  
> + if (leases_changed) {
> + write_leases();
> + leases_changed = 0;
> + }
> +
>   if (server_socket < 0) {
>   server_socket = udhcp_listen_socket(/*INADDR_ANY,*/ 
> SERVER_PORT,
>   server_config.interface);
> @@ -405,7 +411,6 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
>   server_config.auto_time ? &tv : NULL);
>   }
>   if (retval == 0) {
> - write_leases();
>   timeout_end = monotonic_sec() + server_config.auto_time;
>   continue;
>   }
> @@ -591,6 +596,7 @@ o DHCPREQUEST generated during REBINDING state:
>   /* client requested or configured IP matches 
> the lease.
>* ACK it, and bump lease expiration time. */
>   send_ACK(&packet, lease->lease_nip);
> + leases_changed = 1;
>   break;
>   }
>   /* No lease for this MAC, or lease IP != requested IP */
> @@ -626,6 +632,7 @@ o DHCPREQUEST generated during REBINDING state:
>   ) {
>   memset(lease->lease_mac, 0, 
> sizeof(lease->lease_mac));
>   lease->expires = time(NULL) + 
> server_config.decline_time;
> + leases_changed = 1;
>   }
>   break;
>  
> @@ -644,6 +651,7 @@ o DHCPREQUEST generated during REBINDING state:
>&& packet.ciaddr == lease->lease_nip
>   ) {
>   lease->expires = time(NULL);
> + leases_changed = 1;
>   }
>   break;
>  
> -- 
> 1.7.3.4
> 
> ___
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
> 


Best wishes,

Phil Sutter
Software Engineer

-- 
Viprinet Europe GmbH
Gaustr. 22-32
55411 Bingen am Rhein
Germany

Phone/Zentrale:   +49 6721 49030-0
Direct line/Durchwahl:+49 6721 49030-134
Fax:  +49 6721 49030-109

phil.sut...@viprinet.com
http://www.viprinet.com

Registered office/Sitz der Gesellschaft: Bingen am Rhein, Germany
Commercial register/Handelsregister: Amtsgericht Mainz HRB44090
CEO/Geschäftsführer: Simon Kissel
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox