Bug 3080 - net rpc shutdown does not work
Summary: net rpc shutdown does not work
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: net utility (show other bugs)
Version: 3.0.20
Hardware: All Linux
: P3 normal
Target Milestone: none
Assignee: Gerald (Jerry) Carter (dead mail address)
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-09 09:05 UTC by Florian Effenberger
Modified: 2005-09-22 12:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Effenberger 2005-09-09 09:05:31 UTC
Hello,

using Samba 3.0.20, the net rcp shutdown command does not work. I use

/usr/local/samba/bin/net rpc shutdown --server=MYCLIENT --user=DOMAIN_ADMIN_USER

and the result I get back is

[2005/09/09 18:00:15, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_init_shutdown_internals(4485)
  Shutdown of remote machine failed!
[2005/09/09 18:00:15, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_reg_shutdown_internals(4555)
  Shutdown of remote machine failed!

Using the old 3.0.14a rpcclient with the command

rpcclient MYCLIENT -c "shutdowninit -t 15" -U DOMAIN_ADMIN_USER

just works fine. I also tried granting my admin user the shutdown privilege, but
it does not help either.

If you need any debug logs, let me know. Client systems are XP Pro SP2.
Comment 1 Jim McDonough 2005-09-15 18:55:23 UTC
Fixed by jerry in svn, rev 10243, and available at
http://samba.org/samba/patches/net_rpc_shutdown_v1.patch
Comment 2 Florian Effenberger 2005-09-15 23:45:22 UTC
Thanks, that was fast! Will try it as soon as I have access to the machine
again. ;-)
Comment 3 Florian Effenberger 2005-09-16 00:02:35 UTC
Just tested it, this one still seems to be buggy:

mypdc:~/samba-3.0.20/source# /usr/local/samba/bin/net rpc shutdown
--server=123.123.123.123 --user=mydomadmin -r -f -t 120 --comment="Shutting down"
Password:
[2005/09/16 08:56:04, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_init_shutdown_internals(4485)
  Shutdown of remote machine failed!
[2005/09/16 08:56:04, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_reg_shutdown_internals(4555)
  Shutdown of remote machine failed!

mypdc:~/samba-3.0.20/source# /usr/local/samba/bin/net rpc shutdown
--server=123.123.123.123 --user=mydomadmin
Password:
[2005/09/16 08:56:24, 0, effective(0, 0), real(0, 0)]
rpc_client/cli_pipe.c:rpc_api_pipe(438)
  cli_pipe: return critical error. Error was NT_STATUS_PIPE_BROKEN
[2005/09/16 08:56:24, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_init_shutdown_internals(4485)
  Shutdown of remote machine failed!
[2005/09/16 08:56:24, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_reg_shutdown_internals(4555)
  Shutdown of remote machine failed!

mypdc:~/samba-3.0.20/source# /usr/local/samba/bin/net rpc shutdown
--server=123.123.123.123 --user=mydomadmin
Password:
Could not connect to server 123.123.123.123

Now the machine *SEEMS* to have shutdown (or crashed). It is a Remote Desktop
reachable system I can't reach anymore, and pinging does not work as well, but I
don't have physical access at the moment. Can't wake it up via etherwake, so I
guess it has crashed...
Comment 4 Gerald (Jerry) Carter (dead mail address) 2005-09-16 14:04:20 UTC
fixed the length calculations for teh shutdown comment string.
Apparently Wnidows is very sensitive to this change.
I'm concerned about makeing the generic sweeping change
for the UNISTR4 struct.  So the simple changes just for 
initializing the shutdown request structure is enough to get 
by for now.

New patch posted on http://www.samba.org/samba/patches/
Comment 5 Florian Effenberger 2005-09-17 15:21:56 UTC
Will test it as soon as I have physical access to the development machine.
Thanks for fixing so fast!
Comment 6 Florian Effenberger 2005-09-18 02:21:11 UTC
I'm sorry, but this still does not seem to work in my environment (Windows XP
SP2 Professional, German, with all current patches applied).

# /usr/local/samba/bin/net rpc shutdown --server=myclient2 --user=domadm
Password:
[2005/09/18 11:11:34, 0, effective(0, 0), real(0, 0)]
rpc_client/cli_pipe.c:rpc_api_pipe(438)
  cli_pipe: return critical error. Error was NT_STATUS_PIPE_BROKEN
[2005/09/18 11:11:34, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_init_shutdown_internals(4485)
  Shutdown of remote machine failed!
[2005/09/18 11:11:34, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_reg_shutdown_internals(4555)
  Shutdown of remote machine failed!

Shortly after that (some five to ten seconds), the machine becomes inaccessible.
I only have RDP access to it, so right now I can't tell you what's on the screen.

Is there any help I could provide you, e.g. debug logs, ethereal traces, etc? I
have root access to the Samba machine and administrator access to the Windows
client.

Using the old 3.0.14a rpcclient just works fine.
Comment 7 Gerald (Jerry) Carter (dead mail address) 2005-09-18 06:33:12 UTC
Can you upload an ethereal trace (gzipped of course) of the failure with 3.0.20.
and the success of 3.0.14a?  Thanks.
Comment 8 Florian Effenberger 2005-09-18 07:03:19 UTC
The trace contains sensitive data (IP addresses, username, password, etc.), I
guess. Can I sent it to someone of the Samba team via private mail? I don't like
to have private data here in Bugzilla. ;-)

Can you post the ethereal command I should use? Any special parameters?
Comment 9 Gerald (Jerry) Carter (dead mail address) 2005-09-19 07:08:34 UTC
That's fine.  Just email the traces directly to me.
You can use 'tcpdump -w /tmp/dump.pcap -s 0 -i eth0'
Comment 10 Florian Effenberger 2005-09-20 09:30:14 UTC
One machine seems to have killed itself completely with "Windows Logon Process
has been terminated unexpectedly", the other machine was just shutdown with no
error message.

First tcpdump trace has been made. Have to wait for a physical poweron to make
the second log and then will mail it to you.
Comment 11 Florian Effenberger 2005-09-20 10:12:13 UTC
Interesting fact: with the rpcclient command, I see the shutdown warning box
with the countdown timer. With the net command, I see nothing, the system just
freezes after some seconds.
Comment 12 Florian Effenberger 2005-09-20 10:15:20 UTC
Files have been mailed to you, Jerry.
Comment 13 Gerald (Jerry) Carter (dead mail address) 2005-09-21 06:15:34 UTC
I can't reproduce this using the current SAMBA_3_0.
I tested against Windows {2000,XP,2003,NT4}

Perhaps I sent you an incomplete patch?  Could you test 
the latest 3.0 svn tree?
Comment 14 Florian Effenberger 2005-09-21 08:09:55 UTC
Maybe I did something wrong with patching, but let's see. ;-)

Just to be safe, can you give me the correct command to checkout the version
from svn you mean? Then I'll compile it and test it again.
Comment 15 Gerald (Jerry) Carter (dead mail address) 2005-09-21 08:41:16 UTC
I've just synced up the release branch.  Do this to grab a checkout of
the tree:

svn co svn://svnanon.samba.org/samba/branches/SAMBA_3_0_RELEASE samba-3.0.20a

Comment 16 Florian Effenberger 2005-09-21 10:27:34 UTC
I just tried it, and it does NOT work, even with the svn checkout. The command I
issued was

/root/svn/samba-3.0.20a/source net rpc shutdown --server=myclient2 --user=domadm

and the error I received some seconds (approx. 5) after entering the password was

[2005/09/21 19:23:31, 0, effective(0, 0), real(0, 0)]
rpc_client/cli_pipe.c:rpc_api_pipe(438)
  cli_pipe: return critical error. Error was NT_STATUS_PIPE_BROKEN
[2005/09/21 19:23:31, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_init_shutdown_internals(4485)
  Shutdown of remote machine failed!
[2005/09/21 19:23:31, 0, effective(0, 0), real(0, 0)]
utils/net_rpc.c:rpc_reg_shutdown_internals(4555)
  Shutdown of remote machine failed!

Jerry, maybe I have an idea. Could you try to reconstruct your problem by
exactly compiling Samba as I compile?

My configure command line is:
./configure --with-pam --with-pam_smbpass --with-quotas --with-sys-quotas
--with-expsam=mysql --with-mysql-prefix=/usr/local/mysql --with-smbmount
--with-winbind

Then I do a slight modification in smbd/sesssetup.c. I know that this is
security by obscurity and maybe not good, but might that be the culprit? It
worked fine for 3.0.14a and all other versions below that. I change the
following to lines:

fstr_sprintf( lanman, "", SAMBA_VERSION_STRING);
p += srvstr_push(outbuf, p, "", -1, STR_TERMINATE);

thus leaving out "Samba" and "Unix" as strings. In passdb/pdb_mysql.c I have to
modify

#include <mysql/mysql.h>
to read
#include <mysql.h>

but that shouldn't be the culprit.

Could you just check that out for yourself and see if you can reconstruct the
problem then?
Comment 17 Gerald (Jerry) Carter (dead mail address) 2005-09-21 11:59:17 UTC
Still works fine.  Are you sure you are using the newly built net?

$ bin/net -V
Version 3.0.20a
Comment 18 Florian Effenberger 2005-09-21 13:02:08 UTC
Thanks for checking that out! It indeed is:

# /root/svn/samba-3.0.20a/source/bin/net -V
Version 3.0.20a

What could we try next? Might my smb.conf help you? Anything I could run on
Windows level?
Comment 19 Gerald (Jerry) Carter (dead mail address) 2005-09-21 16:13:40 UTC
ok.  I just wondered because the command string to wrote here
looked like you were relying on the PATH environment variable.
(/root/svn/samba-3.0.20a/source net rpc shutdown --server=myclient2 --user=domadm).

I'll go back over the traces again.
Comment 20 Florian Effenberger 2005-09-22 01:12:25 UTC
Oh, sorry, my mistake. Of course it should read

/root/svn/samba-3.0.20a/source/net rpc shutdown --server=myclient2 --user=domadm

with one slash after source.

Thanks for investigating this so deeply. If you need any more help or
information, just let me know, and I'll happily provide you with that. ;-)
Comment 21 Gerald (Jerry) Carter (dead mail address) 2005-09-22 11:57:11 UTC
ok.  I've finally been able to reproduce this after getting
the XP sp2 firewall fiasco fixed.  'net rpc shutdown' does
in fact blue screen the xp host.
Comment 22 Gerald (Jerry) Carter (dead mail address) 2005-09-22 12:18:55 UTC
Fixed for real this time.  Run 'svn up' in the 3.0.20a 
checkout and  run 'make bin/net'

Comment 23 Florian Effenberger 2005-09-22 12:45:48 UTC
Yippieh, it works! Thanks a lot for your fast fix, Jerry! Great job! ;-)