/*
Unix SMB/CIFS implementation.
Winbind child daemons
Copyright (C) Andrew Tridgell 2002
Copyright (C) Volker Lendecke 2004,2005
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* We fork a child per domain to be able to act non-blocking in the main
* winbind daemon. A domain controller thousands of miles away being being
* slow replying with a 10.000 user list should not hold up netlogon calls
* that can be handled locally.
*/
#include "includes.h"
#include "winbindd.h"
#include "rpc_client/rpc_client.h"
#include "nsswitch/wb_reqtrans.h"
#include "secrets.h"
#include "../lib/util/select.h"
#include "../libcli/security/security.h"
#include "system/select.h"
#include "messages.h"
#include "../lib/util/tevent_unix.h"
#include "lib/param/loadparm.h"
#include "lib/util/sys_rw.h"
#include "lib/util/sys_rw_data.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
extern bool override_logfile;
static struct winbindd_child *winbindd_children = NULL;
/* Read some data from a client connection */
static NTSTATUS child_read_request(int sock, struct winbindd_request *wreq)
{
NTSTATUS status;
status = read_data_ntstatus(sock, (char *)wreq, sizeof(*wreq));
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("child_read_request: read_data failed: %s\n",
nt_errstr(status)));
return status;
}
if (wreq->extra_len == 0) {
wreq->extra_data.data = NULL;
return NT_STATUS_OK;
}
DEBUG(10, ("Need to read %d extra bytes\n", (int)wreq->extra_len));
wreq->extra_data.data = SMB_MALLOC_ARRAY(char, wreq->extra_len + 1);
if (wreq->extra_data.data == NULL) {
DEBUG(0, ("malloc failed\n"));
return NT_STATUS_NO_MEMORY;
}
/* Ensure null termination */
wreq->extra_data.data[wreq->extra_len] = '\0';
status = read_data_ntstatus(sock, wreq->extra_data.data,
wreq->extra_len);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Could not read extra data: %s\n",
nt_errstr(status)));
}
return status;
}
static NTSTATUS child_write_response
|