]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/config.c
Use defined Root DSE attributes.
[openldap] / servers / slapd / config.c
index e80b9b78d4567b08cd1fd4f98b78f85a4f5b3761..6c0c130378c35df67afa660baf2019836a999dde 100644 (file)
@@ -1833,6 +1833,34 @@ read_config( const char *fname )
                                replogfile = ch_strdup( cargv[1] );
                        }
 
+               /* file from which to read additional rootdse attrs */
+               } else if ( strcasecmp( cargv[0], "rootdse" ) == 0) {
+                       if ( cargc < 2 ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: "
+                                       "missing filename in \"rootDSEfile <filename>\" line.\n",
+                                       fname, lineno ));
+#else
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: "
+                                       "missing filename in \"rootDSEfile <filename>\" line.\n",
+                                   fname, lineno, 0 );
+#endif
+                               return 1;
+                       }
+
+                       if( read_root_dse_file( cargv[1] ) ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: "
+                                       "could not read \"rootDSEfile <filename>\" line.\n",
+                                       fname, lineno ));
+#else
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: "
+                                       "could not read \"rootDSEfile <filename>\" line\n",
+                                   fname, lineno, 0 );
+#endif
+                               return 1;
+                       }
+
                /* maintain lastmodified{by,time} attributes */
                } else if ( strcasecmp( cargv[0], "lastmod" ) == 0 ) {
                        if ( cargc < 2 ) {
@@ -2227,7 +2255,9 @@ fp_getline( FILE *fp, int *lineno )
        }
 
        while ( fgets( buf, sizeof(buf), fp ) != NULL ) {
+               /* trim off \r\n or \n */
                if ( (p = strchr( buf, '\n' )) != NULL ) {
+                       if( p > buf && p[-1] == '\r' ) --p;
                        *p = '\0';
                }
                if ( ! isspace( (unsigned char) buf[0] ) ) {