summaryrefslogtreecommitdiff
path: root/netfs/daemon/daemonService.cpp
blob: fe77e5ee3fc7acce7de0833b412904201921e53b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "daemon.h"
#include "daemonService.h"
#include "daemonVolume.h"

ServiceServer::ServiceServer(NetFS::Daemon::ConfigurationPtr c) :
	config(c)
{
}

NetFS::VolumePrx
ServiceServer::connect(const std::string & share, const std::string & authtoken, const Ice::Current & ice)
{
	//boost::lock_guard<boost::mutex> lg(lock);
	NetFS::Daemon::ExportMap::iterator e = config->Exports.find(share);
	if (e == config->Exports.end()) {
		throw NetFS::ConfigError();
	}
	if (!e->second->AuthToken.empty() && e->second->AuthToken != authtoken) {
		throw NetFS::AuthError();
	}
	return NetFS::VolumePrx::checkedCast(ice.adapter->addWithUUID(new VolumeServer(e->second->RootPath, userLookup, groupLookup)));
}