summaryrefslogtreecommitdiff
path: root/source3/param/loadparm.c
diff options
context:
space:
mode:
authorLars Müller <lmuelle@samba.org>2007-02-22 17:52:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:18:09 -0500
commit1945571e3b899bee8a33122bece723ce87b7daed (patch)
tree477247a4d6aa48142c39ae1df8c722bde80a7c97 /source3/param/loadparm.c
parent43c290639ba96570f2906c12572475898de53be2 (diff)
downloadsamba-1945571e3b899bee8a33122bece723ce87b7daed.tar.gz
samba-1945571e3b899bee8a33122bece723ce87b7daed.tar.bz2
samba-1945571e3b899bee8a33122bece723ce87b7daed.zip
r21506: Allow old pre 3.0.22 multi passdb backend configurations to work with
post 3.0.23. This implementation considers spaces in ldapsam configs. Such configs are trunkated after the closing quote. (This used to be commit 5cd9a2e25872db1881f2f67026bfcd52d060fc4b)
Diffstat (limited to 'source3/param/loadparm.c')
-rw-r--r--source3/param/loadparm.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index dbc02fc663..4e51af7c4e 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1821,7 +1821,49 @@ FN_GLOBAL_STRING(lp_socket_address, &Globals.szSocketAddress)
FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
-FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
+/* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
+ * lp_passdb_backend() should be replace by the this macro again after
+ * some releases.
+ * */
+const char *lp_passdb_backend()
+{
+ char *delim, *quote;
+ int pos, i;
+
+ delim = strchr( Globals.szPassdbBackend, ' ');
+ /* no space at all */
+ if (delim == NULL) {
+ goto out;
+ }
+
+ quote = strchr(Globals.szPassdbBackend, '"');
+ /* no quote char or non in the first part */
+ if (quote == NULL || quote > delim) {
+ *delim = '\0';
+ goto warn;
+ }
+
+ quote = strchr(quote+1, '"');
+ if (quote == NULL) {
+ DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
+ goto out;
+ } else if (*(quote+1) == '\0') {
+ /* space, fitting quote char, and one backend only */
+ goto out;
+ } else {
+ /* terminate string after the fitting quote char */
+ *(quote+1) = '\0';
+ }
+
+warn:
+ DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
+ "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
+ "Changes' from the ChangeNotes as part of the Samba HOWTO collection. The first part\n"
+ "(%s) of your configuration is used instead.\n", Globals.szPassdbBackend));
+
+out:
+ return Globals.szPassdbBackend;
+}
FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)