[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: Serious problem with access clause (ITS#2557)



On Fri, 30 May 2003 hyc@symas.com wrote:

> Date: Fri, 30 May 2003 07:13:26 GMT
> From: hyc@symas.com
> To: openldap-its@OpenLDAP.org
> Subject: RE: Serious problem with access clause (ITS#2557)
>
>
> > -----Original Message-----
> > From: Quanah Gibson-Mount [mailto:quanah@stanford.edu]
>
> > --On Thursday, May 29, 2003 11:54 PM -0700 Howard Chu
> > <hyc@symas.com> wrote:
> >
> > > You *do* need to end the previous line with a backslash.
> >
> > ah. ;) I would say then it is technically reading the end of
> > the line as
> > the end of the clause.
>
> Yah, I guess you're right.
>


However,  When you read a line using fgets into buf with a maximum
length of BUFSIZ, you may not have read to whole line.  If the line
returned by fgets() does not terminate with a \n character you know
that there is more characters in that line (unless you reached end of
file and the last line isn't terminated by \n).
In the code you can either say this is a fatal error and diagnose it as
such, but as you already handle line continuations you could simply go
around the loop and append the rest of the line to the partial line.


The following patch is untested and may not work,



--- config.c.orig	Fri May 30 09:41:33 2003
+++ config.c	Fri May 30 09:53:11 2003
@@ -1,5 +1,5 @@
 /* config.c - configuration file handling routines */
-/* $OpenLDAP: pkg/ldap/servers/slapd/config.c,v 1.165.2.26 2003/03/27 03:04:06 hyc Exp $ */
+/* $OpenLDAP: pkg/ldap/servers/slapd/config.c,v 1.165.2.26 Patched $ */
 /*
  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
@@ -2576,6 +2576,10 @@
 		if ( (p = strchr( buf, '\n' )) != NULL ) {
 			if( p > buf && p[-1] == '\r' ) --p;
 			*p = '\0';
+		} else {
+			/* Line was incomplete, get rest of line */
+			CATLINE( buf );
+			continue;
 		}

 		/* trim off trailing \ and append the next line */