Debian Codegraph @

wdoc/ace_write_access.html

raw
1 <HTML>
2
3 <HEAD>
4 <TITLE> ACEDB source code documentation: Database Write Access </TITLE>
5
6 <LINK rel=stylesheet type="text/css"
7 href="./wdoc.css"
8 title="Style sheet for wdoc developer documents">
9
10 </HEAD>
11
12 <BODY>
13
14 <H1>Write Access for ACEDB/client</H1>
15
16 <p>There are a number of tests that must be passed before ACEDB will give
17 write access to a user. </p>
18
19 <p>The first requirement is that the process must have Unix write access
20 to the database files in database/ (in detail the files ACEDB.wrm and
21 log.wrm are checked up front, and the particular blocks file when
22 needed). The next section describes ways to arrange for this.</p>
23
24 <p>Second, your user name must be in the file wspec/passwd.wrm. The user
25 name is obtained via the system call getlogin(), which gets the login
26 user id, not the effective user if. This means that you can not "su"
27 to a user name that has write access -- you must log in as them. If
28 getlogin() fails for some reason on your machine (rare), then the name
29 "getLoginFailed" will be matched, i.e. in this case you can add
30 getLoginFailed to passwd.wrm to allow user access (to everyone).</p>
31
32 <p>Third, acedb checks the lock status of the database. It must be able
33 to open/create the file database/lock.wrm with read/write permissions.
34 Next, by default, it must be able to establish a non-blocking lock on
35 this file, using lockf(), which is supposed to work across NFS.
36 Unfortunately problems do occur with this locking system. Some Unix
37 implementations are bugged or incompatible across NFS, and sometimes
38 the lock daemon has been disabled or is not running. In these cases,
39 you can bypass the lock checking process by adding "NOLOCK" as a
40 pseudo user name in wspec/passwd.wrm.</p>
41
42 <p>Finally, an internal check is made on the database that somebody else
43 has not changed the database since you started acedb. This can not
44 reliably replace the locking process, because NFS caches files, so
45 that two people on different machines can be looking at different
46 versions of the same file. If you want to do serious multi-user
47 editing, get lockf() working, or look at the server/client version.</p>
48
49 <p>Previous versions of acedb used to look at an environment variable
50 called "ACEDB_SU", and refuse to give write access unless it was set.
51 This is no longer the case, the presence or absence of an environment
52 variable of that name is of supreme indifference to acedb 4.</p>
53
54 <h2>Multi user write access</h2>
55
56 <p>Notice that an edition done by one user and committed to the disk
57 by the Save option of the menu of the main window is not propagated
58 to other users of acedb who started their code prior to this Save.
59 They have to quit and restart to see it. </p>
60
61 <p>To keep the database consistent despite this limitation, acedb will
62 prevent user X to get write access either if another user already has
63 write access, or if an other user has edited the database since
64 user X has started his session.</p>
65
66 <p>In other words, acedb has an irreversible global write lock that let only
67 a single user have write access after the time the session was started.</p>
68
69 <p>Multi users can edit simmultaneously the database only via the client/server
70 setting. However, as of jan 97 we do not have a correct graphic xace client.
71 The server is therefore used in the following way. Automatic programs
72 read and write to the server to accumulate data from data acquisition
73 machines in the form of ace files, while simmultaneously other scripts
74 prepare data for visualisation through the web.</p>
75
76 <p>To gain graphic access, a special script was wriiten at the Sanger which
77 starts a new ace databse, import relevant data, let the user edit what he
78 want in xace and then commit the edited data to the server.</p>
79
80 <p>Possibly, this system will be improved and be part of our distribution
81 next summer.</p>
82
83 <h2>Using setuid</h2>
84
85 <p>In order to give communal write access to an acedb database under
86 unix, the following procedure should be adopted.</p>
87
88 <ol>
89 <li> create (or have created) as pseudo-user called (eg) acedb.
90
91 <li> make the acedb database and ensure that the following files
92 permissions are set.
93
94 <li>
95 <ol>
96 <li> directory wspec and the files it contains are world readable
97 <li> database and the files it contains are world readable.
98 <li> database and the files it contains are owned by user acedb
99 and owner-writeable
100 </ol>
101
102 <li> make executables (xace and tace) owned by user acedb, and
103 with file permissions 4755.
104
105 <li> Users who are to have write access to the database should appear in
106 the file wspec/passwd.wrm
107 </ol>
108
109 <p>This uses the unix setuid mechanism to give the xace or tace processes
110 the access priviledges of user acedb. They swap between the persona of
111 acedb and the user who actually invoked them, so that all file
112 accesses apart from to the databse directory are in the persona of the
113 real user, and not affected. One can thus write dump files in personal
114 directories OK. (this used to be a problem.)</p>
115
116 <p>A final word of caution. Never, NEVER make xace or tace setuid root.
117 There are certainly security holes in acedb which would allow intruders
118 to get a super-user shell if you did, and there is no reason to do so.</p>
119
120 </BODY>
121 </HTML>