summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-11-29 23:20:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:15 -0500
commited34ffb14792cc47ca1af5ffeb076f3c2d7f28dc (patch)
treef2cdb0d12e201655161b5a3973331cae1edaca17 /source3/nsswitch/winbindd.c
parent5893c0215d1c72ea9063b5e609d1c880dea0f1e8 (diff)
downloadsamba-ed34ffb14792cc47ca1af5ffeb076f3c2d7f28dc.tar.gz
samba-ed34ffb14792cc47ca1af5ffeb076f3c2d7f28dc.tar.bz2
samba-ed34ffb14792cc47ca1af5ffeb076f3c2d7f28dc.zip
r19957: Initial framework to make winbindd robust
against tdb corruption. Needs fleshing out (and I forgot one record type) and needs helpful suggestion from Volker to validate freelist, but should give an idea of how this will look. Jeremy. (This used to be commit 8eb53f74e414483afde7b1e38ea2a3f56ae3ec66)
Diffstat (limited to 'source3/nsswitch/winbindd.c')
-rw-r--r--source3/nsswitch/winbindd.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index e9e51449d6..41662900ce 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -879,7 +879,7 @@ static void process_loop(void)
struct winbindd_state server_state; /* Server state information */
-int main(int argc, char **argv)
+int main(int argc, char **argv, char **envp)
{
pstring logfile;
static BOOL Fork = True;
@@ -1022,6 +1022,17 @@ int main(int argc, char **argv)
pidfile_create("winbindd");
+ if (winbindd_validate_cache()) {
+ /* We have a bad cache, but luckily we
+ just deleted it. Restart ourselves */
+ int i;
+ /* Ensure we have no open low fd's. */
+ for (i = 3; i < 100; i++) {
+ close(i);
+ }
+ return execve(argv[0], argv, envp);
+ }
+
#if HAVE_SETPGID
/*
* If we're interactive we want to set our own process group for
@@ -1040,6 +1051,9 @@ int main(int argc, char **argv)
exit(1);
}
+ /* Ensure all cache and idmap caches are consistent
+ before we startup. */
+
/* React on 'smbcontrol winbindd reload-config' in the same way
as to SIGHUP signal */
message_register(MSG_SMB_CONF_UPDATED, msg_reload_services);