Пример #1
0
int net_rap_file(int argc, const char **argv)
{
	struct functable func[] = {
		{"CLOSE", rap_file_close},
		{"USER", rap_file_user},
		{"INFO", rap_file_info},
		{NULL, NULL}
	};
	
	if (argc == 0) {
		struct cli_state *cli;
		int ret;
		
		if (!(cli = net_make_ipc_connection(0))) 
                        return -1;

		/* list open files */
		d_printf(
		 "\nEnumerating open files on remote server:\n\n"\
		 "\nFileId  Opened by            Perms  Locks  Path \n"\
		 "------  ---------            -----  -----  ---- \n");
		ret = cli_NetFileEnum(cli, NULL, NULL, file_fn);
		cli_shutdown(cli);
		return ret;
	}
	
	return net_run_function(argc, argv, func, net_rap_file_usage);
}
Пример #2
0
static int rap_file_user(struct net_context *c, int argc, const char **argv)
{
	struct cli_state *cli;
	int ret;

	if (argc == 0 || c->display_usage)
		return net_rap_file_usage(c, argc, argv);

	if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli)))
		return -1;

	/* list open files */

	d_printf(_("\nEnumerating open files on remote server:\n\n"
		   "\nFileId  Opened by            Perms  Locks  Path \n"
		   "------  ---------            -----  -----  ---- \n"));
	ret = cli_NetFileEnum(cli, argv[0], NULL, file_fn);

	if (ret == -1)
		d_printf(_("\nOperation not supported by server!\n\n"));

	cli_shutdown(cli);
	return ret;
}
Пример #3
0
int net_rap_file(struct net_context *c, int argc, const char **argv)
{
	struct functable func[] = {
		{
			"close",
			rap_file_close,
			NET_TRANSPORT_RAP,
			N_("Close specified file on server"),
			N_("net rap file close\n"
			   "    Close specified file on server")
		},
		{
			"user",
			rap_file_user,
			NET_TRANSPORT_RAP,
			N_("List all files opened by username"),
			N_("net rap file user\n"
			   "    List all files opened by username")
		},
		{
			"info",
			rap_file_info,
			NET_TRANSPORT_RAP,
			N_("Display info about an opened file"),
			N_("net rap file info\n"
			   "    Display info about an opened file")
		},
		{NULL, NULL, 0, NULL, NULL}
	};

	if (argc == 0) {
		struct cli_state *cli;
		int ret;

		if (c->display_usage) {
			d_printf(_("Usage:\n"));
			d_printf(_("net rap file\n"
				   "    List all open files on rempte "
				   "server\n"));
			net_display_usage_from_functable(func);
			return 0;
		}

		if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli)))
                        return -1;

		/* list open files */

		d_printf(_("\nEnumerating open files on remote server:\n\n"
			   "\nFileId  Opened by            Perms  Locks  Path\n"
			   "------  ---------            -----  -----  ----\n"));
		ret = cli_NetFileEnum(cli, NULL, NULL, file_fn);

		if (ret == -1)
			d_printf(_("\nOperation not supported by server!\n\n"));

		cli_shutdown(cli);
		return ret;
	}

	return net_run_function(c, argc, argv, "net rap file", func);
}