1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
samba-mirror/source3/rpc_server/rpc_config.c
David Disseldorp b6e034069f fsrvp: add remote snapshot RPC server
The Samba fss_agent RPC server is an implementation of the File Server
Remote VSS (Volume Shadow Copy Service) Protocol, or FSRVP for short.

FSRVP is new with Windows Server 2012, and allows authenticated clients
to remotely request the creation, exposure and deletion of share
snapshots.

The fss_agent RPC server processes requests on the FssAgentRpc named
pipe, and dispatches relevant snapshot creation and deletion requests
through to the VFS.
The registry smb.conf back-end is used to expose snapshot shares, with
configuration parameters and share ACLs cloned from the base share.

There are three FSRVP client implementations that I'm aware of:
- Samba rpcclient includes fss_X commands.
- Windows Server 2012 includes diskshadow.exe.
- System Center 2012.

FSRVP operations are only processed for users with:
- Built-in Administrators group membership, or
- Built-in Backup Operators group membership, or
- Backup Operator privileges, or
- Security token matches the initial process UID

MS-FSRVP specifies that server state should be stored persistently
during operation and retrieved on startup. Use the existing fss_srv.tdb
FSRVP state storage back-end to satisfy this requirement.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-31 18:40:25 +02:00

132 lines
3.4 KiB
C

/*
Unix SMB/Netbios implementation.
Generic infrastructure for RPC Daemons
Copyright (C) Simo Sorce 2011
Copyright (C) Andreas Schneider 2011
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 <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "rpc_server/rpc_config.h"
/* the default is "embedded" so this table
* lists only services that are not using
* the default in order to keep enumerating it
* in rpc_service_mode() as short as possible
*/
struct rpc_service_defaults {
const char *name;
const char *def_mode;
} rpc_service_defaults[] = {
{ "epmapper", "disabled" },
/* { "spoolss", "embedded" }, */
/* { "lsarpc", "embedded" }, */
/* { "samr", "embedded" }, */
/* { "netlogon", "embedded" }, */
{ "fssagentrpc", "external" },
{ NULL, NULL }
};
enum rpc_service_mode_e rpc_service_mode(const char *name)
{
const char *pipe_name = name;
const char *rpcsrv_type;
enum rpc_service_mode_e state;
const char *def;
int i;
/* Handle pipes with multiple names */
if (strcmp(pipe_name, "lsass") == 0) {
pipe_name = "lsarpc";
} else if (strcmp(pipe_name, "plugplay") == 0) {
pipe_name = "ntsvcs";
}
def = lp_parm_const_string(GLOBAL_SECTION_SNUM,
"rpc_server", "default", NULL);
if (def == NULL) {
for (i = 0; rpc_service_defaults[i].name; i++) {
if (strcasecmp_m(pipe_name, rpc_service_defaults[i].name) == 0) {
def = rpc_service_defaults[i].def_mode;
break;
}
}
/* if the default is unspecified then use 'embedded' */
if (def == NULL) {
def = "embedded";
}
}
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
"rpc_server", pipe_name, def);
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
state = RPC_SERVICE_MODE_EMBEDDED;
} else if (strcasecmp_m(rpcsrv_type, "external") == 0) {
state = RPC_SERVICE_MODE_EXTERNAL;
} else {
state = RPC_SERVICE_MODE_DISABLED;
}
return state;
}
/* the default is "embedded" so this table
* lists only daemons that are not using
* the default in order to keep enumerating it
* in rpc_daemon_type() as short as possible
*/
struct rpc_daemon_defaults {
const char *name;
const char *def_type;
} rpc_daemon_defaults[] = {
{ "epmd", "disabled" },
/* { "spoolssd", "embedded" }, */
/* { "lsasd", "embedded" }, */
{ "fssd", "disabled" },
{ NULL, NULL }
};
enum rpc_daemon_type_e rpc_daemon_type(const char *name)
{
const char *rpcsrv_type;
enum rpc_daemon_type_e type;
const char *def;
int i;
def = "embedded";
for (i = 0; rpc_daemon_defaults[i].name; i++) {
if (strcasecmp_m(name, rpc_daemon_defaults[i].name) == 0) {
def = rpc_daemon_defaults[i].def_type;
}
}
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
"rpc_daemon", name, def);
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
type = RPC_DAEMON_EMBEDDED;
} else if (strcasecmp_m(rpcsrv_type, "fork") == 0) {
type = RPC_DAEMON_FORK;
} else {
type = RPC_DAEMON_DISABLED;
}
return type;
}