Hi, These patches both fix a bug I found in the current passdb backend system. Question, however is what to do whenever the initialisation of one backend fails. Have the whole passdb initialisation return NT_STATUS_UNSUCCESSFUL? Or return NT_STATUS_OK unless they all fail ?
The pdb_fix_strict.diff makes the passdb backend return NT_STATUS_UNSUCCESSFUL whenever at least one backend fails to be loaded. The pdb_fix_nonstrict.diff makes the passdb backend return NT_STATUS_OK if at least one backend loads successfully. Personally, I think we should be strict, because otherwise the user might not notice that the loading of a backend has failed. Jelmer -- Jelmer Vernooij <[EMAIL PROTECTED]> - http://nl.linux.org/~jelmer/ Development And Underdevelopment: http://library.thinkquest.org/C0110231/ 17:22:13 up 5 days, 16:36, 13 users, load average: 2.20, 2.29, 2.23
Index: source/passdb/pdb_interface.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/pdb_interface.c,v
retrieving revision 1.12
diff -u -3 -p -r1.12 pdb_interface.c
--- source/passdb/pdb_interface.c 13 Apr 2002 09:35:51 -0000 1.12
+++ source/passdb/pdb_interface.c 3 May 2002 13:36:50 -0000
@@ -240,7 +240,7 @@ static NTSTATUS make_pdb_methods_name(st
{
DEBUG(5,("Found pdb backend %s (at pos %d)\n", module_name,
i));
if (NT_STATUS_IS_OK(nt_status
- =
builtin_pdb_init_functions[i].init(context, methods, module_location))) {
+ =
+builtin_pdb_init_functions[i].init(context, methods, module_location))) {
DEBUG(5,("pdb backend %s has a valid init\n",
selected));
} else {
DEBUG(0,("pdb backend %s did not correctly init (error
was %s)\n", selected, nt_errstr(nt_status)));
@@ -251,9 +251,8 @@ static NTSTATUS make_pdb_methods_name(st
if (!*methods) {
DEBUG(0,("failed to select passdb backed!\n"));
- return nt_status;
}
- return NT_STATUS_OK;
+ return nt_status;
}
/******************************************************************
@@ -326,26 +325,27 @@ NTSTATUS make_pdb_context_name(struct pd
DEBUG(5,("Trying to load: %s\n", confcur));
if(!NT_STATUS_IS_OK(make_pdb_methods_name(&curmethods, *context,
confcur))){
DEBUG(5, ("Loading %s failed!\n", confcur));
- SAFE_FREE(curmethods);
- continue;
- }
- curmethods->parent = *context;
- DLIST_ADD_END((*context)->pdb_methods, curmethods, tmpmethods);
+ }else{
+ DEBUG(5, ("Loading %s succeeded!\n", confcur));
+ /* If at least one methods can be loaded, then
+ * this function should succeed */
+ nt_status = NT_STATUS_OK;
+ curmethods->parent = *context;
+ DLIST_ADD_END((*context)->pdb_methods, curmethods, tmpmethods);
+ }
if(!confnext)break;
confcur = confnext;
}
SAFE_FREE(conf);
-
- nt_status = NT_STATUS_OK;
-
+
return nt_status;
}
Index: source/passdb/pdb_interface.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/pdb_interface.c,v
retrieving revision 1.12
diff -u -3 -p -r1.12 pdb_interface.c
--- source/passdb/pdb_interface.c 13 Apr 2002 09:35:51 -0000 1.12
+++ source/passdb/pdb_interface.c 3 May 2002 13:36:50 -0000
@@ -240,7 +240,7 @@ static NTSTATUS make_pdb_methods_name(st
{
DEBUG(5,("Found pdb backend %s (at pos %d)\n", module_name,
i));
if (NT_STATUS_IS_OK(nt_status
- =
builtin_pdb_init_functions[i].init(context, methods, module_location))) {
+ =
+builtin_pdb_init_functions[i].init(context, methods, module_location))) {
DEBUG(5,("pdb backend %s has a valid init\n",
selected));
} else {
DEBUG(0,("pdb backend %s did not correctly init (error
was %s)\n", selected, nt_errstr(nt_status)));
@@ -251,9 +251,8 @@ static NTSTATUS make_pdb_methods_name(st
if (!*methods) {
DEBUG(0,("failed to select passdb backed!\n"));
- return nt_status;
}
- return NT_STATUS_OK;
+ return nt_status;
}
/******************************************************************
@@ -326,26 +325,27 @@ NTSTATUS make_pdb_context_name(struct pd
DEBUG(5,("Trying to load: %s\n", confcur));
if(!NT_STATUS_IS_OK(make_pdb_methods_name(&curmethods, *context,
confcur))){
DEBUG(5, ("Loading %s failed!\n", confcur));
- SAFE_FREE(curmethods);
- return NT_STATUS_UNSUCCESSFUL;
- }
- curmethods->parent = *context;
- DLIST_ADD_END((*context)->pdb_methods, curmethods, tmpmethods);
+ }else{
+ DEBUG(5, ("Loading %s succeeded!\n", confcur));
+ /* If at least one methods can be loaded, then
+ * this function should succeed */
+ nt_status = NT_STATUS_OK;
+ curmethods->parent = *context;
+ DLIST_ADD_END((*context)->pdb_methods, curmethods, tmpmethods);
+ }
if(!confnext)break;
confcur = confnext;
}
SAFE_FREE(conf);
-
- nt_status = NT_STATUS_OK;
-
+
return nt_status;
}
msg00938/pgp00000.pgp
Description: PGP signature
