1 /*
2    Samba Unix/Linux SMB client library
3    net file commands
4    Copyright (C) 2002  Jim McDonough  (jmcd@us.ibm.com)
5    Copyright (C) 2002  Andrew Tridgell  (tridge@samba.org)
6    Copyright (C) 2008  Kai Blin  (kai@samba.org)
7 
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "includes.h"
23 #include "utils/net.h"
24 
net_file_usage(struct net_context * c,int argc,const char ** argv)25 int net_file_usage(struct net_context *c, int argc, const char **argv)
26 {
27 	d_printf(_("net [<method>] file [misc. options] [targets]\n"
28 		   "\tlists all open files on file server\n"));
29 	d_printf(_("net [<method>] file USER <username> "
30 		   "[misc. options] [targets]"
31 		   "\n\tlists all files opened by username on file server\n"));
32 	d_printf(_("net [<method>] file CLOSE <id> [misc. options] [targets]\n"
33 		   "\tcloses specified file on target server\n"));
34 	d_printf(_("net [rap] file INFO <id> [misc. options] [targets]\n"
35 		   "\tdisplays information about the specified open file\n"));
36 
37 	net_common_methods_usage(c, argc, argv);
38 	net_common_flags_usage(c, argc, argv);
39 	return -1;
40 }
41 
net_file(struct net_context * c,int argc,const char ** argv)42 int net_file(struct net_context *c, int argc, const char **argv)
43 {
44 	if (argc < 1)
45 		return net_file_usage(c, argc, argv);
46 
47 	if (strcasecmp_m(argv[0], "HELP") == 0) {
48 		net_file_usage(c, argc, argv);
49 		return 0;
50 	}
51 
52 	if (net_rpc_check(c, 0))
53 		return net_rpc_file(c, argc, argv);
54 	return net_rap_file(c, argc, argv);
55 }
56 
57 
58