*/
#include "includes.h"
-#include "serverid.h"
#include "messages.h"
#include "ntdomain.h"
-
-#include "lib/util/util_process.h"
+#include "passdb.h"
#include "lib/id_cache.h"
ev_ctx = talloc_get_type_abort(private_data, struct tevent_context);
change_to_root_user();
- lp_load(get_dyn_CONFIGFILE(), true, false, false, true);
+ lp_load_global(get_dyn_CONFIGFILE());
lsasd_reopen_logs(lsasd_child_id);
if (lsasd_child_id == 0) {
{
change_to_root_user();
- lp_load(get_dyn_CONFIGFILE(), true, false, false, true);
+ lp_load_global(get_dyn_CONFIGFILE());
lsasd_reopen_logs(lsasd_child_id);
pfh_daemon_config(DAEMON_NAME,
struct pf_worker_data *pf)
{
NTSTATUS status;
- struct messaging_context *msg_ctx = server_messaging_context();
+ struct messaging_context *msg_ctx = global_messaging_context();
bool ok;
status = reinit_after_fork(msg_ctx, ev_ctx,
- true);
+ true, "lsasd-child");
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
}
-
- prctl_set_comment("lsasd-child");
+ initialize_password_db(true, ev_ctx);
lsasd_child_id = child_id;
lsasd_reopen_logs(child_id);
return false;
}
- if (!serverid_register(messaging_server_id(msg_ctx),
- FLAG_MSG_GENERAL)) {
- return false;
- }
-
messaging_register(msg_ctx, ev_ctx,
MSG_SMB_CONF_UPDATED, lsasd_smb_conf_updated);
messaging_register(msg_ctx, ev_ctx,
status = rpc_lsarpc_init(NULL);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to register lsarpc rpc inteface! (%s)\n",
+ DEBUG(0, ("Failed to register lsarpc rpc interface! (%s)\n",
nt_errstr(status)));
return false;
}
status = rpc_samr_init(NULL);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to register samr rpc inteface! (%s)\n",
+ DEBUG(0, ("Failed to register samr rpc interface! (%s)\n",
nt_errstr(status)));
return false;
}
status = rpc_netlogon_init(NULL);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to register netlogon rpc inteface! (%s)\n",
+ DEBUG(0, ("Failed to register netlogon rpc interface! (%s)\n",
nt_errstr(status)));
return false;
}
(int)(data->pf->pid)));
if (tsocket_address_is_inet(srv_addr, "ip")) {
- DEBUG(3, ("Got a tcpip client connection from %s on inteface %s\n",
+ DEBUG(3, ("Got a tcpip client connection from %s on interface %s\n",
tsocket_address_string(cli_addr, tmp_ctx),
tsocket_address_string(srv_addr, tmp_ctx)));
uint32_t i;
int fd = -1;
int rc;
- bool ok = true;
+ bool ok = false;
tmp_ctx = talloc_stackframe();
if (tmp_ctx == NULL) {
status = dcerpc_binding_vector_new(tmp_ctx, &v_orig);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
listen_fd,
listen_fd_size);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on tcpip socket - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
}
/* LSARPC */
fd = create_named_pipe_socket("lsarpc");
if (fd < 0) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on lsarpc pipe - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
listen_fd[*listen_fd_size] = fd;
fd = create_named_pipe_socket("lsass");
if (fd < 0) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on lsass pipe - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
listen_fd[*listen_fd_size] = fd;
fd = create_dcerpc_ncalrpc_socket("lsarpc");
if (fd < 0) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on lsarpc ncalrpc - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
listen_fd[*listen_fd_size] = fd;
v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
if (v == NULL) {
- ok = false;
goto done;
}
status = dcerpc_binding_vector_replace_iface(&ndr_table_lsarpc, v);
if (!NT_STATUS_IS_OK(status)) {
- return false;
+ goto done;
}
status = dcerpc_binding_vector_add_np_default(&ndr_table_lsarpc, v);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "lsarpc");
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_lsarpc, v);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
/* SAMR */
fd = create_named_pipe_socket("samr");
if (fd < 0) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on samr pipe - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
listen_fd[*listen_fd_size] = fd;
fd = create_dcerpc_ncalrpc_socket("samr");
if (fd < 0) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on samr ncalrpc - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
listen_fd[*listen_fd_size] = fd;
v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
if (v == NULL) {
- ok = false;
goto done;
}
status = dcerpc_binding_vector_replace_iface(&ndr_table_samr, v);
if (!NT_STATUS_IS_OK(status)) {
- return false;
+ goto done;
}
status = dcerpc_binding_vector_add_np_default(&ndr_table_samr, v);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "samr");
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_samr, v);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
/* NETLOGON */
fd = create_named_pipe_socket("netlogon");
if (fd < 0) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on samr pipe - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
listen_fd[*listen_fd_size] = fd;
fd = create_dcerpc_ncalrpc_socket("netlogon");
if (fd < 0) {
- ok = false;
goto done;
}
if (rc == -1) {
DEBUG(0, ("Failed to listen on netlogon ncalrpc - %s\n",
strerror(errno)));
- ok = false;
goto done;
}
listen_fd[*listen_fd_size] = fd;
v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
if (v == NULL) {
- ok = false;
goto done;
}
status = dcerpc_binding_vector_replace_iface(&ndr_table_netlogon, v);
if (!NT_STATUS_IS_OK(status)) {
- return false;
+ goto done;
}
status = dcerpc_binding_vector_add_np_default(&ndr_table_netlogon, v);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "netlogon");
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_netlogon, v);
if (!NT_STATUS_IS_OK(status)) {
- ok = false;
goto done;
}
+ ok = true;
done:
if (fd != -1) {
close(fd);
return;
}
- status = reinit_after_fork(msg_ctx,
- ev_ctx,
- true);
+ status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true, "lsasd-master");
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
}
-
- prctl_set_comment("lsasd-master");
+ initialize_password_db(true, ev_ctx);
/* save the parent process id so the children can use it later */
parent_id = messaging_server_id(msg_ctx);
exit(1);
}
- if (!serverid_register(messaging_server_id(msg_ctx),
- FLAG_MSG_GENERAL)) {
- exit(1);
- }
-
messaging_register(msg_ctx,
ev_ctx,
MSG_SMB_CONF_UPDATED,
status = rpc_lsarpc_init(NULL);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to register lsarpc rpc inteface in lsasd! (%s)\n",
+ DEBUG(0, ("Failed to register lsarpc rpc interface in lsasd! (%s)\n",
nt_errstr(status)));
exit(1);
}
status = rpc_samr_init(NULL);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to register samr rpc inteface in lsasd! (%s)\n",
+ DEBUG(0, ("Failed to register samr rpc interface in lsasd! (%s)\n",
nt_errstr(status)));
exit(1);
}
status = rpc_netlogon_init(NULL);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to register netlogon rpc inteface in lsasd! (%s)\n",
+ DEBUG(0, ("Failed to register netlogon rpc interface in lsasd! (%s)\n",
nt_errstr(status)));
exit(1);
}