chiark / gitweb /
Fix quoted strings. Oops. debian_version_0_60_2
authorian <ian>
Sat, 30 Jan 1999 23:37:45 +0000 (23:37 +0000)
committerian <ian>
Sat, 30 Jan 1999 23:37:45 +0000 (23:37 +0000)
client.c
debian/changelog
debian/rules
lexer.l.m4
parser.c

index 4987073a3de76dad9d9dcbe55e85ab7cb5b99a37..243a333c5fe29af9a7e9528e813dce02fd68c070 100644 (file)
--- a/client.c
+++ b/client.c
@@ -372,7 +372,6 @@ static void sighandler_chld(int ignored) /* DOES return, unlike in daemon */ {
     if (child == 0 || (child == -1 && errno == ECHILD)) break;
     if (child == -1) syscallerror("wait for child process (in sigchld handler)");
     for (fd=0; fd<fdsetupsize && fdsetup[fd].catpid != child; fd++);
     if (child == 0 || (child == -1 && errno == ECHILD)) break;
     if (child == -1) syscallerror("wait for child process (in sigchld handler)");
     for (fd=0; fd<fdsetupsize && fdsetup[fd].catpid != child; fd++);
-fprintf(stderr,"chld found pid=%ld fd=%d setupsize=%d\n",(long)child,fd,fdsetupsize);
     if (fd>=fdsetupsize) continue; /* perhaps the caller gave us children */
     if ((WIFEXITED(status) && WEXITSTATUS(status)==0) ||
        (WIFSIGNALED(status) && WTERMSIG(status)==SIGPIPE) ||
     if (fd>=fdsetupsize) continue; /* perhaps the caller gave us children */
     if ((WIFEXITED(status) && WEXITSTATUS(status)==0) ||
        (WIFSIGNALED(status) && WTERMSIG(status)==SIGPIPE) ||
index 5e85e9e8aaa80dc858ffc36dde5ce39b6028ef68..d02912031508529f0cd719579d96a8bd856a570f 100644 (file)
@@ -1,4 +1,4 @@
-userv (0.60.1) frozen unstable; urgency=high
+userv (0.60.2) frozen unstable; urgency=high
 
   * Fixed failure to save pathnames in a couple of places in parser.c.
     Without this, include-directory would often try to open a garbage
 
   * Fixed failure to save pathnames in a couple of places in parser.c.
     Without this, include-directory would often try to open a garbage
@@ -6,10 +6,7 @@ userv (0.60.1) frozen unstable; urgency=high
     user-owned config files were included from sysadmin-defined files,
     and the sysadmin wants to control how a user provides services.
 
     user-owned config files were included from sysadmin-defined files,
     and the sysadmin wants to control how a user provides services.
 
-  * Fix failure to terminate string properly in parser.c, which would usually
-    cause "-quoted strings to be mishandled.  (This is not thought to
-    be security-critical, and the bug can be avoided by not using
-    "-quoted strings in configuration files.)
+  * Fix "-quoted strings, which previously never worked at all.
 
   * Fixed spurious failure with `Interrupted system call' on systems
     where fread can fail due to read giving EINTR (blech!)
 
   * Fixed spurious failure with `Interrupted system call' on systems
     where fread can fail due to read giving EINTR (blech!)
@@ -36,7 +33,7 @@ userv (0.60.1) frozen unstable; urgency=high
 
   * Debian package description mentions use by system admin.
 
 
   * Debian package description mentions use by system admin.
 
- -- 
+ -- Ian Jackson <ian@davenant.greenend.org.uk>  Sat, 30 Jan 1999 23:38:17 +0000
 
 
 *** Main changelog file included here - see far down this file for the
 
 
 *** Main changelog file included here - see far down this file for the
index 465d2a73c0541f56ae466453253654384435e92e..f58644d851b779937edff65187e5212673b69e4a 100755 (executable)
@@ -1,14 +1,12 @@
 #!/usr/bin/make -f
 
 package=userv
 #!/usr/bin/make -f
 
 package=userv
-revision=$(shell dpkg-parsechangelog | sed -n 's/^Version:.*-//p')
-verext=-$(revision)deb
 
 build:
        $(checkdir)
        ./configure --prefix=/usr
 
 build:
        $(checkdir)
        ./configure --prefix=/usr
-       $(MAKE) VEREXT=$(verext)
-       $(MAKE) spec.html VEREXT=$(verext)
+       $(MAKE)
+       $(MAKE) spec.html
        touch build
 
 clean:
        touch build
 
 clean:
@@ -35,7 +33,6 @@ binary-arch:  checkroot build
        chmod +x debian/tmp/DEBIAN/{postinst,prerm,postrm}
        chmod +x debian/tmp/etc/init.d/userv
        $(MAKE) LDFLAGS=-s INSTALL_PROGRAM='install -c -s' \
        chmod +x debian/tmp/DEBIAN/{postinst,prerm,postrm}
        chmod +x debian/tmp/etc/init.d/userv
        $(MAKE) LDFLAGS=-s INSTALL_PROGRAM='install -c -s' \
-               VEREXT=$(verext) \
                prefix=debian/tmp/usr etcdir=debian/tmp/etc install
        cp debian/copyright debian/tmp/usr/doc/$(package)/.
        cp debian/changelog debian/tmp/usr/doc/$(package)/changelog
                prefix=debian/tmp/usr etcdir=debian/tmp/etc install
        cp debian/copyright debian/tmp/usr/doc/$(package)/.
        cp debian/changelog debian/tmp/usr/doc/$(package)/changelog
index 0b7e705f8f521ea57f2d3c84a7c65c27bcdbaad0..5aaeff088b312349b22732ce2ce0bca3738731a4 100644 (file)
@@ -178,14 +178,14 @@ changequote({*,*})
                          parseerrprint("missing newline at eof after comment");
                          return tokv_error;
                        }
                          parseerrprint("missing newline at eof after comment");
                          return tokv_error;
                        }
-[^\ \t\n]+             return tokv_barestring;
-\"([^\\\"\n]|\\[a-z]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2}|\\[:punct:]|\\[ \t]*\n)*\" {
+\"([^\\\"\n]|\\[a-z]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2}|\\[[:punct:]]|\\[ \t]*\n)*\" {
                          return dequote(yytext);
                        }
 \".*                   {
                          parseerrprint("misquoted or unterminated string");
                          return tokv_error;
                        }
                          return dequote(yytext);
                        }
 \".*                   {
                          parseerrprint("misquoted or unterminated string");
                          return tokv_error;
                        }
+[^\ \t\n]+             return tokv_barestring;
 <<EOF>>                        return tokv_eof;
 *}
 changequote(`,')
 <<EOF>>                        return tokv_eof;
 *}
 changequote(`,')
index aa11d8ed7355357dc2ec568c0f70b1cc85885fdf..ad0829d6911ce669384b0c908e4d4e7b5851f7e2 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -139,7 +139,7 @@ static void freecharparray(char **array) {
 static int dequote(char *inplace) {
   char *p, *q, buf[4], *bep;
   int v;
 static int dequote(char *inplace) {
   char *p, *q, buf[4], *bep;
   int v;
-  
+
   p=q=inplace;
   assert(*p++ = '"');
   while (*p && *p != '"') {
   p=q=inplace;
   assert(*p++ = '"');
   while (*p && *p != '"') {
@@ -149,21 +149,32 @@ static int dequote(char *inplace) {
     case 'r': *q++= '\r'; continue;
     case 't': *q++= '\t'; continue;
     case 'x':
     case 'r': *q++= '\r'; continue;
     case 't': *q++= '\t'; continue;
     case 'x':
-      assert(buf[0]= *++p); assert(buf[1]= *++p); buf[2]= 0;
-      v= strtoul(buf,&bep,16); assert(bep == buf+2);
-      assert(!(v & ~0xff)); *q++= v; p++; continue;
+      p++;
+      if (!((buf[0]= *p++) && (buf[1]= *p++))) {
+       parseerrprint("quoted string ends inside \\x<hex> sequence");
+       return tokv_error;
+      }
+      buf[2]= 0;
+      v= strtoul(buf,&bep,16);
+      if (bep != buf+2) {
+       parseerrprint("invalid \\<hex> sequence \\x%s in quoted string",buf);
+       return tokv_error;
+      }
+      assert(!(v & ~0xff));
+      *q++= v;
+      continue;
     default:
       if (isalpha(*p)) {
         parseerrprint("unknown \\<letter> sequence \\%c in quoted string",*p);
         return tokv_error;
       } else if (isdigit(*p)) {
     default:
       if (isalpha(*p)) {
         parseerrprint("unknown \\<letter> sequence \\%c in quoted string",*p);
         return tokv_error;
       } else if (isdigit(*p)) {
-        assert(buf[0]= *++p); assert(buf[1]= *++p); assert(buf[2]= *++p);
+        if (!((buf[0]= *p++) && (buf[1]= *p++) && (buf[2]= *p++))) abort();
         buf[3]= 0; v= strtoul(buf,&bep,8);
         buf[3]= 0; v= strtoul(buf,&bep,8);
-        if (bep != buf+3 || (v & ~0xff)); {
+        if (bep != buf+3 || (v & ~0xff)) {
           parseerrprint("invalid \\<octal> sequence \\%s in quoted string",buf);
           return tokv_error;
         }
           parseerrprint("invalid \\<octal> sequence \\%s in quoted string",buf);
           return tokv_error;
         }
-        *q++= v; p++; continue;
+        *q++= v; continue;
       } else if (ispunct(*p)) {
         *q++= *p++; continue;
       } else {
       } else if (ispunct(*p)) {
         *q++= *p++; continue;
       } else {