17 |
|
{ |
18 |
|
bool password(false); |
19 |
|
|
20 |
+ |
// XXX: _unsynchronized |
21 |
+ |
_synchronized (Daemon::secretLock) |
22 |
|
{ |
23 |
|
api::FileReader in(Daemon::secret); |
24 |
|
ext::String line; |
31 |
|
} |
32 |
|
} |
33 |
|
|
34 |
< |
if (!password) |
34 |
> |
if (!password) _synchronized (Daemon::secretLock) |
35 |
|
{ |
36 |
< |
AppendFileWriter out(Daemon::secret); |
36 |
> |
api::FileWriter out(Daemon::secret, O_WRONLY | O_APPEND, 0); |
37 |
|
ios::FormatWriter fout(out); |
38 |
|
|
39 |
|
fout << "[" << share.getHost() << ":" << share.getOwner() << "]" << ios::NewLine << "password=" << share.getPassword() << ios::NewLine; |
51 |
|
credentials << "/tmp/.spectre" << api::Uuid::Create(); |
52 |
|
|
53 |
|
{ |
54 |
< |
SecretFileWriter out(credentials); |
54 |
> |
api::FileWriter out(credentials, O_WRONLY | O_CREAT | O_TRUNC, 0600); |
55 |
|
ios::FormatWriter fout(out); |
56 |
|
|
57 |
|
fout << "username = " << share.getOwner() << ios::NewLine << "password = " << share.getPassword() << ios::NewLine; |