git://git.onelab.eu
/
playground.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0252ca4
)
read public keys from vsys. Thanks to Giovanni
author
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Wed, 23 Jun 2010 15:05:27 +0000
(17:05 +0200)
committer
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Wed, 23 Jun 2010 15:05:27 +0000
(17:05 +0200)
omf_keys/key_fs.py
patch
|
blob
|
history
diff --git
a/omf_keys/key_fs.py
b/omf_keys/key_fs.py
index
b9f6c33
..
383b432
100644
(file)
--- a/
omf_keys/key_fs.py
+++ b/
omf_keys/key_fs.py
@@
-14,10
+14,12
@@
import os
import os
+import sys
import stat
import errno
import fuse
import stat
import errno
import fuse
-import sys
+import fcntl
+import select
from fuse import Fuse
fuse.fuse_python_api = (0, 2)
from fuse import Fuse
fuse.fuse_python_api = (0, 2)
@@
-25,9
+27,20
@@
fuse.fuse_python_api = (0, 2)
keys_dir = "/keys"
keys_file = os.path.join(keys_dir, "all")
keys_dir = "/keys"
keys_file = os.path.join(keys_dir, "all")
-# TODO: for Giovanni
def read_keys():
def read_keys():
- return "reading PLC users' public keys\n"
+ fin = os.open("/vsys/publickeys.in", os.O_NONBLOCK | os.O_WRONLY)
+ fout = os.open("/vsys/publickeys.out", os.O_NONBLOCK | os.O_RDONLY)
+
+ in_flags = fcntl.fcntl(fin, fcntl.F_GETFL)
+ out_flags = fcntl.fcntl(fin, fcntl.F_GETFL)
+
+ res = select.select([fout], [], [])
+
+ fcntl.fcntl(fin, fcntl.F_SETFL, in_flags & ~os.O_NONBLOCK)
+ fcntl.fcntl(fout, fcntl.F_SETFL, out_flags & ~os.O_NONBLOCK)
+
+ f = os.fdopen(fout, "r")
+ return f.read()
class MyStat(fuse.Stat):
def __init__(self):
class MyStat(fuse.Stat):
def __init__(self):