config.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. /* config.c - configuration file handling routines */
  42. #include <stdio.h>
  43. #include <string.h>
  44. #include <sys/types.h>
  45. #include <errno.h>
  46. #include <stdlib.h>
  47. #ifdef _WIN32
  48. #include <direct.h> /* for getcwd */
  49. #else
  50. #include <sys/socket.h>
  51. #include <sys/param.h>
  52. #include <unistd.h>
  53. #include <pwd.h>
  54. #endif
  55. #include "slap.h"
  56. #include "pw.h"
  57. #include <sys/stat.h>
  58. #include <prio.h>
  59. #define MAXARGS 1000
  60. extern int should_detach;
  61. extern Slapi_PBlock *repl_pb;
  62. extern char* slapd_SSL3ciphers;
  63. #ifndef _WIN32
  64. extern char *localuser;
  65. #endif
  66. char* rel2abspath( char * );
  67. /*
  68. See if the given entry has an attribute with the given name and the
  69. given value; if value is NULL, just test for the presence of the given
  70. attribute; if value is an empty string (i.e. value[0] == 0),
  71. the first value in the attribute will be copied into the given buffer
  72. and returned
  73. */
  74. static int
  75. entry_has_attr_and_value(Slapi_Entry *e, const char *attrname,
  76. char *value, size_t valuebufsize )
  77. {
  78. int retval = 0;
  79. Slapi_Attr *attr = 0;
  80. if (!e || !attrname)
  81. return retval;
  82. /* see if the entry has the specified attribute name */
  83. if (!slapi_entry_attr_find(e, attrname, &attr) && attr)
  84. {
  85. /* if value is not null, see if the attribute has that
  86. value */
  87. if (!value)
  88. {
  89. retval = 1;
  90. }
  91. else
  92. {
  93. Slapi_Value *v = 0;
  94. int index = 0;
  95. for (index = slapi_attr_first_value(attr, &v);
  96. v && (index != -1);
  97. index = slapi_attr_next_value(attr, index, &v))
  98. {
  99. const char *s = slapi_value_get_string(v);
  100. if (!s)
  101. continue;
  102. if (!*value)
  103. {
  104. size_t len = strlen(s);
  105. if ( len < valuebufsize )
  106. {
  107. strcpy(value, s);
  108. retval = 1;
  109. }
  110. else
  111. {
  112. slapi_log_error( SLAPI_LOG_FATAL, "bootstrap config",
  113. "Ignoring extremely large value for"
  114. " configuration attribute %s"
  115. " (length=%d, value=%40.40s...)\n",
  116. attrname, len, s );
  117. retval = 0; /* value is too large: ignore it */
  118. }
  119. break;
  120. }
  121. else if (!strcasecmp(s, value))
  122. {
  123. retval = 1;
  124. break;
  125. }
  126. }
  127. }
  128. }
  129. return retval;
  130. }
  131. /*
  132. Extract just the configuration information we need for bootstrapping
  133. purposes
  134. 1) set up error logging
  135. 2) disable syntax checking
  136. 3) load the syntax plugins
  137. etc.
  138. */
  139. int
  140. slapd_bootstrap_config(const char *configdir)
  141. {
  142. char configfile[MAXPATHLEN+1];
  143. PRFileInfo prfinfo;
  144. int rc = 0; /* Fail */
  145. int done = 0;
  146. PRInt32 nr = 0;
  147. PRFileDesc *prfd = 0;
  148. char *buf = 0;
  149. char *lastp = 0;
  150. char *entrystr = 0;
  151. if (NULL == configdir) {
  152. slapi_log_error(SLAPI_LOG_FATAL,
  153. "startup", "Passed null config directory\n");
  154. return rc; /* Fail */
  155. }
  156. PR_snprintf(configfile, sizeof(configfile), "%s/%s", configdir,
  157. CONFIG_FILENAME);
  158. if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS )
  159. {
  160. /* the "real" file does not exist; see if there is a tmpfile */
  161. char tmpfile[MAXPATHLEN+1];
  162. slapi_log_error(SLAPI_LOG_FATAL, "config",
  163. "The configuration file %s does not exist\n", configfile);
  164. PR_snprintf(tmpfile, sizeof(tmpfile), "%s/%s.tmp", configdir,
  165. CONFIG_FILENAME);
  166. if ( PR_GetFileInfo( tmpfile, &prfinfo ) == PR_SUCCESS ) {
  167. rc = PR_Rename(tmpfile, configfile);
  168. if (rc == PR_SUCCESS) {
  169. slapi_log_error(SLAPI_LOG_FATAL, "config",
  170. "The configuration file %s was restored from backup %s\n",
  171. configfile, tmpfile);
  172. } else {
  173. slapi_log_error(SLAPI_LOG_FATAL, "config",
  174. "The configuration file %s was not restored from backup %s, error %d\n",
  175. configfile, tmpfile, rc);
  176. return rc; /* Fail */
  177. }
  178. } else {
  179. slapi_log_error(SLAPI_LOG_FATAL, "config",
  180. "The backup configuration file %s does not exist, either.\n",
  181. tmpfile);
  182. return rc; /* Fail */
  183. }
  184. }
  185. if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS )
  186. {
  187. PRErrorCode prerr = PR_GetError();
  188. slapi_log_error(SLAPI_LOG_FATAL, "config", "The given config file %s could not be accessed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
  189. configfile, prerr, slapd_pr_strerror(prerr));
  190. return rc;
  191. }
  192. else if (( prfd = PR_Open( configfile, PR_RDONLY,
  193. SLAPD_DEFAULT_FILE_MODE )) == NULL )
  194. {
  195. PRErrorCode prerr = PR_GetError();
  196. slapi_log_error(SLAPI_LOG_FATAL, "config", "The given config file %s could not be opened for reading, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
  197. configfile, prerr, slapd_pr_strerror(prerr));
  198. return rc; /* Fail */
  199. }
  200. else
  201. {
  202. /* read the entire file into core */
  203. buf = slapi_ch_malloc( prfinfo.size + 1 );
  204. if (( nr = slapi_read_buffer( prfd, buf, prfinfo.size )) < 0 )
  205. {
  206. slapi_log_error(SLAPI_LOG_FATAL, "config", "Could only read %d of %d bytes from config file %s\n",
  207. nr, prfinfo.size, configfile);
  208. rc = 0; /* Fail */
  209. done= 1;
  210. }
  211. (void)PR_Close(prfd);
  212. buf[ nr ] = '\0';
  213. if(!done)
  214. {
  215. char workpath[MAXPATHLEN+1];
  216. char loglevel[BUFSIZ];
  217. char maxdescriptors[BUFSIZ];
  218. char val[BUFSIZ];
  219. char _localuser[BUFSIZ];
  220. char logenabled[BUFSIZ];
  221. char schemacheck[BUFSIZ];
  222. Slapi_DN plug_dn;
  223. workpath[0] = loglevel[0] = maxdescriptors[0] = '\0';
  224. val[0] = logenabled[0] = schemacheck[0] = '\0';
  225. _localuser[0] = '\0';
  226. /* Convert LDIF to entry structures */
  227. slapi_sdn_init_dn_byref(&plug_dn, PLUGIN_BASE_DN);
  228. while ((entrystr = dse_read_next_entry(buf, &lastp)) != NULL)
  229. {
  230. char errorbuf[BUFSIZ];
  231. /*
  232. * XXXmcs: it would be better to also pass
  233. * SLAPI_STR2ENTRY_REMOVEDUPVALS in the flags, but
  234. * duplicate value checking requires that the syntax
  235. * and schema subsystems be initialized... and they
  236. * are not yet.
  237. */
  238. Slapi_Entry *e = slapi_str2entry(entrystr,
  239. SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF);
  240. if (e == NULL)
  241. {
  242. LDAPDebug(LDAP_DEBUG_ANY, "The entry [%s] in the configfile %s was empty or could not be parsed\n",
  243. entrystr, configfile, 0);
  244. continue;
  245. }
  246. /* increase file descriptors */
  247. #if !defined(_WIN32) && !defined(AIX)
  248. if (!maxdescriptors[0] &&
  249. entry_has_attr_and_value(e, CONFIG_MAXDESCRIPTORS_ATTRIBUTE,
  250. maxdescriptors, sizeof(maxdescriptors)))
  251. {
  252. if (config_set_maxdescriptors(
  253. CONFIG_MAXDESCRIPTORS_ATTRIBUTE,
  254. maxdescriptors, errorbuf, CONFIG_APPLY)
  255. != LDAP_SUCCESS)
  256. {
  257. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
  258. CONFIG_MAXDESCRIPTORS_ATTRIBUTE, errorbuf);
  259. }
  260. }
  261. #endif /* !defined(_WIN32) && !defined(AIX) */
  262. /* see if we need to enable error logging */
  263. if (!logenabled[0] &&
  264. entry_has_attr_and_value(e,
  265. CONFIG_ERRORLOG_LOGGING_ENABLED_ATTRIBUTE,
  266. logenabled, sizeof(logenabled)))
  267. {
  268. if (log_set_logging(
  269. CONFIG_ERRORLOG_LOGGING_ENABLED_ATTRIBUTE,
  270. logenabled, SLAPD_ERROR_LOG, errorbuf, CONFIG_APPLY)
  271. != LDAP_SUCCESS)
  272. {
  273. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
  274. CONFIG_ERRORLOG_LOGGING_ENABLED_ATTRIBUTE, errorbuf);
  275. }
  276. }
  277. #ifndef _WIN32
  278. /* set the local user name; needed to set up error log */
  279. if (!_localuser[0] &&
  280. entry_has_attr_and_value(e, CONFIG_LOCALUSER_ATTRIBUTE,
  281. _localuser, sizeof(_localuser)))
  282. {
  283. if (config_set_localuser(CONFIG_LOCALUSER_ATTRIBUTE,
  284. _localuser, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  285. {
  286. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
  287. CONFIG_LOCALUSER_ATTRIBUTE, errorbuf);
  288. }
  289. }
  290. #endif
  291. /* set the log file name */
  292. workpath[0] = '\0';
  293. if (!workpath[0] &&
  294. entry_has_attr_and_value(e, CONFIG_ERRORLOG_ATTRIBUTE,
  295. workpath, sizeof(workpath)))
  296. {
  297. if (config_set_errorlog(CONFIG_ERRORLOG_ATTRIBUTE,
  298. workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  299. {
  300. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
  301. CONFIG_ERRORLOG_ATTRIBUTE, errorbuf);
  302. }
  303. }
  304. /* set the error log level */
  305. if (!loglevel[0] &&
  306. entry_has_attr_and_value(e, CONFIG_LOGLEVEL_ATTRIBUTE,
  307. loglevel, sizeof(loglevel)))
  308. {
  309. if (should_detach || !config_get_errorlog_level())
  310. { /* -d wasn't on command line */
  311. if (config_set_errorlog_level(CONFIG_LOGLEVEL_ATTRIBUTE,
  312. loglevel, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  313. {
  314. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
  315. CONFIG_LOGLEVEL_ATTRIBUTE, errorbuf);
  316. }
  317. }
  318. else
  319. {
  320. LDAPDebug(LDAP_DEBUG_ANY,
  321. "%s: ignoring %s (since -d %d was given on "
  322. "the command line)\n",
  323. CONFIG_LOGLEVEL_ATTRIBUTE, loglevel,
  324. config_get_errorlog_level());
  325. }
  326. }
  327. /* set the cert dir; needed in slapd_nss_init */
  328. workpath[0] = '\0';
  329. if (entry_has_attr_and_value(e, CONFIG_CERTDIR_ATTRIBUTE,
  330. workpath, sizeof(workpath)))
  331. {
  332. if (config_set_certdir(CONFIG_CERTDIR_ATTRIBUTE,
  333. workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  334. {
  335. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
  336. CONFIG_CERTDIR_ATTRIBUTE, errorbuf);
  337. }
  338. }
  339. /* set the sasl path; needed in main */
  340. workpath[0] = '\0';
  341. if (entry_has_attr_and_value(e, CONFIG_SASLPATH_ATTRIBUTE,
  342. workpath, sizeof(workpath)))
  343. {
  344. if (config_set_saslpath(CONFIG_SASLPATH_ATTRIBUTE,
  345. workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  346. {
  347. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
  348. CONFIG_SASLPATH_ATTRIBUTE, errorbuf);
  349. }
  350. }
  351. #if defined(ENABLE_LDAPI)
  352. /* set the ldapi file path; needed in main */
  353. workpath[0] = '\0';
  354. if (entry_has_attr_and_value(e, CONFIG_LDAPI_FILENAME_ATTRIBUTE,
  355. workpath, sizeof(workpath)))
  356. {
  357. if (config_set_ldapi_filename(CONFIG_LDAPI_FILENAME_ATTRIBUTE,
  358. workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  359. {
  360. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
  361. CONFIG_LDAPI_FILENAME_ATTRIBUTE, errorbuf);
  362. }
  363. }
  364. /* set the ldapi switch; needed in main */
  365. workpath[0] = '\0';
  366. if (entry_has_attr_and_value(e, CONFIG_LDAPI_SWITCH_ATTRIBUTE,
  367. workpath, sizeof(workpath)))
  368. {
  369. if (config_set_ldapi_switch(CONFIG_LDAPI_SWITCH_ATTRIBUTE,
  370. workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  371. {
  372. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
  373. CONFIG_LDAPI_SWITCH_ATTRIBUTE, errorbuf);
  374. }
  375. }
  376. #endif
  377. /* see if the entry is a child of the plugin base dn */
  378. if (slapi_sdn_isparent(&plug_dn,
  379. slapi_entry_get_sdn_const(e)))
  380. {
  381. if (entry_has_attr_and_value(e, "objectclass",
  382. "nsSlapdPlugin", 0) &&
  383. (entry_has_attr_and_value(e, ATTR_PLUGIN_TYPE,
  384. "syntax", 0) ||
  385. entry_has_attr_and_value(e, ATTR_PLUGIN_TYPE,
  386. "matchingrule", 0)))
  387. {
  388. /* add the syntax/matching scheme rule plugin */
  389. if (plugin_setup(e, 0, 0, 1))
  390. {
  391. LDAPDebug(LDAP_DEBUG_ANY, "The plugin entry [%s] in the configfile %s was invalid\n", slapi_entry_get_dn(e), configfile, 0);
  392. rc = 0;
  393. slapi_sdn_done(&plug_dn);
  394. goto bail;
  395. }
  396. }
  397. }
  398. /* see if the entry is a grand child of the plugin base dn */
  399. if (slapi_sdn_isgrandparent(&plug_dn,
  400. slapi_entry_get_sdn_const(e)))
  401. {
  402. if (entry_has_attr_and_value(e, "objectclass",
  403. "nsSlapdPlugin", 0) &&
  404. ( entry_has_attr_and_value(e, ATTR_PLUGIN_TYPE,
  405. "pwdstoragescheme", 0) ||
  406. entry_has_attr_and_value(e, ATTR_PLUGIN_TYPE,
  407. "reverpwdstoragescheme", 0) ) )
  408. {
  409. /* add the pwd storage scheme rule plugin */
  410. if (plugin_setup(e, 0, 0, 1))
  411. {
  412. LDAPDebug(LDAP_DEBUG_ANY, "The plugin entry [%s] in the configfile %s was invalid\n", slapi_entry_get_dn(e), configfile, 0);
  413. rc = 0;
  414. slapi_sdn_done(&plug_dn);
  415. goto bail;
  416. }
  417. }
  418. }
  419. /* see if we need to disable schema checking */
  420. if (!schemacheck[0] &&
  421. entry_has_attr_and_value(e, CONFIG_SCHEMACHECK_ATTRIBUTE,
  422. schemacheck, sizeof(schemacheck)))
  423. {
  424. if (config_set_schemacheck(CONFIG_SCHEMACHECK_ATTRIBUTE,
  425. schemacheck, errorbuf, CONFIG_APPLY)
  426. != LDAP_SUCCESS)
  427. {
  428. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
  429. CONFIG_SCHEMACHECK_ATTRIBUTE, errorbuf);
  430. }
  431. }
  432. /* see if we need to expect quoted schema values */
  433. if (entry_has_attr_and_value(e, CONFIG_ENQUOTE_SUP_OC_ATTRIBUTE,
  434. val, sizeof(val)))
  435. {
  436. if (config_set_enquote_sup_oc(
  437. CONFIG_ENQUOTE_SUP_OC_ATTRIBUTE, val, errorbuf,
  438. CONFIG_APPLY) != LDAP_SUCCESS)
  439. {
  440. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
  441. CONFIG_ENQUOTE_SUP_OC_ATTRIBUTE, errorbuf);
  442. }
  443. val[0] = 0;
  444. }
  445. /* see if we need to maintain case in AT and OC names */
  446. if (entry_has_attr_and_value(e,
  447. CONFIG_RETURN_EXACT_CASE_ATTRIBUTE, val, sizeof(val)))
  448. {
  449. if (config_set_return_exact_case(
  450. CONFIG_RETURN_EXACT_CASE_ATTRIBUTE, val,
  451. errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  452. {
  453. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
  454. CONFIG_RETURN_EXACT_CASE_ATTRIBUTE, errorbuf);
  455. }
  456. val[0] = 0;
  457. }
  458. /* see if we should allow attr. name exceptions, e.g. '_'s */
  459. if (entry_has_attr_and_value(e,
  460. CONFIG_ATTRIBUTE_NAME_EXCEPTION_ATTRIBUTE,
  461. val, sizeof(val)))
  462. {
  463. if (config_set_attrname_exceptions(
  464. CONFIG_ATTRIBUTE_NAME_EXCEPTION_ATTRIBUTE, val,
  465. errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  466. {
  467. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
  468. CONFIG_ATTRIBUTE_NAME_EXCEPTION_ATTRIBUTE,
  469. errorbuf);
  470. }
  471. val[0] = 0;
  472. }
  473. /* see if we need to maintain schema compatibility with 4.x */
  474. if (entry_has_attr_and_value(e,
  475. CONFIG_DS4_COMPATIBLE_SCHEMA_ATTRIBUTE, val, sizeof(val)))
  476. {
  477. if (config_set_ds4_compatible_schema(
  478. CONFIG_DS4_COMPATIBLE_SCHEMA_ATTRIBUTE, val,
  479. errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  480. {
  481. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
  482. CONFIG_DS4_COMPATIBLE_SCHEMA_ATTRIBUTE,
  483. errorbuf);
  484. }
  485. val[0] = 0;
  486. }
  487. /* see if we need to allow trailing spaces in OC and AT names */
  488. if (entry_has_attr_and_value(e,
  489. CONFIG_SCHEMA_IGNORE_TRAILING_SPACES, val, sizeof(val)))
  490. {
  491. if (config_set_schema_ignore_trailing_spaces(
  492. CONFIG_SCHEMA_IGNORE_TRAILING_SPACES, val,
  493. errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
  494. {
  495. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
  496. CONFIG_SCHEMA_IGNORE_TRAILING_SPACES,
  497. errorbuf);
  498. }
  499. val[0] = 0;
  500. }
  501. /* rfc1274-rewrite */
  502. if (entry_has_attr_and_value(e,
  503. CONFIG_REWRITE_RFC1274_ATTRIBUTE,
  504. val, sizeof(val))) {
  505. if (config_set_rewrite_rfc1274(
  506. CONFIG_REWRITE_RFC1274_ATTRIBUTE, val,
  507. errorbuf, CONFIG_APPLY) != LDAP_SUCCESS) {
  508. LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n",
  509. configfile,
  510. CONFIG_REWRITE_RFC1274_ATTRIBUTE,
  511. errorbuf);
  512. }
  513. }
  514. if (e)
  515. slapi_entry_free(e);
  516. }
  517. /* kexcoff: initialize rootpwstoragescheme and pw_storagescheme
  518. * if not explicilty set in the config file
  519. */
  520. if ( config_set_storagescheme() ) { /* default scheme plugin not loaded */
  521. slapi_log_error(SLAPI_LOG_FATAL, "startup",
  522. "The default password storage scheme SSHA could not be read or was not found in the file %s. It is mandatory.\n",
  523. configfile);
  524. exit (1);
  525. }
  526. else {
  527. slapi_sdn_done(&plug_dn);
  528. rc= 1; /* OK */
  529. }
  530. }
  531. slapi_ch_free_string(&buf);
  532. }
  533. bail:
  534. slapi_ch_free_string(&buf);
  535. return rc;
  536. }