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

multiple line statements in slapd.conf (ITS#1551)



Full_Name: Stephan Siano
Version: -devel
OS: Linux
URL: 
Submission from: (NULL) (213.95.15.201)


Multi line statements in slapd.conf are only possible if the following line
begins with a whitespace character (which is preserved). In some cases a
whitespace whitespace character is not allowed so multi-line statements become
impossible. An example for this are attr=... statements in ACLs which might
become rather long.

The following patch allows to terminate a line with a backslash and append the
following line without whitespace. An ACL statement might now look like

access to dn.subtree="cn=here comes the root of the tree,dc=sample,dc=com"
 attr=attributename1,attributename2,verylongattributename3,anotherattributename4,\
moreattributenames5,evenmoreattributenames6
 by dn="admin,dc=sample,dc=com" write


Index: config.c
===================================================================
RCS file: /CVS/ldap/servers/slapd/config.c,v
retrieving revision 1.1.1.11.2.1
diff -u -r1.1.1.11.2.1 config.c
--- config.c    2002/01/08 09:21:35     1.1.1.11.2.1
+++ config.c    2002/01/23 11:57:39
@@ -2366,12 +2366,17 @@
                        if( p > buf && p[-1] == '\r' ) --p;
                        *p = '\0';
                }
-               if ( ! isspace( (unsigned char) buf[0] ) ) {
-                       return( line );
+               /* trim off trailing \ and append the next line */
+               if ( strlen(line)>0 && *(p=line+strlen(line)-1)=='\\' ) {
+                       *p = '\0';
+                       lcur--;
+               } else {
+                       if ( ! isspace( (unsigned char) buf[0] ) ) {
+                               return( line );
+                       }
+                       /* change leading whitespace to a space */
+                       buf[0] = ' ';
                }
-
-               /* change leading whitespace to a space */
-               buf[0] = ' ';

                CATLINE( buf );
                (*lineno)++;