Add the 'guest' passdb backend automatically if
authorVolker Lendecke <vlendec@samba.org>
Mon, 30 Jun 2003 14:55:45 +0000 (14:55 +0000)
committerVolker Lendecke <vlendec@samba.org>
Mon, 30 Jun 2003 14:55:45 +0000 (14:55 +0000)
guest account != ""

Volker
(This used to be commit 21d330af107f744af9569b5577afc6e7ba6a269c)

docs/docbook/smbdotconf/security/passdbbackend.xml
source3/param/loadparm.c
source3/passdb/pdb_interface.c

index 21355f98ace217853e001c7e33ba52a9be71a111..1a3a83946ad285322c9cd01a6e6f730c38a19964 100644 (file)
@@ -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>
 
index 95f6896e6b43fbe1076433c21c61f76781c839c4..d6e24dfc3c6e7f962411dd862b6c5e5d403b0c3c 100644 (file)
@@ -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, "");
index 9d24a42a9818ef7984a3db592122ec87528b3db0..5ebc14030f06cf9e2fed55f5526ae53d654780f3 100644 (file)
@@ -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;
 }