2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: Mounter.cpp,v 1.10 2003/07/31 00:56:29 douglas Exp $ |
5 |
> |
// $Id: Mounter.cpp,v 1.11 2003/07/31 04:14:12 douglas Exp $ |
6 |
|
|
7 |
|
#include "Mounter.h" |
8 |
|
|
20 |
|
{ |
21 |
|
cerr << "mounted = {\n"; |
22 |
|
|
23 |
< |
for (set<string>::iterator itor = mounted.begin(); |
24 |
< |
itor != mounted.end(); itor++) |
23 |
> |
for (set<string>::iterator itor = mounted.begin(); itor != |
24 |
> |
mounted.end(); itor++) |
25 |
|
{ |
26 |
|
cerr << " " << *itor << "\n"; |
27 |
|
} |
50 |
|
string path = config.root + "/" + host; |
51 |
|
DIR* dir = opendir(path.c_str()); |
52 |
|
dirent* file; |
53 |
+ |
|
54 |
+ |
if (dir == NULL) |
55 |
+ |
{ |
56 |
+ |
string prefix = program + ": " + path; |
57 |
+ |
perror(prefix.c_str()); |
58 |
+ |
|
59 |
+ |
return; |
60 |
+ |
} |
61 |
|
|
62 |
|
while ((file = readdir(dir)) != NULL) |
63 |
|
{ |
132 |
|
void Mounter::mount(const string& folder, const string& user, const string& |
133 |
|
owner) |
134 |
|
{ |
135 |
< |
string path = config.root + "/" + host + "/" + (folder[folder.length() - |
136 |
< |
1] == '$' ? "." + folder.substr(0, folder.length() - 1) : folder); |
135 |
> |
string path = config.root + "/" + host + "/" + (folder[folder.length() - 1] |
136 |
> |
== '$' ? "." + folder.substr(0, folder.length() - 1) : folder); |
137 |
|
|
138 |
|
if (mounted.find(path) != mounted.end()) return; |
139 |
|
|
132 |
– |
ostringstream options; |
133 |
– |
|
140 |
|
struct passwd* item = getpwnam(user.c_str()); |
141 |
|
|
142 |
|
if (item == NULL) |
144 |
|
cerr << program << ": " << user << ": Unknown user\n"; |
145 |
|
return; |
146 |
|
} |
147 |
+ |
|
148 |
+ |
ostringstream options; |
149 |
|
|
150 |
|
#if defined _Linux_ |
151 |
|
char credentials[17]; |