mirror of
https://github.com/samba-team/samba.git
synced 2025-03-22 02:50:28 +03:00
s3:rpc_server: Activate samba-dcerpcd
This is the big switch to use samba-dcerpcd for the RPC services in source3/. It is a pretty big and unordered patch, but I don't see a good way to split this up into more manageable pieces without sacrificing bisectability even more. Probably I could cut out a few small ones, but a major architechtural switch like this will always be messy. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
d522a8cce1
commit
a7c65958a1
@ -19,7 +19,7 @@ bld.SAMBA_BINARY('fuzz_tiniparser',
|
||||
|
||||
bld.SAMBA_BINARY('fuzz_parse_lpq_entry',
|
||||
source='fuzz_parse_lpq_entry.c',
|
||||
deps='fuzzing afl-fuzz-main smbd_base',
|
||||
deps='fuzzing afl-fuzz-main smbd_base PRINTING',
|
||||
fuzzer=True)
|
||||
|
||||
bld.SAMBA_BINARY('fuzz_oLschema2ldif',
|
||||
|
@ -464,73 +464,11 @@ sub boilerplate_ep_server($)
|
||||
my $name = $interface->{NAME};
|
||||
my $uname = uc $name;
|
||||
|
||||
$self->pidl("static NTSTATUS $name\__check_register_in_endpoint(const char *name, struct dcerpc_binding *binding) {");
|
||||
$self->indent();
|
||||
$self->pidl("enum dcerpc_transport_t transport = dcerpc_binding_get_transport(binding);");
|
||||
$self->pidl("NTSTATUS status;");
|
||||
$self->pidl("");
|
||||
$self->pidl("/* If service is disabled, do not register */");
|
||||
$self->pidl("if (rpc_service_mode(name) == RPC_SERVICE_MODE_DISABLED) {");
|
||||
$self->indent();
|
||||
$self->pidl("return NT_STATUS_NOT_IMPLEMENTED;");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
|
||||
$self->pidl("");
|
||||
$self->pidl("/* If service is embedded, register only for ncacn_np");
|
||||
$self->pidl(" * see 8466b3c85e4b835e57e41776853093f4a0edc8b8");
|
||||
$self->pidl(" */");
|
||||
$self->pidl("if (rpc_service_mode(name) == RPC_SERVICE_MODE_EMBEDDED && (transport != NCACN_NP && transport != NCALRPC)) {");
|
||||
$self->indent();
|
||||
$self->pidl("DBG_INFO(\"Interface \'$name\' not registered in endpoint \'%s\' as service is embedded\\n\", name);");
|
||||
$self->pidl("return NT_STATUS_NOT_SUPPORTED;");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
|
||||
$self->pidl("");
|
||||
$self->pidl("/*");
|
||||
$self->pidl(" * If rpc service is external then change the default ncalrpc endpoint,");
|
||||
$self->pidl(" * otherwise if the rpc daemon running this service is configured in");
|
||||
$self->pidl(" * fork mode the forked process will race with main smbd to accept the");
|
||||
$self->pidl(" * connections in the default ncalrpc socket, and the forked process");
|
||||
$self->pidl(" * may not have the requested interface registered.");
|
||||
$self->pidl(" * For example, in the ad_member test environment:");
|
||||
$self->pidl(" *");
|
||||
$self->pidl(" * rpc_server:lsarpc = external");
|
||||
$self->pidl(" * rpc_server:samr = external");
|
||||
$self->pidl(" * rpc_server:netlogon = disabled");
|
||||
$self->pidl(" * rpc_daemon:lsasd = fork");
|
||||
$self->pidl(" *");
|
||||
$self->pidl(" * With these settings both, the main smbd and all the preforked lsasd");
|
||||
$self->pidl(" * processes would be listening in the default ncalrpc socket if it is");
|
||||
$self->pidl(" * not changed. If a client connection is accepted by one of the lsasd");
|
||||
$self->pidl(" * worker processes and the client asks for an interface not registered");
|
||||
$self->pidl(" * in these processes (winreg for example) it will get an error.");
|
||||
$self->pidl(" */");
|
||||
$self->pidl("if (rpc_service_mode(name) == RPC_SERVICE_MODE_EXTERNAL && transport == NCALRPC) {");
|
||||
$self->indent();
|
||||
$self->pidl("status = dcerpc_binding_set_string_option(binding, \"endpoint\", \"$uname\");");
|
||||
$self->pidl("if (!NT_STATUS_IS_OK(status)) {");
|
||||
$self->indent();
|
||||
$self->pidl("return status;");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
|
||||
$self->pidl("");
|
||||
$self->pidl("return NT_STATUS_OK;");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
$self->pidl("");
|
||||
|
||||
$self->pidl("static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)");
|
||||
$self->pidl("{");
|
||||
$self->indent();
|
||||
$self->pidl("uint32_t i;");
|
||||
$self->pidl("NTSTATUS ret;");
|
||||
$self->pidl("struct dcerpc_binding *binding;");
|
||||
$self->pidl("struct dcerpc_binding *binding2 = NULL;");
|
||||
$self->pidl("");
|
||||
$self->pidlnoindent("#ifdef DCESRV_INTERFACE_$uname\_NCACN_NP_SECONDARY_ENDPOINT");
|
||||
$self->pidl("const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_$uname\_NCACN_NP_SECONDARY_ENDPOINT;");
|
||||
@ -542,40 +480,7 @@ sub boilerplate_ep_server($)
|
||||
$self->indent();
|
||||
$self->pidl("const char *name = ndr_table_$name.endpoints->names[i];");
|
||||
$self->pidl("");
|
||||
$self->pidl("ret = dcerpc_parse_binding(dce_ctx, name, &binding);");
|
||||
$self->pidl("if (NT_STATUS_IS_ERR(ret)) {");
|
||||
$self->indent();
|
||||
$self->pidl("DBG_ERR(\"Failed to parse binding string \'%s\'\\n\", name);");
|
||||
$self->pidl("return ret;");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
$self->pidl("");
|
||||
$self->pidl("ret = $name\__check_register_in_endpoint(\"$name\", binding);");
|
||||
$self->pidl("if (NT_STATUS_IS_ERR(ret)) {");
|
||||
$self->indent();
|
||||
$self->pidl("talloc_free(binding);");
|
||||
$self->pidl("continue;");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
$self->pidl("");
|
||||
|
||||
$self->pidl("if (ncacn_np_secondary_endpoint != NULL) {");
|
||||
$self->indent();
|
||||
$self->pidl("ret = dcerpc_parse_binding(dce_ctx, ncacn_np_secondary_endpoint, &binding2);");
|
||||
$self->pidl("if (NT_STATUS_IS_ERR(ret)) {");
|
||||
$self->indent();
|
||||
$self->pidl("DBG_ERR(\"Failed to parse 2nd binding string \'%s\'\\n\", ncacn_np_secondary_endpoint);");
|
||||
$self->pidl("TALLOC_FREE(binding);");
|
||||
$self->pidl("return ret;");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
$self->deindent();
|
||||
$self->pidl("}");
|
||||
$self->pidl("");
|
||||
|
||||
$self->pidl("ret = dcesrv_interface_register_b(dce_ctx, binding, binding2, &dcesrv_$name\_interface, NULL);");
|
||||
$self->pidl("TALLOC_FREE(binding);");
|
||||
$self->pidl("TALLOC_FREE(binding2);");
|
||||
$self->pidl("ret = dcesrv_interface_register(dce_ctx, name, ncacn_np_secondary_endpoint, &dcesrv_$name\_interface, NULL);");
|
||||
$self->pidl("if (!NT_STATUS_IS_OK(ret)) {");
|
||||
$self->indent();
|
||||
$self->pidl("DBG_ERR(\"Failed to register endpoint \'%s\'\\n\",name);");
|
||||
|
@ -45,7 +45,7 @@ cleanup() {
|
||||
}
|
||||
|
||||
case $ENVNAME in
|
||||
*.nmbd|*.smbd|*.winbindd|*.samba)
|
||||
*.nmbd|*.smbd|*.winbindd|*.samba|*.samba_dcerpcd)
|
||||
kill $(cat $basedir/../"${ENVNAME%\.*}"/pid/"${ENVNAME##*\.}".pid)
|
||||
;;
|
||||
esac
|
||||
@ -81,7 +81,7 @@ read stdin_var
|
||||
echo "$(date) EOF on stdin" >> $basedir/$SERVERNAME.log
|
||||
|
||||
case $ENVNAME in
|
||||
*.nmbd|*.smbd|*.winbindd|*.samba)
|
||||
*.nmbd|*.smbd|*.winbindd|*.samba|*.samba_dcerpcd)
|
||||
kill $(cat $basedir/../"${ENVNAME%\.*}"/pid/"${ENVNAME##*\.}".pid)
|
||||
;;
|
||||
esac
|
||||
|
@ -90,6 +90,7 @@
|
||||
^samba4.rpc.epmapper.*.Lookup_simple
|
||||
^samba4.rpc.epmapper.*.Map_simple
|
||||
^samba4.rpc.epmapper.*.Map_full
|
||||
^samba3.rpc.epmapper.*.Map_full
|
||||
^samba4.rpc.lsalookup on ncalrpc
|
||||
^samba4.rpc.lsalookup on ncacn_np
|
||||
^samba4.rpc.lsalookup with seal,padcheck
|
||||
@ -342,11 +343,6 @@
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_no_auth_presentation_ctx_invalid4
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_spnego_change_auth_type2
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_spnego_change_transfer
|
||||
# Association groups between processes not implemented yet in s3 server implementation
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_assoc_group_ok2\(ad_member\)
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_assoc_group_fail1\(ad_member\)
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_assoc_group_fail2\(ad_member\)
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_assoc_group_fail3\(ad_member\)
|
||||
# NETLOGON is disabled in any non-DC environments
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_2nd_cancel_requests\(ad_member\)
|
||||
^samba.tests.dcerpc.raw_protocol.*.TestDCERPC_BIND.test_first_08_requests\(ad_member\)
|
||||
@ -370,7 +366,6 @@
|
||||
^samba4.rpc.echo.*on.*with.object.echo.enum.*nt4_dc
|
||||
^samba4.rpc.echo.*on.*with.object.echo.testcall.*nt4_dc
|
||||
^samba4.rpc.echo.*on.*with.object.echo.testcall2.*nt4_dc
|
||||
^samba4.rpc.echo.*on.*ncacn_ip_tcp.*with.object.*nt4_dc
|
||||
^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_add_duplicate_different_type.*
|
||||
^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_rank_none.*
|
||||
^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_security_descriptor.*
|
||||
|
@ -97,44 +97,54 @@ sub teardown_env_samba($$)
|
||||
my $smbdpid = $envvars->{SMBD_TL_PID};
|
||||
my $nmbdpid = $envvars->{NMBD_TL_PID};
|
||||
my $winbinddpid = $envvars->{WINBINDD_TL_PID};
|
||||
my $samba_dcerpcdpid = $envvars->{SAMBA_DCERPCD_TL_PID};
|
||||
|
||||
# This should give it time to write out the gcov data
|
||||
until ($count > 20) {
|
||||
my $smbdchild = Samba::cleanup_child($smbdpid, "smbd");
|
||||
my $nmbdchild = Samba::cleanup_child($nmbdpid, "nmbd");
|
||||
my $winbinddchild = Samba::cleanup_child($winbinddpid, "winbindd");
|
||||
my $samba_dcerpcdchild = Samba::cleanup_child(
|
||||
$samba_dcerpcdpid, "samba-dcerpcd");
|
||||
if ($smbdchild == -1
|
||||
&& $nmbdchild == -1
|
||||
&& $winbinddchild == -1) {
|
||||
&& $winbinddchild == -1
|
||||
&& $samba_dcerpcdpid == -1) {
|
||||
last;
|
||||
}
|
||||
sleep(1);
|
||||
$count++;
|
||||
}
|
||||
|
||||
if ($count <= 20 && kill(0, $smbdpid, $nmbdpid, $winbinddpid) == 0) {
|
||||
if ($count <= 20 &&
|
||||
kill(0, $smbdpid, $nmbdpid, $winbinddpid, $samba_dcerpcdpid) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$self->stop_sig_term($smbdpid);
|
||||
$self->stop_sig_term($nmbdpid);
|
||||
$self->stop_sig_term($winbinddpid);
|
||||
$self->stop_sig_term($samba_dcerpcdpid);
|
||||
|
||||
$count = 0;
|
||||
until ($count > 10) {
|
||||
my $smbdchild = Samba::cleanup_child($smbdpid, "smbd");
|
||||
my $nmbdchild = Samba::cleanup_child($nmbdpid, "nmbd");
|
||||
my $winbinddchild = Samba::cleanup_child($winbinddpid, "winbindd");
|
||||
my $samba_dcerpcdpid = Samba::cleanup_child(
|
||||
$samba_dcerpcdpid, "samba-dcerpcd");
|
||||
if ($smbdchild == -1
|
||||
&& $nmbdchild == -1
|
||||
&& $winbinddchild == -1) {
|
||||
&& $winbinddchild == -1
|
||||
&& $samba_dcerpcdpid == -1) {
|
||||
last;
|
||||
}
|
||||
sleep(1);
|
||||
$count++;
|
||||
}
|
||||
|
||||
if ($count <= 10 && kill(0, $smbdpid, $nmbdpid, $winbinddpid) == 0) {
|
||||
if ($count <= 10 &&
|
||||
kill(0, $smbdpid, $nmbdpid, $winbinddpid, $samba_dcerpcdpid) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -142,6 +152,7 @@ sub teardown_env_samba($$)
|
||||
$self->stop_sig_kill($smbdpid);
|
||||
$self->stop_sig_kill($nmbdpid);
|
||||
$self->stop_sig_kill($winbinddpid);
|
||||
$self->stop_sig_kill($samba_dcerpcdpid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -261,19 +272,8 @@ sub setup_nt4_dc
|
||||
ntlm auth = yes
|
||||
raw NTLMv2 auth = yes
|
||||
server schannel = auto
|
||||
rpc start on demand helpers = false
|
||||
|
||||
rpc_server:epmapper = external
|
||||
rpc_server:spoolss = external
|
||||
rpc_server:lsarpc = external
|
||||
rpc_server:samr = external
|
||||
rpc_server:netlogon = external
|
||||
rpc_server:register_embedded_np = yes
|
||||
rpc_server:FssagentRpc = external
|
||||
|
||||
rpc_daemon:epmd = fork
|
||||
rpc_daemon:spoolssd = fork
|
||||
rpc_daemon:lsasd = fork
|
||||
rpc_daemon:fssd = fork
|
||||
fss: sequence timeout = 1
|
||||
check parent directory delete on close = yes
|
||||
";
|
||||
@ -295,6 +295,7 @@ sub setup_nt4_dc
|
||||
|
||||
if (not $self->check_or_start(
|
||||
env_vars => $vars,
|
||||
samba_dcerpcd => "yes",
|
||||
nmbd => "yes",
|
||||
winbindd => "yes",
|
||||
smbd => "yes")) {
|
||||
@ -340,17 +341,6 @@ sub setup_nt4_dc_schannel
|
||||
domain logons = yes
|
||||
lanman auth = yes
|
||||
|
||||
rpc_server:epmapper = external
|
||||
rpc_server:spoolss = external
|
||||
rpc_server:lsarpc = external
|
||||
rpc_server:samr = external
|
||||
rpc_server:netlogon = external
|
||||
rpc_server:register_embedded_np = yes
|
||||
|
||||
rpc_daemon:epmd = fork
|
||||
rpc_daemon:spoolssd = fork
|
||||
rpc_daemon:lsasd = fork
|
||||
|
||||
server schannel = yes
|
||||
# used to reproduce bug #12772
|
||||
server max protocol = SMB2_02
|
||||
@ -722,15 +712,7 @@ sub provision_ad_member
|
||||
|
||||
allow dcerpc auth level connect:lsarpc = yes
|
||||
dcesrv:max auth states = 8
|
||||
|
||||
rpc_server:epmapper = external
|
||||
rpc_server:lsarpc = external
|
||||
rpc_server:samr = external
|
||||
rpc_server:netlogon = disabled
|
||||
rpc_server:register_embedded_np = yes
|
||||
|
||||
rpc_daemon:epmd = fork
|
||||
rpc_daemon:lsasd = fork
|
||||
rpc start on demand helpers = false
|
||||
|
||||
# Begin extra member options
|
||||
$extra_member_options
|
||||
@ -944,6 +926,7 @@ sub provision_ad_member
|
||||
|
||||
if (not $self->check_or_start(
|
||||
env_vars => $ret,
|
||||
samba_dcerpcd => "yes",
|
||||
nmbd => "yes",
|
||||
winbindd => "yes",
|
||||
smbd => "yes")) {
|
||||
@ -2200,6 +2183,7 @@ sub check_or_start($$) {
|
||||
my $nmbd = $args{nmbd} // "no";
|
||||
my $winbindd = $args{winbindd} // "no";
|
||||
my $smbd = $args{smbd} // "no";
|
||||
my $samba_dcerpcd = $args{samba_dcerpcd} // "no";
|
||||
my $child_cleanup = $args{child_cleanup};
|
||||
|
||||
my $STDIN_READER;
|
||||
@ -2209,16 +2193,47 @@ sub check_or_start($$) {
|
||||
# exit when the test script exits
|
||||
pipe($STDIN_READER, $env_vars->{STDIN_PIPE});
|
||||
|
||||
my $binary = Samba::bindir_path($self, "nmbd");
|
||||
my @full_cmd = $self->make_bin_cmd($binary, $env_vars,
|
||||
$ENV{NMBD_OPTIONS}, $ENV{NMBD_VALGRIND},
|
||||
$ENV{NMBD_DONT_LOG_STDOUT});
|
||||
my $binary = Samba::bindir_path($self, "samba-dcerpcd");
|
||||
my @full_cmd = $self->make_bin_cmd(
|
||||
$binary,
|
||||
$env_vars,
|
||||
$ENV{SAMBA_DCERPCD_OPTIONS},
|
||||
$ENV{SAMBA_DCERPCD_VALGRIND},
|
||||
$ENV{SAMBA_DCERPCD_DONT_LOG_STDOUT});
|
||||
push(@full_cmd, '--libexec-rpcds');
|
||||
|
||||
my $samba_dcerpcd_envs = Samba::get_env_for_process(
|
||||
"samba_dcerpcd", $env_vars);
|
||||
|
||||
# fork and exec() samba_dcerpcd in the child process
|
||||
my $daemon_ctx = {
|
||||
NAME => "samba_dcerpcd",
|
||||
BINARY_PATH => $binary,
|
||||
FULL_CMD => [ @full_cmd ],
|
||||
LOG_FILE => $env_vars->{SAMBA_DCERPCD_TEST_LOG},
|
||||
PCAP_FILE => "env-$ENV{ENVNAME}-samba_dcerpcd",
|
||||
ENV_VARS => $samba_dcerpcd_envs,
|
||||
};
|
||||
if ($samba_dcerpcd ne "yes") {
|
||||
$daemon_ctx->{SKIP_DAEMON} = 1;
|
||||
}
|
||||
|
||||
my $pid = Samba::fork_and_exec(
|
||||
$self, $env_vars, $daemon_ctx, $STDIN_READER, $child_cleanup);
|
||||
|
||||
$env_vars->{SAMBA_DCERPCD_TL_PID} = $pid;
|
||||
write_pid($env_vars, "samba_dcerpcd", $pid);
|
||||
|
||||
$binary = Samba::bindir_path($self, "nmbd");
|
||||
@full_cmd = $self->make_bin_cmd($binary, $env_vars,
|
||||
$ENV{NMBD_OPTIONS}, $ENV{NMBD_VALGRIND},
|
||||
$ENV{NMBD_DONT_LOG_STDOUT});
|
||||
my $nmbd_envs = Samba::get_env_for_process("nmbd", $env_vars);
|
||||
delete $nmbd_envs->{RESOLV_WRAPPER_CONF};
|
||||
delete $nmbd_envs->{RESOLV_WRAPPER_HOSTS};
|
||||
|
||||
# fork and exec() nmbd in the child process
|
||||
my $daemon_ctx = {
|
||||
$daemon_ctx = {
|
||||
NAME => "nmbd",
|
||||
BINARY_PATH => $binary,
|
||||
FULL_CMD => [ @full_cmd ],
|
||||
@ -2229,7 +2244,7 @@ sub check_or_start($$) {
|
||||
if ($nmbd ne "yes") {
|
||||
$daemon_ctx->{SKIP_DAEMON} = 1;
|
||||
}
|
||||
my $pid = Samba::fork_and_exec(
|
||||
$pid = Samba::fork_and_exec(
|
||||
$self, $env_vars, $daemon_ctx, $STDIN_READER, $child_cleanup);
|
||||
|
||||
$env_vars->{NMBD_TL_PID} = $pid;
|
||||
@ -2285,7 +2300,11 @@ sub check_or_start($$) {
|
||||
# close the parent's read-end of the pipe
|
||||
close($STDIN_READER);
|
||||
|
||||
return $self->wait_for_start($env_vars, $nmbd, $winbindd, $smbd);
|
||||
return $self->wait_for_start($env_vars,
|
||||
$nmbd,
|
||||
$winbindd,
|
||||
$smbd,
|
||||
$samba_dcerpcd);
|
||||
}
|
||||
|
||||
sub createuser($$$$$)
|
||||
@ -3402,6 +3421,8 @@ force_user:x:$gid_force_user:
|
||||
|
||||
$ret{SERVER_IP} = $server_ip;
|
||||
$ret{SERVER_IPV6} = $server_ipv6;
|
||||
$ret{SAMBA_DCERPCD_TEST_LOG} = "$prefix/samba_dcerpcd_test.log";
|
||||
$ret{SAMBA_DCERPCD_LOG_POS} = 0;
|
||||
$ret{NMBD_TEST_LOG} = "$prefix/nmbd_test.log";
|
||||
$ret{NMBD_TEST_LOG_POS} = 0;
|
||||
$ret{WINBINDD_TEST_LOG} = "$prefix/winbindd_test.log";
|
||||
@ -3454,11 +3475,33 @@ force_user:x:$gid_force_user:
|
||||
|
||||
sub wait_for_start($$$$$)
|
||||
{
|
||||
my ($self, $envvars, $nmbd, $winbindd, $smbd) = @_;
|
||||
my ($self, $envvars, $nmbd, $winbindd, $smbd, $samba_dcerpcd) = @_;
|
||||
my $cmd;
|
||||
my $netcmd;
|
||||
my $ret;
|
||||
|
||||
if ($samba_dcerpcd eq "yes") {
|
||||
my $count = 0;
|
||||
my $rpcclient = Samba::bindir_path($self, "rpcclient");
|
||||
|
||||
print "checking for samba_dcerpcd\n";
|
||||
|
||||
do {
|
||||
$ret = system("$rpcclient $envvars->{CONFIGURATION} ncalrpc: -c epmmap");
|
||||
|
||||
if ($ret != 0) {
|
||||
sleep(1);
|
||||
}
|
||||
$count++
|
||||
} while ($ret != 0 && $count < 10);
|
||||
|
||||
if ($count == 10) {
|
||||
print "samba_dcerpcd not reachable after 10 retries\n";
|
||||
teardown_env($self, $envvars);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($nmbd eq "yes") {
|
||||
my $count = 0;
|
||||
|
||||
|
@ -202,6 +202,7 @@ def cmd_testonly(opt):
|
||||
os.environ['NMBD_VALGRIND'] = EXPAND_VARIABLES(opt, server_wrapper)
|
||||
os.environ['WINBINDD_VALGRIND'] = EXPAND_VARIABLES(opt, server_wrapper)
|
||||
os.environ['SMBD_VALGRIND'] = EXPAND_VARIABLES(opt, server_wrapper)
|
||||
os.environ['SAMBA_DCERPCD_VALGRIND'] = EXPAND_VARIABLES(opt, server_wrapper)
|
||||
|
||||
# this is needed for systems without rpath, or with rpath disabled
|
||||
ADD_LD_LIBRARY_PATH('bin/shared')
|
||||
|
@ -33,7 +33,7 @@ bld.SAMBA3_SUBSYSTEM(pyparam_util,
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('param_service',
|
||||
source='service.c',
|
||||
deps = 'USER_UTIL smbconf PRINTING')
|
||||
deps = 'USER_UTIL smbconf')
|
||||
|
||||
bld.SAMBA3_BINARY('test_lp_load',
|
||||
source='test_lp_load.c',
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "smbd/smbd.h"
|
||||
#include "rpc_server/rpc_config.h"
|
||||
#include "printing/load.h"
|
||||
#include "printing/spoolssd.h"
|
||||
#include "rpc_server/spoolss/srv_spoolss_nt.h"
|
||||
#include "auth.h"
|
||||
#include "nt_printing.h"
|
||||
@ -369,7 +368,7 @@ pid_t start_background_queue(struct tevent_context *ev,
|
||||
str_list_add_printf(
|
||||
&argv, "--ready-signal-fd=%d", ready_fds[1]);
|
||||
str_list_add_printf(
|
||||
&argv, "--parent-watch-fd=%d", parent_watch_fd());
|
||||
&argv, "--parent-watch-fd=%d", 0);
|
||||
str_list_add_printf(
|
||||
&argv, "--debuglevel=%d", debuglevel_get_class(DBGC_RPC_SRV));
|
||||
if (!is_default_dyn_CONFIGFILE()) {
|
||||
@ -418,8 +417,7 @@ fail:
|
||||
bool printing_subsystem_init(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
bool start_daemons,
|
||||
bool background_queue)
|
||||
bool start_daemons)
|
||||
{
|
||||
pid_t pid = -1;
|
||||
|
||||
@ -429,15 +427,7 @@ bool printing_subsystem_init(struct tevent_context *ev_ctx,
|
||||
|
||||
/* start spoolss daemon */
|
||||
/* start as a separate daemon only if enabled */
|
||||
if (start_daemons && rpc_spoolss_daemon() == RPC_DAEMON_FORK) {
|
||||
|
||||
pid = start_spoolssd(ev_ctx, msg_ctx, dce_ctx);
|
||||
|
||||
} else if (start_daemons && background_queue) {
|
||||
|
||||
pid = start_background_queue(ev_ctx, msg_ctx, NULL);
|
||||
|
||||
} else {
|
||||
if (!start_daemons) {
|
||||
bool ret;
|
||||
struct bq_state *state;
|
||||
|
||||
@ -457,6 +447,7 @@ bool printing_subsystem_init(struct tevent_context *ev_ctx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
pid = start_background_queue(NULL, NULL, NULL);
|
||||
if (pid == -1) {
|
||||
return false;
|
||||
}
|
||||
@ -465,24 +456,6 @@ bool printing_subsystem_init(struct tevent_context *ev_ctx,
|
||||
return true;
|
||||
}
|
||||
|
||||
void printing_subsystem_update(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
bool force)
|
||||
{
|
||||
if (background_lpq_updater_pid != -1) {
|
||||
load_printers();
|
||||
if (force) {
|
||||
/* Send a sighup to the background process.
|
||||
* this will force it to reload printers */
|
||||
kill(background_lpq_updater_pid, SIGHUP);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
pcap_cache_reload(ev_ctx, msg_ctx,
|
||||
delete_and_reload_printers_full);
|
||||
}
|
||||
|
||||
void send_to_bgqd(struct messaging_context *msg_ctx,
|
||||
uint32_t msg_type,
|
||||
const uint8_t *buf,
|
||||
|
@ -28,11 +28,7 @@ struct dcesrv_context;
|
||||
bool printing_subsystem_init(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
bool start_daemons,
|
||||
bool background_queue);
|
||||
void printing_subsystem_update(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
bool force);
|
||||
bool start_daemons);
|
||||
pid_t start_background_queue(struct tevent_context *ev,
|
||||
struct messaging_context *msg,
|
||||
char *logfile);
|
||||
|
@ -1033,14 +1033,8 @@ static NTSTATUS eventlog_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
struct messaging_context *msg_ctx = global_messaging_context();
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
|
||||
status = dcesrv_init_ep_server(dce_ctx, "winreg");
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
ok = eventlog_init_winreg(msg_ctx);
|
||||
if (!ok) {
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
|
@ -21,9 +21,7 @@
|
||||
#include "messages.h"
|
||||
#include "ntdomain.h"
|
||||
#include "rpc_server/rpc_server.h"
|
||||
#include "rpc_server/rpc_service_setup.h"
|
||||
#include "rpc_server/rpc_config.h"
|
||||
#include "rpc_server/rpc_modules.h"
|
||||
#include "rpc_server/mdssvc/srv_mdssvc_nt.h"
|
||||
#include "libcli/security/security_token.h"
|
||||
#include "libcli/security/dom_sid.h"
|
||||
@ -39,50 +37,6 @@
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_SRV
|
||||
|
||||
static bool rpc_setup_mdssvc(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx)
|
||||
{
|
||||
const struct ndr_interface_table *t = &ndr_table_mdssvc;
|
||||
NTSTATUS status;
|
||||
enum rpc_service_mode_e service_mode = rpc_service_mode(t->name);
|
||||
enum rpc_daemon_type_e mdssvc_type = rpc_mdssd_daemon();
|
||||
bool external = service_mode != RPC_SERVICE_MODE_EMBEDDED ||
|
||||
mdssvc_type != RPC_DAEMON_EMBEDDED;
|
||||
bool in_mdssd = external && am_parent == NULL;
|
||||
const struct dcesrv_endpoint_server *ep_server = NULL;
|
||||
|
||||
if (external && !in_mdssd) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ep_server = mdssvc_get_ep_server();
|
||||
if (ep_server == NULL) {
|
||||
DBG_ERR("Failed to get endpoint server\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
status = dcerpc_register_ep_server(ep_server);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG_ERR("Failed to register 'mdssvc' endpoint "
|
||||
"server: %s\n", nt_errstr(status));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct rpc_module_fns rpc_module_mdssvc_fns = {
|
||||
.setup = rpc_setup_mdssvc,
|
||||
};
|
||||
|
||||
static_decl_rpc;
|
||||
NTSTATUS rpc_mdssvc_module_init(TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
DBG_DEBUG("Registering mdsvc RPC service\n");
|
||||
|
||||
return register_rpc_module(&rpc_module_mdssvc_fns, "mdssvc");
|
||||
}
|
||||
|
||||
static NTSTATUS create_mdssvc_policy_handle(TALLOC_CTX *mem_ctx,
|
||||
struct pipes_struct *p,
|
||||
int snum,
|
||||
|
@ -1308,17 +1308,15 @@ static NTSTATUS netr_set_machine_account_password(
|
||||
&ndr_table_samr,
|
||||
local,
|
||||
NULL,
|
||||
session_info,
|
||||
get_session_info_system(),
|
||||
msg_ctx,
|
||||
&h);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
become_root();
|
||||
status = samr_open_machine_account(
|
||||
h, machine_sid, SEC_FLAG_MAXIMUM_ALLOWED, &user_handle);
|
||||
unbecome_root();
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto out;
|
||||
}
|
||||
@ -1392,14 +1390,12 @@ static NTSTATUS netr_set_machine_account_password(
|
||||
break;
|
||||
}
|
||||
|
||||
become_root();
|
||||
status = dcerpc_samr_SetUserInfo2(h,
|
||||
frame,
|
||||
&user_handle,
|
||||
infolevel,
|
||||
info,
|
||||
&result);
|
||||
unbecome_root();
|
||||
if (any_nt_status_not_ok(status, result, &status)) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ void global_dcesrv_context_free(void)
|
||||
TALLOC_FREE(global_dcesrv_ctx);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* the default is "embedded" so this table
|
||||
* lists only services that are not using
|
||||
* the default in order to keep enumerating it
|
||||
@ -199,3 +200,4 @@ enum rpc_daemon_type_e rpc_daemon_type(const char *name)
|
||||
|
||||
return type;
|
||||
}
|
||||
#endif
|
||||
|
@ -23,6 +23,7 @@
|
||||
#ifndef _RPC_CONFIG_H
|
||||
#define _RPC_CONFIG_H
|
||||
|
||||
#if 0
|
||||
enum rpc_service_mode_e {
|
||||
RPC_SERVICE_MODE_DISABLED = 0,
|
||||
RPC_SERVICE_MODE_EMBEDDED,
|
||||
@ -68,6 +69,7 @@ enum rpc_daemon_type_e rpc_daemon_type(const char *name);
|
||||
#define rpc_lsasd_daemon() rpc_daemon_type("lsasd")
|
||||
#define rpc_fss_daemon() rpc_daemon_type("fssd")
|
||||
#define rpc_mdssd_daemon() rpc_daemon_type("mdssd")
|
||||
#endif
|
||||
|
||||
struct dcesrv_context;
|
||||
struct dcesrv_context *global_dcesrv_context(void);
|
||||
|
@ -51,12 +51,6 @@ struct np_proxy_state {
|
||||
struct tevent_queue *write_queue;
|
||||
};
|
||||
|
||||
static struct np_proxy_state *make_external_rpc_pipe_p(TALLOC_CTX *mem_ctx,
|
||||
const char *pipe_name,
|
||||
const struct tsocket_address *remote_address,
|
||||
const struct tsocket_address *local_address,
|
||||
const struct auth_session_info *session_info);
|
||||
|
||||
struct npa_state *npa_state_init(TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
struct npa_state *npa;
|
||||
@ -84,6 +78,7 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NTSTATUS make_internal_rpc_pipe_socketpair(
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev_ctx,
|
||||
@ -656,6 +651,7 @@ static const struct dcerpc_binding_handle_ops rpcint_bh_ops = {
|
||||
.ref_alloc = rpcint_bh_ref_alloc,
|
||||
.do_ndr_print = rpcint_bh_do_ndr_print,
|
||||
};
|
||||
#endif
|
||||
|
||||
static NTSTATUS rpcint_binding_handle_ex(TALLOC_CTX *mem_ctx,
|
||||
const struct ndr_syntax_id *abstract_syntax,
|
||||
@ -666,46 +662,31 @@ static NTSTATUS rpcint_binding_handle_ex(TALLOC_CTX *mem_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcerpc_binding_handle **binding_handle)
|
||||
{
|
||||
struct dcerpc_binding_handle *h;
|
||||
struct rpcint_bh_state *hs;
|
||||
struct dcerpc_ncacn_conn *ncacn_conn = NULL;
|
||||
struct rpc_pipe_client *rpccli = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
h = dcerpc_binding_handle_create(mem_ctx,
|
||||
&rpcint_bh_ops,
|
||||
NULL,
|
||||
ndr_table,
|
||||
&hs,
|
||||
struct rpcint_bh_state,
|
||||
__location__);
|
||||
if (h == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
status = make_internal_ncacn_conn(hs,
|
||||
ndr_table,
|
||||
remote_address,
|
||||
local_address,
|
||||
session_info,
|
||||
msg_ctx,
|
||||
&ncacn_conn);
|
||||
status = rpc_pipe_open_local_np(
|
||||
mem_ctx,
|
||||
ndr_table,
|
||||
NULL,
|
||||
remote_address,
|
||||
NULL,
|
||||
local_address,
|
||||
session_info,
|
||||
&rpccli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(h);
|
||||
return status;
|
||||
DBG_DEBUG("rpc_pipe_open_local_np failed: %s\n",
|
||||
nt_errstr(status));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
status = make_internal_dcesrv_connection(ncacn_conn,
|
||||
ndr_table,
|
||||
ncacn_conn,
|
||||
&hs->conn);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(h);
|
||||
return status;
|
||||
}
|
||||
|
||||
*binding_handle = h;
|
||||
*binding_handle = rpccli->binding_handle;
|
||||
return NT_STATUS_OK;
|
||||
fail:
|
||||
TALLOC_FREE(rpccli);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a new DCERPC Binding Handle which uses a local dispatch function.
|
||||
*
|
||||
@ -750,6 +731,7 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
|
||||
msg_ctx, binding_handle);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
@ -1194,6 +1176,7 @@ done:
|
||||
*_result = result;
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Create a new RPC client context which uses a local dispatch function
|
||||
@ -1237,10 +1220,7 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
|
||||
struct rpc_pipe_client **cli_pipe)
|
||||
{
|
||||
struct rpc_pipe_client *cli = NULL;
|
||||
enum rpc_service_mode_e pipe_mode;
|
||||
const char *pipe_name;
|
||||
NTSTATUS status;
|
||||
TALLOC_CTX *tmp_ctx;
|
||||
|
||||
if (cli_pipe != NULL) {
|
||||
if (rpccli_is_connected(*cli_pipe)) {
|
||||
@ -1250,63 +1230,24 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
}
|
||||
|
||||
tmp_ctx = talloc_stackframe();
|
||||
if (tmp_ctx == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
status = rpc_pipe_open_local_np(
|
||||
mem_ctx,
|
||||
table,
|
||||
NULL,
|
||||
remote_address,
|
||||
NULL,
|
||||
local_address,
|
||||
session_info,
|
||||
&cli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG_ERR("Could not connect to %s pipe: %s\n",
|
||||
table->name,
|
||||
nt_errstr(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
pipe_name = dcerpc_default_transport_endpoint(mem_ctx, NCACN_NP, table);
|
||||
if (pipe_name == NULL) {
|
||||
DEBUG(1, ("Unable to find pipe name to forward %s to.\n", table->name));
|
||||
status = NT_STATUS_INVALID_PARAMETER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
while (pipe_name[0] == '\\') {
|
||||
pipe_name++;
|
||||
}
|
||||
|
||||
DEBUG(5, ("Connecting to %s pipe.\n", pipe_name));
|
||||
|
||||
pipe_mode = rpc_service_mode(pipe_name);
|
||||
|
||||
switch (pipe_mode) {
|
||||
case RPC_SERVICE_MODE_EMBEDDED:
|
||||
status = rpc_pipe_open_internal(tmp_ctx,
|
||||
table, session_info,
|
||||
remote_address, local_address,
|
||||
msg_ctx,
|
||||
&cli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
case RPC_SERVICE_MODE_EXTERNAL:
|
||||
/* It would be nice to just use rpc_pipe_open_ncalrpc() but
|
||||
* for now we need to use the special proxy setup to connect
|
||||
* to spoolssd. */
|
||||
|
||||
status = rpc_pipe_open_external(tmp_ctx,
|
||||
pipe_name, table,
|
||||
session_info,
|
||||
remote_address, local_address,
|
||||
&cli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
case RPC_SERVICE_MODE_DISABLED:
|
||||
status = NT_STATUS_NOT_IMPLEMENTED;
|
||||
DEBUG(0, ("Service pipe %s is disabled in config file: %s",
|
||||
pipe_name, nt_errstr(status)));
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = NT_STATUS_OK;
|
||||
done:
|
||||
if (NT_STATUS_IS_OK(status) && cli_pipe != NULL) {
|
||||
*cli_pipe = talloc_move(mem_ctx, &cli);
|
||||
*cli_pipe = cli;
|
||||
}
|
||||
TALLOC_FREE(tmp_ctx);
|
||||
return status;
|
||||
}
|
||||
|
@ -39,24 +39,6 @@ struct npa_state {
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
NTSTATUS make_external_rpc_pipe(TALLOC_CTX *mem_ctx,
|
||||
const char *pipe_name,
|
||||
const struct tsocket_address *remote_client_address,
|
||||
const struct tsocket_address *local_server_address,
|
||||
const struct auth_session_info *session_info,
|
||||
struct npa_state **pnpa);
|
||||
|
||||
NTSTATUS make_internal_rpc_pipe_socketpair(
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
struct dcesrv_endpoint *endpoint,
|
||||
const struct tsocket_address *remote_address,
|
||||
const struct tsocket_address *local_address,
|
||||
const struct auth_session_info *session_info,
|
||||
struct npa_state **pnpa);
|
||||
|
||||
struct npa_state *npa_state_init(TALLOC_CTX *mem_ctx);
|
||||
|
||||
NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
|
||||
@ -73,13 +55,4 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
|
||||
const struct tsocket_address *local_address,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct rpc_pipe_client **cli_pipe);
|
||||
|
||||
NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
|
||||
const struct ndr_interface_table *ndr_table,
|
||||
const struct auth_session_info *session_info,
|
||||
const struct tsocket_address *remote_address,
|
||||
const struct tsocket_address *local_address,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct rpc_pipe_client **presult);
|
||||
|
||||
#endif /* _RPC_NCACN_NP_H_ */
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include "auth.h"
|
||||
#include "rpc_server/rpc_ncacn_np.h"
|
||||
#include "rpc_server/srv_pipe_hnd.h"
|
||||
#include "rpc_server/srv_pipe.h"
|
||||
#include "libcli/security/security_token.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_SRV
|
||||
@ -53,6 +51,7 @@ struct dcerpc_ncacn_listen_state {
|
||||
void *termination_data;
|
||||
};
|
||||
|
||||
#if 0
|
||||
static void dcesrv_ncacn_listener(
|
||||
struct tevent_context *ev,
|
||||
struct tevent_fd *fde,
|
||||
@ -201,6 +200,7 @@ static int dcesrv_connection_destructor(struct dcesrv_connection *conn)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
NTSTATUS dcerpc_ncacn_conn_init(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev_ctx,
|
||||
@ -231,12 +231,15 @@ NTSTATUS dcerpc_ncacn_conn_init(TALLOC_CTX *mem_ctx,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void dcesrv_ncacn_np_accept_done(struct tevent_req *subreq);
|
||||
static void dcesrv_ncacn_accept_step2(struct dcerpc_ncacn_conn *ncacn_conn);
|
||||
#endif
|
||||
|
||||
static void ncacn_terminate_connection(struct dcerpc_ncacn_conn *conn,
|
||||
const char *reason);
|
||||
|
||||
#if 0
|
||||
void dcerpc_ncacn_accept(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
@ -551,6 +554,7 @@ static void dcesrv_ncacn_accept_step2(struct dcerpc_ncacn_conn *ncacn_conn)
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
NTSTATUS dcesrv_auth_gensec_prepare(
|
||||
TALLOC_CTX *mem_ctx,
|
||||
|
@ -65,28 +65,6 @@ NTSTATUS dcerpc_ncacn_conn_init(TALLOC_CTX *mem_ctx,
|
||||
void set_incoming_fault(struct pipes_struct *p);
|
||||
void process_complete_pdu(struct pipes_struct *p, struct ncacn_packet *pkt);
|
||||
|
||||
struct dcerpc_ncacn_listen_state;
|
||||
int dcesrv_setup_ncacn_listener(
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcesrv_endpoint *e,
|
||||
int *fd,
|
||||
dcerpc_ncacn_termination_fn term_fn,
|
||||
void *termination_data,
|
||||
struct dcerpc_ncacn_listen_state **listen_state);
|
||||
|
||||
void dcerpc_ncacn_accept(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
struct dcesrv_endpoint *e,
|
||||
struct tsocket_address **cli_addr,
|
||||
struct tsocket_address **srv_addr,
|
||||
int s,
|
||||
dcerpc_ncacn_termination_fn termination_fn,
|
||||
void *termination_data);
|
||||
|
||||
NTSTATUS dcesrv_auth_gensec_prepare(
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct dcesrv_call_state *call,
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "ntdomain.h"
|
||||
|
||||
#include "../lib/tsocket/tsocket.h"
|
||||
#include "librpc/rpc/dcerpc_ep.h"
|
||||
#include "librpc/rpc/dcesrv_core.h"
|
||||
#include "rpc_server/rpc_sock_helper.h"
|
||||
#include "lib/server_prefork.h"
|
||||
|
@ -62,10 +62,10 @@ static size_t spoolss_servers(
|
||||
|
||||
lp_load_with_shares(get_dyn_CONFIGFILE());
|
||||
|
||||
ok = printing_subsystem_init(ev_ctx, msg_ctx, dce_ctx, false, false);
|
||||
ok = printing_subsystem_init(ev_ctx, msg_ctx, dce_ctx, true);
|
||||
if (!ok) {
|
||||
DBG_WARNING("printing_subsystem_init() failed\n");
|
||||
return 1;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*_ep_servers = ep_servers;
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/crypto.h>
|
||||
#include "lib/global_contexts.h"
|
||||
#include "nsswitch/winbind_client.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_SRV
|
||||
@ -3920,10 +3921,12 @@ NTSTATUS _samr_CreateUser2(struct pipes_struct *p,
|
||||
|
||||
/********** BEGIN Admin BLOCK **********/
|
||||
|
||||
(void)winbind_off();
|
||||
become_root();
|
||||
nt_status = pdb_create_user(p->mem_ctx, account, acb_info,
|
||||
r->out.rid);
|
||||
unbecome_root();
|
||||
(void)winbind_on();
|
||||
|
||||
/********** END Admin BLOCK **********/
|
||||
|
||||
|
@ -2295,25 +2295,10 @@ static const struct dcesrv_interface dcesrv_iremotewinspool_interface = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static NTSTATUS iremotewinspool__check_register_in_endpoint(const char *name, struct dcerpc_binding *binding) {
|
||||
enum dcerpc_transport_t transport = dcerpc_binding_get_transport(binding);
|
||||
|
||||
/* If service is embedded, register only for ncacn_np
|
||||
* see 8466b3c85e4b835e57e41776853093f4a0edc8b8
|
||||
*/
|
||||
if (rpc_service_mode(name) == RPC_SERVICE_MODE_EMBEDDED && (transport != NCACN_NP && transport != NCALRPC)) {
|
||||
DBG_INFO("Interface 'iremotewinspool' not registered in endpoint '%s' as service is embedded\n", name);
|
||||
return NT_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static NTSTATUS iremotewinspool__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
int i;
|
||||
NTSTATUS ret;
|
||||
struct dcerpc_binding *binding;
|
||||
|
||||
#ifdef DCESRV_INTERFACE_IREMOTEWINSPOOL_NCACN_NP_SECONDARY_ENDPOINT
|
||||
const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_IREMOTEWINSPOOL_NCACN_NP_SECONDARY_ENDPOINT;
|
||||
@ -2324,19 +2309,6 @@ static NTSTATUS iremotewinspool__op_init_server(struct dcesrv_context *dce_ctx,
|
||||
for (i=0;i<ndr_table_iremotewinspool.endpoints->count;i++) {
|
||||
const char *name = ndr_table_iremotewinspool.endpoints->names[i];
|
||||
|
||||
ret = dcerpc_parse_binding(dce_ctx, name, &binding);
|
||||
if (NT_STATUS_IS_ERR(ret)) {
|
||||
DBG_ERR("Failed to parse binding string '%s'\n", name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = iremotewinspool__check_register_in_endpoint("iremotewinspool", binding);
|
||||
if (NT_STATUS_IS_ERR(ret)) {
|
||||
talloc_free(binding);
|
||||
continue;
|
||||
}
|
||||
talloc_free(binding);
|
||||
|
||||
ret = dcesrv_interface_register(dce_ctx, name, ncacn_np_secondary_endpoint, &dcesrv_iremotewinspool_interface, NULL);
|
||||
if (!NT_STATUS_IS_OK(ret)) {
|
||||
DBG_ERR("Failed to register endpoint '%s'\n",name);
|
||||
|
@ -11544,14 +11544,8 @@ static NTSTATUS spoolss_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
struct messaging_context *msg_ctx = global_messaging_context();
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
|
||||
status = dcesrv_init_ep_server(dce_ctx, "winreg");
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Migrate the printers first.
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "ntdomain.h"
|
||||
#include "rpc_server/rpc_ncacn_np.h"
|
||||
#include "rpc_server/srv_pipe_hnd.h"
|
||||
#include "rpc_server/srv_pipe.h"
|
||||
#include "rpc_client/local_np.h"
|
||||
#include "rpc_server/rpc_server.h"
|
||||
#include "rpc_server/rpc_config.h"
|
||||
#include "../lib/tsocket/tsocket.h"
|
||||
@ -57,77 +57,41 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
struct fake_file_handle **phandle)
|
||||
{
|
||||
enum rpc_service_mode_e pipe_mode;
|
||||
const char **proxy_list;
|
||||
struct fake_file_handle *handle;
|
||||
struct dcesrv_endpoint *endpoint = NULL;
|
||||
struct npa_state *npa = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
proxy_list = lp_parm_string_list(-1, "np", "proxy", NULL);
|
||||
int ret;
|
||||
|
||||
handle = talloc(mem_ctx, struct fake_file_handle);
|
||||
if (handle == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Check what is the server type for this pipe.
|
||||
Defaults to "embedded" */
|
||||
pipe_mode = rpc_service_mode(name);
|
||||
|
||||
/* Still support the old method for defining external servers */
|
||||
if ((proxy_list != NULL) && str_list_check_ci(proxy_list, name)) {
|
||||
pipe_mode = RPC_SERVICE_MODE_EXTERNAL;
|
||||
npa = npa_state_init(handle);
|
||||
if (npa == NULL) {
|
||||
TALLOC_FREE(handle);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
*handle = (struct fake_file_handle) {
|
||||
.type = FAKE_FILE_TYPE_NAMED_PIPE_PROXY,
|
||||
.private_data = npa,
|
||||
};
|
||||
|
||||
switch (pipe_mode) {
|
||||
case RPC_SERVICE_MODE_EXTERNAL:
|
||||
status = make_external_rpc_pipe(handle,
|
||||
name,
|
||||
remote_client_address,
|
||||
local_server_address,
|
||||
session_info,
|
||||
&npa);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_free(handle);
|
||||
return status;
|
||||
}
|
||||
|
||||
handle->private_data = (void *)npa;
|
||||
handle->type = FAKE_FILE_TYPE_NAMED_PIPE_PROXY;
|
||||
|
||||
break;
|
||||
case RPC_SERVICE_MODE_EMBEDDED:
|
||||
/* Check if we handle this pipe internally */
|
||||
status = is_known_pipename(dce_ctx, name, &endpoint);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG_WARNING("'%s' is not a registered pipe!\n", name);
|
||||
talloc_free(handle);
|
||||
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
status = make_internal_rpc_pipe_socketpair(
|
||||
handle,
|
||||
ev_ctx,
|
||||
msg_ctx,
|
||||
dce_ctx,
|
||||
endpoint,
|
||||
remote_client_address,
|
||||
local_server_address,
|
||||
session_info,
|
||||
&npa);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_free(handle);
|
||||
return status;
|
||||
}
|
||||
|
||||
handle->private_data = (void *)npa;
|
||||
handle->type = FAKE_FILE_TYPE_NAMED_PIPE_PROXY;
|
||||
|
||||
break;
|
||||
case RPC_SERVICE_MODE_DISABLED:
|
||||
talloc_free(handle);
|
||||
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
ret = local_np_connect(
|
||||
name,
|
||||
NCACN_NP,
|
||||
NULL,
|
||||
remote_client_address,
|
||||
NULL,
|
||||
local_server_address,
|
||||
session_info,
|
||||
false,
|
||||
npa,
|
||||
&npa->stream);
|
||||
if (ret != 0) {
|
||||
DBG_DEBUG("local_np_connect failed: %s\n",
|
||||
strerror(ret));
|
||||
TALLOC_FREE(handle);
|
||||
return map_nt_error_from_unix(ret);
|
||||
}
|
||||
|
||||
*phandle = handle;
|
||||
|
@ -1244,14 +1244,8 @@ static NTSTATUS svcctl_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
struct messaging_context *msg_ctx = global_messaging_context();
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
|
||||
status = dcesrv_init_ep_server(dce_ctx, "winreg");
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* initialize the control hooks */
|
||||
init_service_op_table();
|
||||
|
||||
|
@ -15,7 +15,6 @@ bld.SAMBA_BINARY('samba-dcerpcd',
|
||||
AUTH_COMMON
|
||||
RPC_SOCK_HELPER
|
||||
NDR_RPC_HOST
|
||||
RPC_SERVER
|
||||
''',
|
||||
install_path='${SAMBA_LIBEXECDIR}')
|
||||
|
||||
@ -112,30 +111,33 @@ bld.SAMBA3_SUBSYSTEM('RPC_CONFIG',
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP',
|
||||
source='rpc_ncacn_np.c rpc_handles.c',
|
||||
deps='RPC_CONFIG auth common_auth npa_tstream')
|
||||
deps='auth common_auth npa_tstream')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_SERVER_LOOP',
|
||||
source='rpc_server.c',
|
||||
deps='samba-util')
|
||||
bld.SAMBA3_LIBRARY('RPC_SERVER_LOOP',
|
||||
private_library=True,
|
||||
source='rpc_server.c',
|
||||
deps='''
|
||||
LIBTSOCKET
|
||||
dcerpc-server-core
|
||||
npa_tstream
|
||||
auth
|
||||
RPC_NCACN_NP
|
||||
samba3-util
|
||||
''')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('SRV_ACCESS_CHECK',
|
||||
source='srv_access_check.c',
|
||||
deps='samba-util')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_SERVER',
|
||||
source='srv_pipe_hnd.c srv_pipe.c',
|
||||
source='',
|
||||
deps='''
|
||||
dcerpc-server-core
|
||||
RPC_CONFIG
|
||||
RPC_NCACN_NP
|
||||
RPC_SERVER_LOOP
|
||||
NDR_NAMED_PIPE_AUTH
|
||||
''')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_MODULES',
|
||||
source='rpc_modules.c',
|
||||
deps='samba-util')
|
||||
|
||||
### RPC_SERVICES
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_DSSETUP',
|
||||
source='''dssetup/srv_dssetup_nt.c''',
|
||||
@ -247,17 +249,6 @@ if bld.env.spotlight_backend_es:
|
||||
mdssvc/es_lexer.l
|
||||
'''
|
||||
rpc_mdssvc_deps += ' http jansson'
|
||||
if bld.SAMBA3_IS_ENABLED_MODULE('rpc_mdssvc_module'):
|
||||
bld.INSTALL_FILES(bld.env.SAMBA_DATADIR,
|
||||
'mdssvc/elasticsearch_mappings.json')
|
||||
|
||||
bld.SAMBA3_MODULE('rpc_mdssvc_module',
|
||||
subsystem='rpc',
|
||||
source=rpc_mdssvc_sources,
|
||||
init_function='',
|
||||
deps=rpc_mdssvc_deps,
|
||||
internal_module=bld.SAMBA3_IS_STATIC_MODULE('rpc_mdssvc_module'),
|
||||
enabled=bld.SAMBA3_IS_ENABLED_MODULE('rpc_mdssvc_module'))
|
||||
|
||||
bld.SAMBA3_BINARY('rpcd_mdssvc',
|
||||
source='rpcd_mdssvc.c ' + rpc_mdssvc_sources,
|
||||
@ -268,18 +259,11 @@ bld.SAMBA3_BINARY('rpcd_mdssvc',
|
||||
''' + rpc_mdssvc_deps,
|
||||
install_path='${SAMBA_LIBEXECDIR}')
|
||||
|
||||
# RPC_SERVICE
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_SERVER_REGISTER',
|
||||
source='rpc_ep_register.c ../librpc/rpc/dcerpc_ep.c',
|
||||
deps='samba-util')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
|
||||
source='rpc_service_setup.c',
|
||||
source='',
|
||||
deps='''
|
||||
rpc
|
||||
RPC_SERVER
|
||||
RPC_SERVER_REGISTER
|
||||
RPC_MODULES
|
||||
RPC_SAMR
|
||||
RPC_LSARPC
|
||||
RPC_WINREG
|
||||
@ -291,7 +275,6 @@ bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
|
||||
RPC_NETLOGON
|
||||
RPC_NETDFS
|
||||
RPC_SRVSVC
|
||||
RPC_SPOOLSS
|
||||
RPC_IREMOTEWINSPOOL
|
||||
RPC_EVENTLOG
|
||||
RPC_RPCECHO
|
||||
@ -303,21 +286,4 @@ bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
|
||||
# RPC_DAEMONS
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_SOCK_HELPER',
|
||||
source='rpc_sock_helper.c',
|
||||
deps='RPC_SERVER_REGISTER')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('EPMD',
|
||||
source='epmd.c',
|
||||
deps='samba-util')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('LSASD',
|
||||
source='lsasd.c',
|
||||
deps='RPC_SOCK_HELPER samba-util')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('FSSD',
|
||||
source='fssd.c',
|
||||
deps='samba-util')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('MDSSD',
|
||||
source='mdssd.c',
|
||||
deps='RPC_SOCK_HELPER RPC_MODULES samba-util tevent-glib-glue',
|
||||
enabled=bld.env.with_spotlight)
|
||||
deps='')
|
||||
|
@ -65,14 +65,6 @@ bool conn_idle_all(struct smbd_server_connection *sconn, time_t t)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check all pipes for any open handles. We cannot
|
||||
* idle with a handle open.
|
||||
*/
|
||||
if (check_open_pipes()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2948,9 +2948,6 @@ static bool housekeeping_fn(const struct timeval *now, void *private_data)
|
||||
|
||||
change_to_root_user();
|
||||
|
||||
/* update printer queue caches if necessary */
|
||||
update_monitored_printq_cache(sconn->msg_ctx);
|
||||
|
||||
/* check if we need to reload services */
|
||||
check_reload(sconn, time_mono(NULL));
|
||||
|
||||
@ -3986,7 +3983,6 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd,
|
||||
|
||||
void smbd_process(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
int sock_fd,
|
||||
bool interactive)
|
||||
{
|
||||
@ -4029,7 +4025,6 @@ void smbd_process(struct tevent_context *ev_ctx,
|
||||
|
||||
sconn->ev_ctx = ev_ctx;
|
||||
sconn->msg_ctx = msg_ctx;
|
||||
sconn->dce_ctx = dce_ctx;
|
||||
|
||||
ret = pthreadpool_tevent_init(sconn, lp_aio_max_threads(),
|
||||
&sconn->pool);
|
||||
|
@ -931,7 +931,6 @@ bool smb1_parse_chain(TALLOC_CTX *mem_ctx, const uint8_t *buf,
|
||||
bool req_is_in_chain(const struct smb_request *req);
|
||||
void smbd_process(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
struct dcesrv_context *dce_ctx,
|
||||
int sock_fd,
|
||||
bool interactive);
|
||||
bool fork_echo_handler(struct smbXsrv_connection *xconn);
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "ctdbd_conn.h"
|
||||
#include "util_cluster.h"
|
||||
#include "printing/queue_process.h"
|
||||
#include "rpc_server/rpc_service_setup.h"
|
||||
#include "rpc_server/rpc_config.h"
|
||||
#include "passdb.h"
|
||||
#include "auth.h"
|
||||
@ -56,10 +55,6 @@
|
||||
#include "lib/util/sys_rw.h"
|
||||
#include "cleanupdb.h"
|
||||
#include "g_lock.h"
|
||||
#include "rpc_server/epmd.h"
|
||||
#include "rpc_server/lsasd.h"
|
||||
#include "rpc_server/fssd.h"
|
||||
#include "rpc_server/mdssd.h"
|
||||
#include "lib/global_contexts.h"
|
||||
#include "source3/lib/substitute.h"
|
||||
|
||||
@ -75,7 +70,6 @@ struct smbd_parent_context {
|
||||
|
||||
struct tevent_context *ev_ctx;
|
||||
struct messaging_context *msg_ctx;
|
||||
struct dcesrv_context *dce_ctx;
|
||||
|
||||
/* the list of listening sockets */
|
||||
struct smbd_open_socket *sockets;
|
||||
@ -115,15 +109,12 @@ static void smbd_parent_conf_updated(struct messaging_context *msg,
|
||||
struct server_id server_id,
|
||||
DATA_BLOB *data)
|
||||
{
|
||||
struct tevent_context *ev_ctx =
|
||||
talloc_get_type_abort(private_data, struct tevent_context);
|
||||
bool ok;
|
||||
|
||||
DEBUG(10,("smbd_parent_conf_updated: Got message saying smb.conf was "
|
||||
"updated. Reloading.\n"));
|
||||
change_to_root_user();
|
||||
reload_services(NULL, NULL, false);
|
||||
printing_subsystem_update(ev_ctx, msg, false);
|
||||
|
||||
ok = reinit_guest_session_info(NULL);
|
||||
if (!ok) {
|
||||
@ -976,7 +967,6 @@ static void smbd_accept_connection(struct tevent_context *ev,
|
||||
struct smbd_open_socket *s = talloc_get_type_abort(private_data,
|
||||
struct smbd_open_socket);
|
||||
struct messaging_context *msg_ctx = s->parent->msg_ctx;
|
||||
struct dcesrv_context *dce_ctx = s->parent->dce_ctx;
|
||||
struct sockaddr_storage addr;
|
||||
socklen_t in_addrlen = sizeof(addr);
|
||||
int fd;
|
||||
@ -995,7 +985,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
|
||||
|
||||
if (s->parent->interactive) {
|
||||
reinit_after_fork(msg_ctx, ev, true, NULL);
|
||||
smbd_process(ev, msg_ctx, dce_ctx, fd, true);
|
||||
smbd_process(ev, msg_ctx, fd, true);
|
||||
exit_server_cleanly("end of interactive mode");
|
||||
return;
|
||||
}
|
||||
@ -1044,7 +1034,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
|
||||
smb_panic("reinit_after_fork() failed");
|
||||
}
|
||||
|
||||
smbd_process(ev, msg_ctx, dce_ctx, fd, false);
|
||||
smbd_process(ev, msg_ctx, fd, false);
|
||||
exit:
|
||||
exit_server_cleanly("end of child");
|
||||
return;
|
||||
@ -1434,15 +1424,9 @@ static void smbd_parent_sig_hup_handler(struct tevent_context *ev,
|
||||
void *siginfo,
|
||||
void *private_data)
|
||||
{
|
||||
struct smbd_parent_context *parent =
|
||||
talloc_get_type_abort(private_data,
|
||||
struct smbd_parent_context);
|
||||
|
||||
change_to_root_user();
|
||||
DEBUG(1,("parent: Reloading services after SIGHUP\n"));
|
||||
reload_services(NULL, NULL, false);
|
||||
|
||||
printing_subsystem_update(parent->ev_ctx, parent->msg_ctx, true);
|
||||
}
|
||||
|
||||
struct smbd_claim_version_state {
|
||||
@ -1571,7 +1555,6 @@ extern void build_options(bool screen);
|
||||
int opt;
|
||||
poptContext pc;
|
||||
bool print_build_options = False;
|
||||
bool serving_printers = false;
|
||||
struct server_id main_server_id = {0};
|
||||
struct poptOption long_options[] = {
|
||||
POPT_AUTOHELP
|
||||
@ -1609,7 +1592,6 @@ extern void build_options(bool screen);
|
||||
NTSTATUS status;
|
||||
struct tevent_context *ev_ctx;
|
||||
struct messaging_context *msg_ctx;
|
||||
struct dcesrv_context *dce_ctx = NULL;
|
||||
struct server_id server_id;
|
||||
struct tevent_signal *se;
|
||||
int profiling_level;
|
||||
@ -1767,7 +1749,7 @@ extern void build_options(bool screen);
|
||||
DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n",
|
||||
(int)getuid(),(int)getgid(),(int)geteuid(),(int)getegid()));
|
||||
|
||||
/* Output the build options to the debug log */
|
||||
/* Output the build options to the debug log */
|
||||
build_options(False);
|
||||
|
||||
if (sizeof(uint16_t) < 2 || sizeof(uint32_t) < 4) {
|
||||
@ -1808,11 +1790,6 @@ extern void build_options(bool screen);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dce_ctx = global_dcesrv_context();
|
||||
if (dce_ctx == NULL) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reloading of the printers will not work here as we don't have a
|
||||
* server info and rpc services set up. It will be called later.
|
||||
@ -1918,7 +1895,6 @@ extern void build_options(bool screen);
|
||||
parent->interactive = cmdline_daemon_cfg->interactive;
|
||||
parent->ev_ctx = ev_ctx;
|
||||
parent->msg_ctx = msg_ctx;
|
||||
parent->dce_ctx = dce_ctx;
|
||||
am_parent = parent;
|
||||
|
||||
se = tevent_add_signal(parent->ev_ctx,
|
||||
@ -2081,65 +2057,10 @@ extern void build_options(bool screen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
status = dcesrv_init(ev_ctx, ev_ctx, msg_ctx, dce_ctx);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG_ERR("Failed to setup RPC server: %s\n", nt_errstr(status));
|
||||
exit_daemon("Samba cannot setup ep pipe", EACCES);
|
||||
}
|
||||
|
||||
if (!cmdline_daemon_cfg->interactive) {
|
||||
daemon_ready("smbd");
|
||||
}
|
||||
|
||||
serving_printers = (!lp__disable_spoolss() &&
|
||||
(rpc_spoolss_daemon() != RPC_DAEMON_DISABLED));
|
||||
|
||||
/* only start other daemons if we are running as a daemon
|
||||
* -- bad things will happen if smbd is launched via inetd
|
||||
* and we fork a copy of ourselves here */
|
||||
if (cmdline_daemon_cfg->daemon && !cmdline_daemon_cfg->interactive) {
|
||||
|
||||
if (rpc_epmapper_daemon() == RPC_DAEMON_FORK) {
|
||||
start_epmd(ev_ctx, msg_ctx, dce_ctx);
|
||||
}
|
||||
|
||||
if (rpc_lsasd_daemon() == RPC_DAEMON_FORK) {
|
||||
start_lsasd(ev_ctx, msg_ctx, dce_ctx);
|
||||
}
|
||||
|
||||
if (rpc_fss_daemon() == RPC_DAEMON_FORK) {
|
||||
start_fssd(ev_ctx, msg_ctx, dce_ctx);
|
||||
}
|
||||
|
||||
if (serving_printers) {
|
||||
bool bgq = lp_parm_bool(-1, "smbd", "backgroundqueue", true);
|
||||
ok = printing_subsystem_init(ev_ctx,
|
||||
msg_ctx,
|
||||
dce_ctx,
|
||||
true,
|
||||
bgq);
|
||||
if (!ok) {
|
||||
exit_daemon("Samba failed to init printing subsystem", EACCES);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_SPOTLIGHT
|
||||
if ((rpc_mdssvc_mode() == RPC_SERVICE_MODE_EXTERNAL) &&
|
||||
(rpc_mdssd_daemon() == RPC_DAEMON_FORK)) {
|
||||
start_mdssd(ev_ctx, msg_ctx, dce_ctx);
|
||||
}
|
||||
#endif
|
||||
} else if (serving_printers) {
|
||||
ok = printing_subsystem_init(ev_ctx,
|
||||
msg_ctx,
|
||||
dce_ctx,
|
||||
false,
|
||||
false);
|
||||
if (!ok) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!cmdline_daemon_cfg->daemon) {
|
||||
int ret, sock;
|
||||
|
||||
@ -2173,7 +2094,7 @@ extern void build_options(bool screen);
|
||||
/* Stop zombies */
|
||||
smbd_setup_sig_chld_handler(parent);
|
||||
|
||||
smbd_process(ev_ctx, msg_ctx, dce_ctx, sock, true);
|
||||
smbd_process(ev_ctx, msg_ctx, sock, true);
|
||||
|
||||
exit_server_cleanly(NULL);
|
||||
return(0);
|
||||
@ -2182,13 +2103,6 @@ extern void build_options(bool screen);
|
||||
if (!open_sockets_smbd(parent, ev_ctx, msg_ctx, ports))
|
||||
exit_server("open_sockets_smbd() failed");
|
||||
|
||||
/* do a printer update now that all messaging has been set up,
|
||||
* before we allow clients to start connecting */
|
||||
if (!lp__disable_spoolss() &&
|
||||
(rpc_spoolss_daemon() != RPC_DAEMON_DISABLED)) {
|
||||
printing_subsystem_update(ev_ctx, msg_ctx, false);
|
||||
}
|
||||
|
||||
TALLOC_FREE(frame);
|
||||
/* make sure we always have a valid stackframe */
|
||||
frame = talloc_stackframe();
|
||||
|
@ -82,7 +82,6 @@ static void exit_server_common(enum server_exit_reason how,
|
||||
struct smbXsrv_client *client = global_smbXsrv_client;
|
||||
struct smbXsrv_connection *xconn = NULL;
|
||||
struct smbd_server_connection *sconn = NULL;
|
||||
struct messaging_context *msg_ctx = global_messaging_context();
|
||||
NTSTATUS disconnect_status;
|
||||
|
||||
if (!exit_firsttime) {
|
||||
@ -191,9 +190,6 @@ static void exit_server_common(enum server_exit_reason how,
|
||||
|
||||
change_to_root_user();
|
||||
|
||||
/* 3 second timeout. */
|
||||
print_notify_send_messages(msg_ctx, 3);
|
||||
|
||||
#ifdef USE_DMAPI
|
||||
/* Destroy Samba DMAPI session only if we are master smbd process */
|
||||
if (am_parent) {
|
||||
@ -203,11 +199,6 @@ static void exit_server_common(enum server_exit_reason how,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (am_parent && sconn != NULL) {
|
||||
dcesrv_shutdown_registered_ep_servers(sconn->dce_ctx);
|
||||
|
||||
global_dcesrv_context_free();
|
||||
}
|
||||
|
||||
/*
|
||||
* we need to force the order of freeing the following,
|
||||
@ -227,7 +218,6 @@ static void exit_server_common(enum server_exit_reason how,
|
||||
TALLOC_FREE(smbd_memcache_ctx);
|
||||
|
||||
locking_end();
|
||||
printing_end();
|
||||
|
||||
if (how != SERVER_EXIT_NORMAL) {
|
||||
|
||||
|
@ -1947,34 +1947,6 @@ int main(int argc, const char **argv)
|
||||
|
||||
DBG_INFO("Registering DCE/RPC endpoint servers\n");
|
||||
|
||||
/* Register the endpoint server to dispatch calls locally through
|
||||
* the legacy api_struct */
|
||||
ep_server = lsarpc_get_ep_server();
|
||||
if (ep_server == NULL) {
|
||||
DBG_ERR("Failed to get 'lsarpc' endpoint server\n");
|
||||
exit(1);
|
||||
}
|
||||
status = dcerpc_register_ep_server(ep_server);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG_ERR("Failed to register 'lsarpc' endpoint "
|
||||
"server: %s\n", nt_errstr(status));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Register the endpoint server to dispatch calls locally through
|
||||
* the legacy api_struct */
|
||||
ep_server = samr_get_ep_server();
|
||||
if (ep_server == NULL) {
|
||||
DBG_ERR("Failed to get 'samr' endpoint server\n");
|
||||
exit(1);
|
||||
}
|
||||
status = dcerpc_register_ep_server(ep_server);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG_ERR("Failed to register 'samr' endpoint "
|
||||
"server: %s\n", nt_errstr(status));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ep_server = winbind_get_ep_server();
|
||||
if (ep_server == NULL) {
|
||||
DBG_ERR("Failed to get 'winbind' endpoint server\n");
|
||||
|
@ -1568,24 +1568,8 @@ NTSTATUS wb_open_internal_pipe(TALLOC_CTX *mem_ctx,
|
||||
session_info = get_session_info_system();
|
||||
SMB_ASSERT(session_info != NULL);
|
||||
|
||||
/* create a connection to the specified pipe */
|
||||
if (lp_parm_bool(-1, "winbindd", "use external pipes", false)) {
|
||||
status = rpc_pipe_open_interface(mem_ctx,
|
||||
table,
|
||||
session_info,
|
||||
NULL,
|
||||
NULL,
|
||||
global_messaging_context(),
|
||||
&cli);
|
||||
} else {
|
||||
status = rpc_pipe_open_internal(mem_ctx,
|
||||
table,
|
||||
session_info,
|
||||
NULL,
|
||||
NULL,
|
||||
global_messaging_context(),
|
||||
&cli);
|
||||
}
|
||||
status = rpc_pipe_open_local_np(
|
||||
mem_ctx, table, NULL, NULL, NULL, NULL, session_info, &cli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
@ -270,8 +270,7 @@ bld.SAMBA3_SUBSYSTEM('winbindd-lib',
|
||||
SLCACHE
|
||||
RPC_NDR_DSSETUP
|
||||
RPC_NDR_WINBIND
|
||||
RPC_SAMR
|
||||
RPC_LSARPC
|
||||
TOKEN_UTIL
|
||||
RPC_SERVER
|
||||
WB_REQTRANS
|
||||
TDB_VALIDATE
|
||||
|
@ -1847,7 +1847,6 @@ main() {
|
||||
conf.fatal("Unmet dependencies for Spotlight backends")
|
||||
|
||||
Logs.info("Building with Spotlight support, available backends: %s" % ', '.join(backends))
|
||||
default_static_modules.extend(['rpc_mdssvc_module'])
|
||||
conf.DEFINE('WITH_SPOTLIGHT', '1')
|
||||
conf.env.with_spotlight = True
|
||||
|
||||
@ -2030,7 +2029,7 @@ main() {
|
||||
static_list = {}
|
||||
shared_list = {}
|
||||
|
||||
prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount', 'rpc']
|
||||
prefixes = ['vfs', 'pdb', 'auth', 'nss_info', 'charset', 'idmap', 'gpext', 'perfcount']
|
||||
conf.env['MODULE_PREFIXES'] = prefixes
|
||||
for p in prefixes:
|
||||
for m in final_static_modules:
|
||||
|
@ -252,7 +252,7 @@ bld.SAMBA3_SUBSYSTEM('REG_SMBCONF',
|
||||
''',
|
||||
deps='SMBREGISTRY')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('REG_FULL',
|
||||
bld.SAMBA3_LIBRARY('REG_FULL',private_library=True,
|
||||
source='''
|
||||
registry/reg_backend_printing.c
|
||||
registry/reg_backend_shares.c
|
||||
@ -267,6 +267,8 @@ bld.SAMBA3_SUBSYSTEM('REG_FULL',
|
||||
deps='''
|
||||
smbconf
|
||||
tdb-wrap3
|
||||
REG_PARSE_PRS
|
||||
pdb
|
||||
''')
|
||||
|
||||
bld.SAMBA3_LIBRARY('cmdline_contexts',
|
||||
@ -638,6 +640,9 @@ bld.SAMBA3_LIBRARY('smbd_base',
|
||||
smbd/service.c
|
||||
smbd/error.c
|
||||
printing/printspoolss.c
|
||||
printing/rap_jobid.c
|
||||
printing/load.c
|
||||
printing/printer_list.c
|
||||
lib/sessionid_tdb.c
|
||||
lib/cleanupdb.c
|
||||
smbd/fake_file.c
|
||||
@ -690,6 +695,8 @@ bld.SAMBA3_LIBRARY('smbd_base',
|
||||
smbd/build_options.c
|
||||
smbd/smb1_utils.c
|
||||
smbd/conn.c
|
||||
rpc_server/srv_pipe_hnd.c
|
||||
rpc_server/rpc_ncacn_np.c
|
||||
''' + NOTIFY_SOURCES,
|
||||
deps='''
|
||||
talloc
|
||||
@ -704,12 +711,10 @@ bld.SAMBA3_LIBRARY('smbd_base',
|
||||
samba3core
|
||||
param_service
|
||||
AVAHI
|
||||
PRINTBASE
|
||||
PROFILE
|
||||
LOCKING
|
||||
LIBADS_SERVER
|
||||
LIBAFS
|
||||
RPC_SERVICE
|
||||
NDR_SMBXSRV
|
||||
LEASES_DB
|
||||
LEASES_UTIL
|
||||
@ -722,6 +727,7 @@ bld.SAMBA3_LIBRARY('smbd_base',
|
||||
NDR_QUOTA
|
||||
GNUTLS_HELPERS
|
||||
fd_handle
|
||||
cli_spoolss
|
||||
''' +
|
||||
bld.env['dmapi_lib'] +
|
||||
bld.env['legacy_quota_libs'] +
|
||||
@ -778,7 +784,6 @@ bld.SAMBA3_SUBSYSTEM('PRINTBASE',
|
||||
bld.SAMBA3_SUBSYSTEM('PRINTBACKEND',
|
||||
source='''
|
||||
printing/printing.c
|
||||
printing/rap_jobid.c
|
||||
printing/nt_printing.c
|
||||
printing/nt_printing_tdb.c
|
||||
printing/nt_printing_migrate_internal.c
|
||||
@ -790,7 +795,6 @@ bld.SAMBA3_SUBSYSTEM('PRINTBACKEND',
|
||||
LIBADS_PRINTER
|
||||
tdb
|
||||
printing_migrate
|
||||
SPOOLSSD
|
||||
''')
|
||||
|
||||
bld.SAMBA3_LIBRARY('printing_migrate',
|
||||
@ -816,14 +820,16 @@ bld.SAMBA3_SUBSYSTEM('PRINTING',
|
||||
printing/print_cups.c
|
||||
printing/print_generic.c
|
||||
printing/lpq_parse.c
|
||||
printing/load.c
|
||||
printing/print_standard.c
|
||||
printing/print_iprint.c
|
||||
printing/printer_list.c
|
||||
''',
|
||||
deps='''
|
||||
NDR_PRINTCAP
|
||||
tdb
|
||||
dbwrap
|
||||
tdb-wrap3
|
||||
SMBCONF_PARAM
|
||||
PRINTBASE
|
||||
smbd_base
|
||||
cups
|
||||
''')
|
||||
|
||||
@ -833,7 +839,7 @@ bld.SAMBA_BINARY('samba-bgqd',
|
||||
samba3core
|
||||
CMDLINE_S3
|
||||
AUTH_COMMON
|
||||
smbd_base
|
||||
RPC_SPOOLSS
|
||||
''',
|
||||
install_path='${LIBEXECDIR}/samba')
|
||||
|
||||
@ -1070,13 +1076,6 @@ bld.SAMBA3_SUBSYSTEM('INIT_SAMR',
|
||||
bld.SAMBA3_SUBSYSTEM('LIBLSA',
|
||||
source='lib/lsa.c')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('SPOOLSSD',
|
||||
source='printing/spoolssd.c',
|
||||
deps='''
|
||||
samba-util
|
||||
RPC_SOCK_HELPER
|
||||
''')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('tevent-glib-glue',
|
||||
source='lib/tevent_glib_glue.c',
|
||||
deps='glib-2.0',
|
||||
@ -1100,11 +1099,7 @@ bld.SAMBA3_BINARY('smbd/smbd',
|
||||
deps='''
|
||||
CMDLINE_S3
|
||||
smbd_base
|
||||
EPMD
|
||||
LSASD
|
||||
FSSD
|
||||
MDSSD
|
||||
SPOOLSSD
|
||||
REG_FULL
|
||||
''',
|
||||
install_path='${SBINDIR}')
|
||||
|
||||
|
@ -28,7 +28,7 @@ def build(bld):
|
||||
|
||||
bld.SAMBA_MODULE('rpc_test_dummy_module',
|
||||
source='rpc_test_dummy_module.c',
|
||||
deps='ndr smbd_base',
|
||||
deps='ndr smbd_base RPC_SERVICE RPC_SOCK_HELPER',
|
||||
subsystem='rpc',
|
||||
allow_undefined_symbols=True,
|
||||
init_function='',
|
||||
|
Loading…
x
Reference in New Issue
Block a user