diff options
author | Volker Lendecke <vlendec@samba.org> | 2003-06-30 14:55:45 +0000 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2003-06-30 14:55:45 +0000 |
commit | aca3fa914928bdb1b7ea091ffe169a4e74b213d0 (patch) | |
tree | 8fe6b3f2a67514a5b3fd6c4521e2e56fb8dde7a4 | |
parent | 9d4b66c9744297b7daf52177d2561f14e0579a2f (diff) | |
download | samba-aca3fa914928bdb1b7ea091ffe169a4e74b213d0.tar.gz samba-aca3fa914928bdb1b7ea091ffe169a4e74b213d0.tar.bz2 samba-aca3fa914928bdb1b7ea091ffe169a4e74b213d0.zip |
Add the 'guest' passdb backend automatically if
guest account != ""
Volker
(This used to be commit 21d330af107f744af9569b5577afc6e7ba6a269c)
-rw-r--r-- | docs/docbook/smbdotconf/security/passdbbackend.xml | 2 | ||||
-rw-r--r-- | source3/param/loadparm.c | 4 | ||||
-rw-r--r-- | source3/passdb/pdb_interface.c | 25 |
3 files changed, 28 insertions, 3 deletions
diff --git a/docs/docbook/smbdotconf/security/passdbbackend.xml b/docs/docbook/smbdotconf/security/passdbbackend.xml index 21355f98ac..1a3a83946a 100644 --- a/docs/docbook/smbdotconf/security/passdbbackend.xml +++ b/docs/docbook/smbdotconf/security/passdbbackend.xml @@ -65,7 +65,7 @@ </itemizedlist> </para> - <para>Default: <command moreinfo="none">passdb backend = smbpasswd guest</command></para> + <para>Default: <command moreinfo="none">passdb backend = smbpasswd</command></para> <para>Example: <command moreinfo="none">passdb backend = tdbsam:/etc/samba/private/passdb.tdb smbpasswd:/etc/samba/smbpasswd guest</command></para> diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 95f6896e6b..d6e24dfc3c 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1419,9 +1419,9 @@ static void init_globals(void) #ifdef WITH_LDAP_SAMCONFIG string_set(&Globals.szLdapServer, "localhost"); Globals.ldap_port = 636; - Globals.szPassdbBackend = str_list_make("ldapsam_compat guest", NULL); + Globals.szPassdbBackend = str_list_make("ldapsam_compat", NULL); #else - Globals.szPassdbBackend = str_list_make("smbpasswd guest", NULL); + Globals.szPassdbBackend = str_list_make("smbpasswd", NULL); #endif /* WITH_LDAP_SAMCONFIG */ string_set(&Globals.szLdapSuffix, ""); diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 9d24a42a98..5ebc14030f 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -516,6 +516,7 @@ NTSTATUS make_pdb_context_list(struct pdb_context **context, const char **select int i = 0; struct pdb_methods *curmethods, *tmpmethods; NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; + BOOL have_guest = False; if (!NT_STATUS_IS_OK(nt_status = make_pdb_context(context))) { return nt_status; @@ -527,6 +528,9 @@ NTSTATUS make_pdb_context_list(struct pdb_context **context, const char **select } while (selected[i]){ + if (strcmp(selected[i], "guest") == 0) { + have_guest = True; + } /* Try to initialise pdb */ DEBUG(5,("Trying to load: %s\n", selected[i])); if (!NT_STATUS_IS_OK(nt_status = make_pdb_methods_name(&curmethods, *context, selected[i]))) { @@ -539,6 +543,27 @@ NTSTATUS make_pdb_context_list(struct pdb_context **context, const char **select i++; } + if (have_guest) + return NT_STATUS_OK; + + if ( (lp_guestaccount() == NULL) || + (*lp_guestaccount() == '\0') ) { + /* We explicitly don't want guest access. No idea what + else that breaks, but be it that way. */ + return NT_STATUS_OK; + } + + if (!NT_STATUS_IS_OK(nt_status = make_pdb_methods_name(&curmethods, + *context, + "guest"))) { + DEBUG(1, ("Loading guest module failed!\n")); + free_pdb_context(context); + return nt_status; + } + + curmethods->parent = *context; + DLIST_ADD_END((*context)->pdb_methods, curmethods, tmpmethods); + return NT_STATUS_OK; } |