From 66d5d73a5d75e88a77970f7b27687b8354ab2e80 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 25 Sep 1998 21:01:52 +0000 Subject: added rpcclient program (This used to be commit aa38f39d67fade4dfd7badb7a9b39c833a1dd1ca) --- source3/rpcclient/cmd_wkssvc.c | 96 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 source3/rpcclient/cmd_wkssvc.c (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c new file mode 100644 index 0000000000..99524cba77 --- /dev/null +++ b/source3/rpcclient/cmd_wkssvc.c @@ -0,0 +1,96 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + NT Domain Authentication SMB / MSRPC client + Copyright (C) Andrew Tridgell 1994-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + + +#ifdef SYSLOG +#undef SYSLOG +#endif + +#include "includes.h" +#include "nterr.h" + +extern int DEBUGLEVEL; + +#define DEBUG_TESTING + +extern struct cli_state *smb_cli; +extern int smb_tidx; + +extern FILE* out_hnd; + + +/**************************************************************************** +workstation get info query +****************************************************************************/ +void cmd_wks_query_info(struct client_info *info) +{ + fstring dest_wks; + fstring tmp; + WKS_INFO_100 ctr; + uint32 info_level = 100; + + BOOL res = True; + + bzero(&ctr, sizeof(ctr)); + + strcpy(dest_wks, "\\\\"); + strcat(dest_wks, info->dest_host); + strupper(dest_wks); + + if (next_token(NULL, tmp, NULL)) + { + info_level = strtoul(tmp, (char**)NULL, 10); + } + + DEBUG(4,("cmd_wks_query_info: server:%s info level: %D\n", + dest_wks, info_level)); + + DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); + + /* open LSARPC session. */ + res = res ? do_session_open(smb_cli, smb_tidx, PIPE_WKSSVC, &(info->dom.wkssvc_fnum)) : False; + + /* send info level: receive requested info. hopefully. */ + res = res ? do_wks_query_info(smb_cli, smb_tidx, info->dom.wkssvc_fnum, + dest_wks, info_level, &ctr) : False; + + /* close the session */ + do_session_close(smb_cli, smb_tidx, info->dom.wkssvc_fnum); + + if (res) + { + DEBUG(5,("cmd_wks_query_info: query succeeded\n")); + +#if 0 + display_wks_info_100(out_hnd, DISPLAY_TXT, ACTION_HEADER , &ctr); + display_wks_info_100(out_hnd, DISPLAY_TXT, ACTION_ENUMERATE, &ctr); + display_wks_info_100(out_hnd, DISPLAY_TXT, ACTION_FOOTER , &ctr); +#endif + + } + else + { + DEBUG(5,("cmd_wks_query_info: query failed\n")); + } +} + -- cgit From ff07b2e4a37f23af90a27456a116b773ae3bbf97 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 25 Sep 1998 21:20:37 +0000 Subject: added wksinfo command to rpcclient, which don't work too good. (This used to be commit 8d23da91cbd74a45a5b030688fd89d88a25738dc) --- source3/rpcclient/cmd_wkssvc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 99524cba77..abe017d410 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -34,7 +34,6 @@ extern int DEBUGLEVEL; #define DEBUG_TESTING extern struct cli_state *smb_cli; -extern int smb_tidx; extern FILE* out_hnd; @@ -53,11 +52,11 @@ void cmd_wks_query_info(struct client_info *info) bzero(&ctr, sizeof(ctr)); - strcpy(dest_wks, "\\\\"); - strcat(dest_wks, info->dest_host); + fstrcpy(dest_wks, "\\\\"); + fstrcat(dest_wks, info->dest_host); strupper(dest_wks); - if (next_token(NULL, tmp, NULL)) + if (next_token(NULL, tmp, NULL, sizeof(tmp))) { info_level = strtoul(tmp, (char**)NULL, 10); } @@ -68,23 +67,23 @@ void cmd_wks_query_info(struct client_info *info) DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); /* open LSARPC session. */ - res = res ? do_session_open(smb_cli, smb_tidx, PIPE_WKSSVC, &(info->dom.wkssvc_fnum)) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC, False) : False; /* send info level: receive requested info. hopefully. */ - res = res ? do_wks_query_info(smb_cli, smb_tidx, info->dom.wkssvc_fnum, + res = res ? do_wks_query_info(smb_cli, dest_wks, info_level, &ctr) : False; /* close the session */ - do_session_close(smb_cli, smb_tidx, info->dom.wkssvc_fnum); + cli_nt_session_close(smb_cli); if (res) { DEBUG(5,("cmd_wks_query_info: query succeeded\n")); #if 0 - display_wks_info_100(out_hnd, DISPLAY_TXT, ACTION_HEADER , &ctr); - display_wks_info_100(out_hnd, DISPLAY_TXT, ACTION_ENUMERATE, &ctr); - display_wks_info_100(out_hnd, DISPLAY_TXT, ACTION_FOOTER , &ctr); + display_wks_info_100(out_hnd, ACTION_HEADER , &ctr); + display_wks_info_100(out_hnd, ACTION_ENUMERATE, &ctr); + display_wks_info_100(out_hnd, ACTION_FOOTER , &ctr); #endif } -- cgit From c9d26f921c57bb01cec77488835991fc51903116 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 25 Sep 1998 23:24:28 +0000 Subject: Fixed unused variable warning messages. Jeremy. (This used to be commit 64ad5b4bb0f302703c9be1f76bd6211dc9871d19) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index abe017d410..350aa29657 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -61,7 +61,7 @@ void cmd_wks_query_info(struct client_info *info) info_level = strtoul(tmp, (char**)NULL, 10); } - DEBUG(4,("cmd_wks_query_info: server:%s info level: %D\n", + DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n", dest_wks, info_level)); DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); -- cgit From d4a82ea26d5b9501f210a5c441b1ac09c256a187 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 16 Oct 1998 20:07:02 +0000 Subject: rpc client mods (ntlmssp flags) (This used to be commit 16256f86bf451535c7955b8f51a9b88fc33a8e4d) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 350aa29657..0093fbf7c8 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -67,7 +67,7 @@ void cmd_wks_query_info(struct client_info *info) DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC, False) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC) : False; /* send info level: receive requested info. hopefully. */ res = res ? do_wks_query_info(smb_cli, -- cgit From 4865debe85a0e22692ce61ab5438b651fd91ba92 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 16 Oct 1998 22:01:57 +0000 Subject: strtoul removed, strtol used instead (This used to be commit d717d58c115fc5cf687af098100cf5adc0265afc) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 0093fbf7c8..ee1e9748a5 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -58,7 +58,7 @@ void cmd_wks_query_info(struct client_info *info) if (next_token(NULL, tmp, NULL, sizeof(tmp))) { - info_level = strtoul(tmp, (char**)NULL, 10); + info_level = (uint32)strtol(tmp, (char**)NULL, 10); } DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n", -- cgit From 9c848ec329a6ce86cffb2304746590116d9292f0 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 7 Dec 1998 20:23:41 +0000 Subject: removed nt_pipe_fnum from struct cli_state. need to be able to call LsaLookupSids etc from within SamrQueryAliasMembers, for example. fnum is now a parameter to client functions. thanks to mike black for starting the ball rolling. (This used to be commit bee8f7fa6b0f7f995f71303f4e14a4aaed0c2437) --- source3/rpcclient/cmd_wkssvc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index ee1e9748a5..7915036609 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -43,6 +43,7 @@ workstation get info query ****************************************************************************/ void cmd_wks_query_info(struct client_info *info) { + uint16 nt_pipe_fnum; fstring dest_wks; fstring tmp; WKS_INFO_100 ctr; @@ -67,14 +68,14 @@ void cmd_wks_query_info(struct client_info *info) DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC, &nt_pipe_fnum) : False; /* send info level: receive requested info. hopefully. */ - res = res ? do_wks_query_info(smb_cli, + res = res ? do_wks_query_info(smb_cli, nt_pipe_fnum, dest_wks, info_level, &ctr) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { -- cgit From aa12f3e0e922f42318b71c601cba08a6c96ff486 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 22 Nov 1999 19:02:39 +0000 Subject: okay :) all cmd_() functions now take int argc, char **argv :) that means that some commands need more work, as they still use next_token(), the use of which i wish to avoid. plus, i was getting fed up of the poor command-line processing in some of these commands. i'm starting to need getopt() in them, especially in samsetuser. WARNING: only cmd_samr has been modded to use getopt() so far! reg commands won't work, esp. (This used to be commit 9a1efa03c8bb86c9b7e73f102a9d48fb6a57a523) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 7915036609..426e6690a0 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -41,7 +41,7 @@ extern FILE* out_hnd; /**************************************************************************** workstation get info query ****************************************************************************/ -void cmd_wks_query_info(struct client_info *info) +void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]) { uint16 nt_pipe_fnum; fstring dest_wks; -- cgit From 48a4df7dac6e076bee0a1de9540108676792377b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 22 Nov 1999 19:25:30 +0000 Subject: moved two more commands over to getopt. (This used to be commit de360d1e908b4e2e77cd028b19f3ccd07903a4dd) --- source3/rpcclient/cmd_wkssvc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 426e6690a0..23f7a88d27 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -45,7 +45,6 @@ void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]) { uint16 nt_pipe_fnum; fstring dest_wks; - fstring tmp; WKS_INFO_100 ctr; uint32 info_level = 100; @@ -57,9 +56,9 @@ void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]) fstrcat(dest_wks, info->dest_host); strupper(dest_wks); - if (next_token(NULL, tmp, NULL, sizeof(tmp))) + if (argc > 1) { - info_level = (uint32)strtol(tmp, (char**)NULL, 10); + info_level = (uint32)strtol(argv[1], (char**)NULL, 10); } DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n", -- cgit From 9fef73c27e07dbf658681e6c1027602328ed0add Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 27 Nov 1999 22:34:12 +0000 Subject: updated \PIPE\wkssvc commands to use new abstracted connection system. modified resolve_srv_name() to return dest host of *SMBSERVER if server name is \\ip.add.ress.format (This used to be commit 3204829225792974c8b20efb6ba6e24661a4f658) --- source3/rpcclient/cmd_wkssvc.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 23f7a88d27..474c53f347 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -33,8 +33,6 @@ extern int DEBUGLEVEL; #define DEBUG_TESTING -extern struct cli_state *smb_cli; - extern FILE* out_hnd; @@ -43,7 +41,6 @@ workstation get info query ****************************************************************************/ void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]) { - uint16 nt_pipe_fnum; fstring dest_wks; WKS_INFO_100 ctr; uint32 info_level = 100; @@ -64,17 +61,8 @@ void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]) DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n", dest_wks, info_level)); - DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); - - /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC, &nt_pipe_fnum) : False; - /* send info level: receive requested info. hopefully. */ - res = res ? do_wks_query_info(smb_cli, nt_pipe_fnum, - dest_wks, info_level, &ctr) : False; - - /* close the session */ - cli_nt_session_close(smb_cli, nt_pipe_fnum); + res = res ? wks_query_info( dest_wks, info_level, &ctr) : False; if (res) { -- cgit From 3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:27:58 +0000 Subject: first pass at updating head branch to be to be the same as the SAMBA_2_0 branch (This used to be commit 453a822a76780063dff23526c35408866d0c0154) --- source3/rpcclient/cmd_wkssvc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 474c53f347..0b8f469af3 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -33,36 +33,48 @@ extern int DEBUGLEVEL; #define DEBUG_TESTING +extern struct cli_state *smb_cli; + extern FILE* out_hnd; /**************************************************************************** workstation get info query ****************************************************************************/ -void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]) +void cmd_wks_query_info(struct client_info *info) { fstring dest_wks; + fstring tmp; WKS_INFO_100 ctr; uint32 info_level = 100; BOOL res = True; - bzero(&ctr, sizeof(ctr)); + memset((char *)&ctr, '\0', sizeof(ctr)); fstrcpy(dest_wks, "\\\\"); fstrcat(dest_wks, info->dest_host); strupper(dest_wks); - if (argc > 1) + if (next_token(NULL, tmp, NULL, sizeof(tmp))) { - info_level = (uint32)strtol(argv[1], (char**)NULL, 10); + info_level = (uint32)strtol(tmp, (char**)NULL, 10); } DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n", dest_wks, info_level)); + DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); + + /* open LSARPC session. */ + res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC) : False; + /* send info level: receive requested info. hopefully. */ - res = res ? wks_query_info( dest_wks, info_level, &ctr) : False; + res = res ? do_wks_query_info(smb_cli, + dest_wks, info_level, &ctr) : False; + + /* close the session */ + cli_nt_session_close(smb_cli); if (res) { -- cgit From 00e3fe132476fcaed0f4b9bbe74b0a6559c39df0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 25 Apr 2000 14:06:57 +0000 Subject: moved trans2.h and nterr.h into includes.h with all our other includes (This used to be commit d7cd7c88fdabb01d9e40ae8a657737907a21ac37) --- source3/rpcclient/cmd_wkssvc.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 0b8f469af3..1e64f384ae 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -27,7 +27,6 @@ #endif #include "includes.h" -#include "nterr.h" extern int DEBUGLEVEL; -- cgit From 91b8a8d1d21b810b6aca44ce647837669efd6dcf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 21 Jun 2001 09:10:42 +0000 Subject: next_token() was supposed to be a reentrant replacement for strtok(), but the code suffered from bitrot and is not now reentrant. That means we can get bizarre behaviour i've fixed this by making next_token() reentrant and creating a next_token_nr() that is a small non-reentrant wrapper for those lumps of code (mostly smbclient) that have come to rely on the non-reentrant behaviour (This used to be commit 674ee2f1d12b0afc164a9e9072758fd1c5e54df7) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 1e64f384ae..69a3920c27 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -55,7 +55,7 @@ void cmd_wks_query_info(struct client_info *info) fstrcat(dest_wks, info->dest_host); strupper(dest_wks); - if (next_token(NULL, tmp, NULL, sizeof(tmp))) + if (next_token_nr(NULL, tmp, NULL, sizeof(tmp))) { info_level = (uint32)strtol(tmp, (char**)NULL, 10); } -- cgit From dc1fc3ee8ec2199bc73bb5d7ec711c6800f61d65 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 2 Oct 2001 04:29:50 +0000 Subject: Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. (This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e) --- source3/rpcclient/cmd_wkssvc.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 69a3920c27..6801f17c00 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -28,8 +28,6 @@ #include "includes.h" -extern int DEBUGLEVEL; - #define DEBUG_TESTING extern struct cli_state *smb_cli; @@ -91,4 +89,3 @@ void cmd_wks_query_info(struct client_info *info) DEBUG(5,("cmd_wks_query_info: query failed\n")); } } - -- cgit From a689b24db14436ab1faa2f2f79b9f27b777b1fdb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 14 Oct 2001 12:10:29 +0000 Subject: the next step in the intl changeover. This should get us compiling agian, and also completes the switch to lang_tdb.c. SWAT should now work with a po file in the lib/ directory also removed useless SYSLOG defines in many files (This used to be commit 5296b20ad85d7519c870768455cb4d8df048c55a) --- source3/rpcclient/cmd_wkssvc.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 6801f17c00..52c110dbd5 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -20,12 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - - -#ifdef SYSLOG -#undef SYSLOG -#endif - #include "includes.h" #define DEBUG_TESTING -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/rpcclient/cmd_wkssvc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 52c110dbd5..79acf35943 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -1,6 +1,5 @@ /* - Unix SMB/Netbios implementation. - Version 1.9. + Unix SMB/CIFS implementation. NT Domain Authentication SMB / MSRPC client Copyright (C) Andrew Tridgell 1994-1997 Copyright (C) Luke Kenneth Casson Leighton 1996-1997 -- cgit From 36ef82a52953384acedbd51f54ded9357fa8ca3e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Oct 2002 04:10:23 +0000 Subject: merge of new client side support the Win2k LSARPC UUID in rpcbind from APP_HEAD (This used to be commit 1cfd2ee433305e91e87804dd55d10e025d30a69e) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 79acf35943..bb118234c0 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -57,7 +57,7 @@ void cmd_wks_query_info(struct client_info *info) DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC) : False; + res = res ? cli_nt_session_open(smb_cli, PI_WKSSVC) : False; /* send info level: receive requested info. hopefully. */ res = res ? do_wks_query_info(smb_cli, -- cgit From ce0709666c2c4a921b3d6e957dfd7d8ca58f6f9d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jul 2003 18:52:31 +0000 Subject: More conversions I missed. Thanks metze. Jeremy. (This used to be commit 4f78d747e66b38edcd2a5754681f9a01aeaf7864) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index bb118234c0..137ff3bdae 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -44,7 +44,7 @@ void cmd_wks_query_info(struct client_info *info) fstrcpy(dest_wks, "\\\\"); fstrcat(dest_wks, info->dest_host); - strupper(dest_wks); + strupper_m(dest_wks); if (next_token_nr(NULL, tmp, NULL, sizeof(tmp))) { -- cgit From 54abd2aa66069e6baf7769c496f46d9dba18db39 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Sep 2005 17:13:37 +0000 Subject: r10656: BIG merge from trunk. Features not copied over * \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3) --- source3/rpcclient/cmd_wkssvc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 137ff3bdae..a65cd1f799 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -19,6 +19,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +THIS IS NO LONGER USED - NEEDS REMOVAL. + #include "includes.h" #define DEBUG_TESTING -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index a65cd1f799..ce1a93363b 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -6,7 +6,7 @@ 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 2 of the License, or + 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, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/rpcclient/cmd_wkssvc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index ce1a93363b..13f1f3f39e 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -15,8 +15,7 @@ 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ THIS IS NO LONGER USED - NEEDS REMOVAL. -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/rpcclient/cmd_wkssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 13f1f3f39e..de5b29880a 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -39,7 +39,7 @@ void cmd_wks_query_info(struct client_info *info) WKS_INFO_100 ctr; uint32 info_level = 100; - BOOL res = True; + bool res = True; memset((char *)&ctr, '\0', sizeof(ctr)); -- cgit From 9cc7b8e2a0728e5e1664509ef60e15da0d72bdfc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 3 Dec 2007 12:42:17 +0100 Subject: Reanimate rpcclient wkssvc command. Guenther (This used to be commit 1d615e3ac397106f47c51ace36c01a8f6e1d5d13) --- source3/rpcclient/cmd_wkssvc.c | 97 ++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 65 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index de5b29880a..4f4c364ea2 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -1,85 +1,52 @@ -/* +/* Unix SMB/CIFS implementation. - NT Domain Authentication SMB / MSRPC client - Copyright (C) Andrew Tridgell 1994-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - + RPC pipe client + + Copyright (C) Günther Deschner 2007 + 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 . */ -THIS IS NO LONGER USED - NEEDS REMOVAL. - #include "includes.h" +#include "rpcclient.h" -#define DEBUG_TESTING - -extern struct cli_state *smb_cli; - -extern FILE* out_hnd; - - -/**************************************************************************** -workstation get info query -****************************************************************************/ -void cmd_wks_query_info(struct client_info *info) +static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) { - fstring dest_wks; - fstring tmp; - WKS_INFO_100 ctr; - uint32 info_level = 100; - - bool res = True; - - memset((char *)&ctr, '\0', sizeof(ctr)); - - fstrcpy(dest_wks, "\\\\"); - fstrcat(dest_wks, info->dest_host); - strupper_m(dest_wks); - - if (next_token_nr(NULL, tmp, NULL, sizeof(tmp))) - { - info_level = (uint32)strtol(tmp, (char**)NULL, 10); + NTSTATUS status; + uint32_t level = 100; + union wkssvc_NetWkstaInfo info; + const char *server_name; + + server_name = cli->cli->desthost; + + status = rpccli_wkssvc_NetWkstaGetInfo(cli, mem_ctx, + server_name, + level, + &info); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); } - DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n", - dest_wks, info_level)); - - DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); - - /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PI_WKSSVC) : False; - - /* send info level: receive requested info. hopefully. */ - res = res ? do_wks_query_info(smb_cli, - dest_wks, info_level, &ctr) : False; - - /* close the session */ - cli_nt_session_close(smb_cli); - - if (res) - { - DEBUG(5,("cmd_wks_query_info: query succeeded\n")); + return WERR_OK; +} -#if 0 - display_wks_info_100(out_hnd, ACTION_HEADER , &ctr); - display_wks_info_100(out_hnd, ACTION_ENUMERATE, &ctr); - display_wks_info_100(out_hnd, ACTION_FOOTER , &ctr); -#endif +struct cmd_set wkssvc_commands[] = { - } - else - { - DEBUG(5,("cmd_wks_query_info: query failed\n")); - } -} + { "WKSSVC" }, + { "wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, + { NULL } +}; -- cgit From 6b37d8e627a2b983a5801ec533e536dd67e5f0e5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 3 Dec 2007 18:40:09 +0100 Subject: Fix wkssvc callers. Guenther (This used to be commit b734cd8aab163d794b969c4e1e721e81a8b4d44c) --- source3/rpcclient/cmd_wkssvc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 4f4c364ea2..f3ff8113e9 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -27,6 +27,7 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, const char **argv) { NTSTATUS status; + WERROR werr; uint32_t level = 100; union wkssvc_NetWkstaInfo info; const char *server_name; @@ -36,12 +37,13 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, status = rpccli_wkssvc_NetWkstaGetInfo(cli, mem_ctx, server_name, level, - &info); + &info, + &werr); if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); } - return WERR_OK; + return werr; } struct cmd_set wkssvc_commands[] = { -- cgit From 7bfe569b7d3cd0709c166ab484d600ff1e2ce580 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 6 Dec 2007 19:05:54 +0100 Subject: Allow to set level in cmd_wkssvc_wkstagetinfo(). Guenther (This used to be commit 2c287ce0507a019aaa4d8dec74bc5c515ec2e3c7) --- source3/rpcclient/cmd_wkssvc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index f3ff8113e9..5873f17813 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -32,6 +32,15 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, union wkssvc_NetWkstaInfo info; const char *server_name; + if (argc > 2) { + printf("usage: %s \n", argv[0]); + return WERR_OK; + } + + if (argc > 1) { + level = atoi(argv[1]); + } + server_name = cli->cli->desthost; status = rpccli_wkssvc_NetWkstaGetInfo(cli, mem_ctx, -- cgit From 09c4b72a5730dc9c91d537632d3a9ca0a7c04c0b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 3 Dec 2007 13:12:26 +0100 Subject: Add getjoininformation to rpcclient. Guenther (This used to be commit 699f6b1bc332b1e2834f5c384440b2501838c43f) --- source3/rpcclient/cmd_wkssvc.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 5873f17813..b0c548f925 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -55,9 +55,35 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, return werr; } +static WERROR cmd_wkssvc_getjoininformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + const char *server_name; + const char *name_buffer; + enum wkssvc_NetJoinStatus name_type; + NTSTATUS status; + + server_name = cli->cli->desthost; + name_buffer = ""; + + status = rpccli_wkssvc_NetrGetJoinInformation(cli, mem_ctx, + server_name, &name_buffer, + &name_type); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + printf("%s (%d)\n", name_buffer, name_type); + + return WERR_OK; +} + struct cmd_set wkssvc_commands[] = { { "WKSSVC" }, { "wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, + { "getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, PI_WKSSVC, NULL, "Query WKSSVC Join Information", "" }, { NULL } }; -- cgit From 783afeb5fa563bcfd6635fd07076447f0c586dc5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 6 Dec 2007 19:06:30 +0100 Subject: Add cmd_wkssvc_messagebuffersend(). Guenther (This used to be commit 71e512efabe833a850cce3ed827415b5d1c032d5) --- source3/rpcclient/cmd_wkssvc.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index b0c548f925..d32a4c591f 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -80,10 +80,45 @@ static WERROR cmd_wkssvc_getjoininformation(struct rpc_pipe_client *cli, return WERR_OK; } +static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + const char *server_name = cli->cli->desthost; + const char *message_name = cli->cli->desthost; + const char *message_sender_name = cli->cli->desthost; + smb_ucs2_t *message_buffer = NULL; + size_t message_size = 0; + NTSTATUS status; + WERROR werr; + + message_size = push_ucs2_talloc(mem_ctx, + &message_buffer, + "my message"); + if (message_size == -1) { + return WERR_NOMEM; + } + + status = rpccli_wkssvc_NetrMessageBufferSend(cli, mem_ctx, + server_name, + message_name, + message_sender_name, + (uint8_t *)message_buffer, + message_size, + &werr); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + return werr; +} + struct cmd_set wkssvc_commands[] = { { "WKSSVC" }, - { "wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, - { "getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, PI_WKSSVC, NULL, "Query WKSSVC Join Information", "" }, + { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, + { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, PI_WKSSVC, NULL, "Query WKSSVC Join Information", "" }, + { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, PI_WKSSVC, NULL, "Send WKSSVC message", "" }, { NULL } }; -- cgit From 61dbd449b8918e52d7de8011dec0cb5f79bb25c5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 3 Dec 2007 22:12:31 +0100 Subject: Fix build with new werror based pidl rpc. Guenther (This used to be commit 0e8fdfac8a7754c105f01bd21816a7940c20e878) --- source3/rpcclient/cmd_wkssvc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index d32a4c591f..44b77decd2 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -64,20 +64,25 @@ static WERROR cmd_wkssvc_getjoininformation(struct rpc_pipe_client *cli, const char *name_buffer; enum wkssvc_NetJoinStatus name_type; NTSTATUS status; + WERROR werr; server_name = cli->cli->desthost; name_buffer = ""; status = rpccli_wkssvc_NetrGetJoinInformation(cli, mem_ctx, - server_name, &name_buffer, - &name_type); + server_name, + &name_buffer, + &name_type, + &werr); if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); } - printf("%s (%d)\n", name_buffer, name_type); + if (W_ERROR_IS_OK(werr)) { + printf("%s (%d)\n", name_buffer, name_type); + } - return WERR_OK; + return werr; } static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, -- cgit From b2fac35adf2821e20fc9e74287e9d171b258ab6e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 7 Dec 2007 11:56:48 +0100 Subject: Allow to set custom message in wkssvc messagebuffer. Guenther (This used to be commit 4c03cbdc816842f1d657fdc8499e3ad9a459f0d7) --- source3/rpcclient/cmd_wkssvc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 44b77decd2..d136cd0d45 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -95,12 +95,17 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, const char *message_sender_name = cli->cli->desthost; smb_ucs2_t *message_buffer = NULL; size_t message_size = 0; + const char *message = "my message"; NTSTATUS status; WERROR werr; + if (argc > 1) { + message = argv[1]; + } + message_size = push_ucs2_talloc(mem_ctx, &message_buffer, - "my message"); + message); if (message_size == -1) { return WERR_NOMEM; } -- cgit From 5eca35e0ca0537908f8e5068d36b0a5d744d937e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 11:08:27 +0100 Subject: Add cmd_wkssvc_enumeratecomputernames to rpcclient. Guenther (This used to be commit 289151393a43c7f0c2baafdd79d1163fc80aad6a) --- source3/rpcclient/cmd_wkssvc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index d136cd0d45..68f408cf48 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -124,11 +124,48 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, return werr; } +static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + const char *server_name; + enum wkssvc_ComputerNameType name_type = NetAllComputerNames; + NTSTATUS status; + struct wkssvc_ComputerNamesCtr *ctr = NULL; + WERROR werr; + + server_name = cli->cli->desthost; + + if (argc >= 2) { + name_type = atoi(argv[1]); + } + + status = rpccli_wkssvc_NetrEnumerateComputerNames(cli, mem_ctx, + server_name, + name_type, 0, + &ctr, + &werr); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + if (W_ERROR_IS_OK(werr)) { + int i=0; + for (i = 0; i < ctr->count; i++) { + printf("name: %d %s\n", i, ctr->computer_name->string); + } + } + + return werr; +} + struct cmd_set wkssvc_commands[] = { { "WKSSVC" }, { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, PI_WKSSVC, NULL, "Query WKSSVC Join Information", "" }, { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, PI_WKSSVC, NULL, "Send WKSSVC message", "" }, + { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, PI_WKSSVC, NULL, "Enumerate WKSSVC computer names", "" }, { NULL } }; -- cgit From 2a2188591b5ed922d09dc723adcf10f8b8f5e5a0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Apr 2008 21:56:43 +0200 Subject: Add "desthost" to rpc_pipe_client This reduces the dependency on cli_state (This used to be commit 783afab9c891dd7bcb78895b2a639b6f3a0edf5b) --- source3/rpcclient/cmd_wkssvc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 68f408cf48..fbf483bd2b 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -41,7 +41,7 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, level = atoi(argv[1]); } - server_name = cli->cli->desthost; + server_name = cli->desthost; status = rpccli_wkssvc_NetWkstaGetInfo(cli, mem_ctx, server_name, @@ -66,7 +66,7 @@ static WERROR cmd_wkssvc_getjoininformation(struct rpc_pipe_client *cli, NTSTATUS status; WERROR werr; - server_name = cli->cli->desthost; + server_name = cli->desthost; name_buffer = ""; status = rpccli_wkssvc_NetrGetJoinInformation(cli, mem_ctx, @@ -90,9 +90,9 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, int argc, const char **argv) { - const char *server_name = cli->cli->desthost; - const char *message_name = cli->cli->desthost; - const char *message_sender_name = cli->cli->desthost; + const char *server_name = cli->desthost; + const char *message_name = cli->desthost; + const char *message_sender_name = cli->desthost; smb_ucs2_t *message_buffer = NULL; size_t message_size = 0; const char *message = "my message"; @@ -135,7 +135,7 @@ static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli, struct wkssvc_ComputerNamesCtr *ctr = NULL; WERROR werr; - server_name = cli->cli->desthost; + server_name = cli->desthost; if (argc >= 2) { name_type = atoi(argv[1]); -- cgit From fb37f156009611af0dd454a0fb0829a09cd638ac Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Tue, 29 Apr 2008 14:36:24 -0700 Subject: Cleanup size_t return values in callers of convert_string_allocate This patch is the second iteration of an inside-out conversion to cleanup functions in charcnv.c returning size_t == -1 to indicate failure. (This used to be commit 6b189dabc562d86dcaa685419d0cb6ea276f100d) --- source3/rpcclient/cmd_wkssvc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index fbf483bd2b..d17ea01370 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -103,10 +103,9 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, message = argv[1]; } - message_size = push_ucs2_talloc(mem_ctx, - &message_buffer, - message); - if (message_size == -1) { + if (!push_ucs2_talloc(mem_ctx, &message_buffer, message, + &message_size)) + { return WERR_NOMEM; } -- cgit From 82b5f54f96b1161b8357a69b985c75f2853573ef Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jul 2008 18:17:52 +0200 Subject: Refactoring: rpcclient uses ndr_syntax_id instead of pipe_idx (This used to be commit 85db87c451dacf80e9575c04e9e08c625b3f1199) --- source3/rpcclient/cmd_wkssvc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpcclient/cmd_wkssvc.c') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index d17ea01370..7a34c450ab 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -162,9 +162,9 @@ static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli, struct cmd_set wkssvc_commands[] = { { "WKSSVC" }, - { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, - { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, PI_WKSSVC, NULL, "Query WKSSVC Join Information", "" }, - { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, PI_WKSSVC, NULL, "Send WKSSVC message", "" }, - { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, PI_WKSSVC, NULL, "Enumerate WKSSVC computer names", "" }, + { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, &ndr_table_wkssvc.syntax_id, NULL, "Query WKSSVC Workstation Information", "" }, + { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, &ndr_table_wkssvc.syntax_id, NULL, "Query WKSSVC Join Information", "" }, + { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, &ndr_table_wkssvc.syntax_id, NULL, "Send WKSSVC message", "" }, + { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, &ndr_table_wkssvc.syntax_id, NULL, "Enumerate WKSSVC computer names", "" }, { NULL } }; -- cgit