compilation bug fix for bsds

Sam Trenholme strenholme.usenet at gmail.com
Sat Jan 15 17:17:32 EST 2011


> Looks like the attachment got scrubbed again.
> Here's the patch again, hopefully what ever it is that's causing
> your lines to get wrapped ~70 chars long won't hurt it.

As an aside, as a special exception to my "no private email about
MaraDNS", if there is an issue with submitting a patch to the list and
it gets scrubbed, just send it to me via private email.  Note that I
will probably not directly reply to the email, but post to the list
any comments.

OK, I don't know when I will get a change to look at this patch.  It's
a good idea, yes, but right now I'm concentrating what little time I
have for MaraDNS to polishing up Deadwood (removing the minor bugs
which a new release is more likely to have than a mature codebase like
MaraDNS); I will probably look at this patch in a week or so.

Again, I really appreciate your MaraDNS contributions!

- Sam

> --- ./parse/Csv2_rr_soa.c       2010-08-28 17:13:20.000000000 -0500
> +++ ./parse/Csv2_rr_soa.c       2011-01-15 12:17:46.293201632 -0600
> @@ -34,17 +34,18 @@
>  */
>
>  int csv2_b4_at(int32 in) {
> -        /* [0-9a-zA-Z\-\_\+\%\!\^\=] */
> +        /* [0-9a-zA-Z\-\_\+\%\!\^\=\.] */
>         return (csv2_is_alphanum(in) || in == '+' || in == '%' ||
> -                        in == '!' || in == '^' || in == '=');
> +                        in == '!' || in == '^' || in == '=' || in == '.');
>  }
>
> -/* Process an address in the form 'a at foo.bar.baz.' or 'a.foo.bar.baz.' */
> +/* Process an address in the form 'a at foo.bar.baz.', 'a.foo.bar.baz.', or 'a\.b\.c at foo.bar.baz.' */
>
>  js_string *process_mbox(csv2_read *stream) {
>         js_string *o;
>         int32 look;
>         int x;
> +        unsigned int prescaped = 0;
>
>         o = process_1stchar(stream,csv2_is_alphanum_ordot,"Z");
>         if(o == 0) {
> @@ -69,13 +70,18 @@
>                         js_destroy(o);
>                         return 0;
>                 }
> -                if(look == '@' || look == '.') {
> -                        if(csv2_append_utf8(o, look) < 0) {
> +                if(look == '@' || (look == '.' && !prescaped)) {
> +                        if(prescaped) {
> +                                csv2_error(stream,"You can't escape an @ or use it in the local part in mbox");
> +                                js_destroy(o);
> +                                return 0;
> +                        }
> +                        if(csv2_append_utf8(o, '@') < 0) { // use an '@' regardless, to support local part '.'s
>                                 csv2_error(stream,"Error appending character");
>                                 js_destroy(o);
>                                 return 0;
>                         }
> -                        if(look == '.') {
> +                        if(look == '.') { // note: this block is asking for trouble if js_append_dname() is well behaved
>                                 look = csv2_read_unicode(stream);
>                                 if(csv2_is_text(look)) {
>                                   if(csv2_append_utf8(o, look) < 0) {
> @@ -93,12 +99,21 @@
>                         }
>                         break;
>                 }
> -                if(csv2_b4_at(look)) {
> +                if(look == '\\') {
> +                        if(prescaped) {
> +                                csv2_error(stream,"Unexpected character before @ in mbox, backslashes are illegal");
> +                                js_destroy(o);
> +                                return 0;
> +                        }
> +                        prescaped = 1; // the parser will forgive escaping of regular characters without complaining
> +                }
> +                else if(csv2_b4_at(look)) {
>                         if(csv2_append_utf8(o, look) < 0) {
>                                 csv2_error(stream,"Error appending character");
>                                 js_destroy(o);
>                                 return 0;
>                         }
> +                        prescaped = 0;
>                 }
>                 else {
>                         csv2_error(stream,"Unexpected character before @"
>
>
>
> ----- Original message -----
> From: "Yarin" <yarin at warpmail.net>
> To: list at maradns.org
> Date: Sat, 15 Jan 2011 12:47:02 -0600
> Subject: Re: compilation bug fix for bsds
>
>> Then again, there is a reason I prefer "-u" diffs.
>
> Yes, and so I see why.
>
>> Yes, '@' should do the right thing with a SOA email address
>
> Oh, '@' does do the right thing, it's just that the parser doesn't accept '.'s in the local part of the email address, because when it sees one, it thinks your trying to use it in place of the '@'.
> I've attached a proposed patch (released under the two-clause BSD license) that will fix this, by treating escaped dots differently. So, for example, the address "a.b.c at foo.bar.baz" can be expressed with "a\.b\.c.foo.bar.baz." This is the way the dig utility does it.
>
> Yarin
>
> ----- Original message -----
> From: "Sam Trenholme" <strenholme.usenet at gmail.com>
> To: list at maradns.org
> Date: Sat, 15 Jan 2011 01:44:59 -0700
> Subject: Re: compilation bug fix for bsds
>
>> Haha, it looks like you've updated duende since your latest official
>> release, so when you added the patch, one of the patch's lines got
>> stuffed in a new comment. I've confirmed that everything else is
>> where it's suppose to be though. The below diff, applied on top of it,
>> should put it where it goes.
>
> Thanks for catching that.  I had a cold this last weekend which forced
> me to rest a lot and was spending too much time on Usenet [1] when I
> should have been looking closer to your patch.  Then again, there is a
> reason I prefer "-u" diffs.
>
> I have fixed it:
>
> http://samiam.org/blog/20110115.html
>
>> Just recently, MaraDNS freaked when I tried to use a dot in the local
>> part of an SOA record. I then discovered that MaraDNS holds to the
>> classic, using the first dot in the address instead of an at sign. Would
>> you accept a patch that works with this to support dots in the local
>> part? The address would be parsed the same way dig prints it, that
>> is, with the local dots escaped, when lacking an at sign.
>
> You know, I have learned a lot with implementing that code.  Like the
> wisdom for using an interpreter (or a meta-compiler like yacc/bison)
> for parsing text.  Especially a fairly complex parser like the one
> used for csv2 zone file parsing.  And, while I'm at it, the wisdom of
> making substantial changes to the parser (the optional use of '~' to
> separate DNS records in MaraDNS 1.3 so it is easier to convert BIND
> zone files in to CSV2 zone files) once it is written.
>
> Yes, '@' should do the right thing with a SOA email address in
> MaraDNS.  If it doesn't, it's a bug.
>
> - Sam
>
> [1] Usenet was the protocol defining the internet until the web took
> over in the mid-1990s.  Usenet was the place to share useful and cool
> things until the people sharing useful information moved on.  I
> checked it out again this last week to relive a bit of nostalgia;
> Usenet, alas, is dead.
>
>
>


More information about the list mailing list