chiark / gitweb /
+ Bug fixes:
[adns.git] / src / parse.c
index 5c4bdaf7a9196fe9ffbc67eb52c8dbd4c21cc427..b643e8948815ce6182691b76177c42aba747a676 100644 (file)
@@ -3,7 +3,12 @@
  * - parsing assistance functions (mainly for domains inside datagrams)
  */
 /*
- *  This file is part of adns, which is Copyright (C) 1997-1999 Ian Jackson
+ *  This file is
+ *    Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
+ *
+ *  It is part of adns, which is
+ *    Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
+ *    Copyright (C) 1999 Tony Finch <dot@dotat.at>
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -30,13 +35,12 @@ int vbuf__append_quoted1035(vbuf *vb, const byte *buf, int len) {
     qbuf[0]= 0;
     for (i=0; i<len; i++) {
       ch= buf[i];
-      if (ch == '.' || ch == '"' || ch == '(' || ch == ')' ||
-         ch == '@' || ch == ';' || ch == '$' || ch == '\\') {
-       sprintf(qbuf,"\\%c",ch);
-       break;
-      } else if (ch <= ' ' || ch >= 127) {
+      if (ch <= ' ' || ch >= 127) {
        sprintf(qbuf,"\\%03o",ch);
        break;
+      } else if (!ctype_domainunquoted(ch)) {
+       sprintf(qbuf,"\\%c",ch);
+       break;
       }
     }
     if (!adns__vbuf_append(vb,buf,i) || !adns__vbuf_append(vb,qbuf,strlen(qbuf)))