File: classUserTable.html

package info (click to toggle)
incron 0.5.10-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,560 kB
  • sloc: cpp: 3,045; makefile: 108; sh: 84
file content (381 lines) | stat: -rw-r--r-- 16,869 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>incron: UserTable Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">incron
   &#160;<span id="projectnumber">0.5.10</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">UserTable Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="UserTable" -->
<p>User table class.  
 <a href="classUserTable.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="usertable_8h_source.html">usertable.h</a>&gt;</code></p>

<p><a href="classUserTable-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#ae9c8e2d54f6d131fa0c46a724cb5ab94">UserTable</a> (<a class="el" href="classEventDispatcher.html">EventDispatcher</a> *pEd, const std::string &amp;rUser, bool fSysTable)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#ae9c8e2d54f6d131fa0c46a724cb5ab94"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#a0ef59efae87ec768c26290982408a8fa">~UserTable</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor.  <a href="#a0ef59efae87ec768c26290982408a8fa"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#a08f1b2836694e3f8c5b13c890a08df9f">Load</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Loads the table.  <a href="#a08f1b2836694e3f8c5b13c890a08df9f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#ae24db4723aa83fc966ee60f0bb942eac">Dispose</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes all entries from the table.  <a href="#ae24db4723aa83fc966ee60f0bb942eac"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#a795e26a707b148a092f85d1f2da02196">OnEvent</a> (<a class="el" href="classInotifyEvent.html">InotifyEvent</a> &amp;rEvt)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Processes an inotify event.  <a href="#a795e26a707b148a092f85d1f2da02196"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#af4dff514ae940802e062f067835c83bf">MayAccess</a> (const std::string &amp;rPath, bool fNoFollow) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks whether the user may access a file.  <a href="#af4dff514ae940802e062f067835c83bf"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#a1f614a23987028538cded38c2c4c15db">IsSystem</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks whether it is a system table.  <a href="#a1f614a23987028538cded38c2c4c15db"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classInotify.html">Inotify</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#a2ae939d2227dc168554d1b13aaeddcbb">GetInotify</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the related inotify object.  <a href="#a2ae939d2227dc168554d1b13aaeddcbb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#ae22959dbccee9b31d8c732c65e660391">RunAsUser</a> (char *const *argv) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Runs a program as the table's user.  <a href="#ae22959dbccee9b31d8c732c65e660391"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#a69af22ff6f6b2dc109e227f56731aceb">FinishDone</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Cleans-up all zombie child processes and enables disabled watches.  <a href="#a69af22ff6f6b2dc109e227f56731aceb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUserTable.html#afa3c0512fa34aaea9d0b2909ca07595b">CheckUser</a> (const char *user)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks whether an user exists and has permission to use incron.  <a href="#afa3c0512fa34aaea9d0b2909ca07595b"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>User table class. </p>
<p>This class processes inotify events for an user. It creates child processes which do appropriate actions as defined in the user table file. </p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ae9c8e2d54f6d131fa0c46a724cb5ab94"></a><!-- doxytag: member="UserTable::UserTable" ref="ae9c8e2d54f6d131fa0c46a724cb5ab94" args="(EventDispatcher *pEd, const std::string &amp;rUser, bool fSysTable)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">UserTable::UserTable </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classEventDispatcher.html">EventDispatcher</a> *&#160;</td>
          <td class="paramname"><em>pEd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>rUser</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>fSysTable</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constructor. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">pEd</td><td>event dispatcher </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">rUser</td><td>user name </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">fSysTable</td><td>system table yes/no </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a0ef59efae87ec768c26290982408a8fa"></a><!-- doxytag: member="UserTable::~UserTable" ref="a0ef59efae87ec768c26290982408a8fa" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">UserTable::~UserTable </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="afa3c0512fa34aaea9d0b2909ca07595b"></a><!-- doxytag: member="UserTable::CheckUser" ref="afa3c0512fa34aaea9d0b2909ca07595b" args="(const char *user)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static bool UserTable::CheckUser </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>user</em></td><td>)</td>
          <td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Checks whether an user exists and has permission to use incron. </p>
<p>It searches for the given user name in the user database. If it failes it returns 'false'. Otherwise it checks permission files for this user (see InCronTab::CheckUser()).</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">user</td><td>user name </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true = user has permission to use incron, false = otherwise</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd>InCronTab::CheckUser() </dd></dl>

</div>
</div>
<a class="anchor" id="ae24db4723aa83fc966ee60f0bb942eac"></a><!-- doxytag: member="UserTable::Dispose" ref="ae24db4723aa83fc966ee60f0bb942eac" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void UserTable::Dispose </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Removes all entries from the table. </p>
<p>All entries are unregistered from the event dispatcher and their watches are destroyed. </p>

</div>
</div>
<a class="anchor" id="a69af22ff6f6b2dc109e227f56731aceb"></a><!-- doxytag: member="UserTable::FinishDone" ref="a69af22ff6f6b2dc109e227f56731aceb" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void UserTable::FinishDone </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Cleans-up all zombie child processes and enables disabled watches. </p>
<dl class="attention"><dt><b>Attention:</b></dt><dd>This method must be called AFTER processing all events which has been caused by the processes. </dd></dl>

</div>
</div>
<a class="anchor" id="a2ae939d2227dc168554d1b13aaeddcbb"></a><!-- doxytag: member="UserTable::GetInotify" ref="a2ae939d2227dc168554d1b13aaeddcbb" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classInotify.html">Inotify</a>* UserTable::GetInotify </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the related inotify object. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>related inotify object </dd></dl>

</div>
</div>
<a class="anchor" id="a1f614a23987028538cded38c2c4c15db"></a><!-- doxytag: member="UserTable::IsSystem" ref="a1f614a23987028538cded38c2c4c15db" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool UserTable::IsSystem </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Checks whether it is a system table. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true = system table, false = user table </dd></dl>

</div>
</div>
<a class="anchor" id="a08f1b2836694e3f8c5b13c890a08df9f"></a><!-- doxytag: member="UserTable::Load" ref="a08f1b2836694e3f8c5b13c890a08df9f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void UserTable::Load </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Loads the table. </p>
<p>All loaded entries have their inotify watches and are registered for event dispatching. If loading fails the table remains empty. </p>

</div>
</div>
<a class="anchor" id="af4dff514ae940802e062f067835c83bf"></a><!-- doxytag: member="UserTable::MayAccess" ref="af4dff514ae940802e062f067835c83bf" args="(const std::string &amp;rPath, bool fNoFollow) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool UserTable::MayAccess </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>rPath</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>fNoFollow</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Checks whether the user may access a file. </p>
<p>Any access right (RWX) is sufficient.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">rPath</td><td>absolute file path </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">fNoFollow</td><td>don't follow a symbolic link </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true = access granted, false = otherwise </dd></dl>

</div>
</div>
<a class="anchor" id="a795e26a707b148a092f85d1f2da02196"></a><!-- doxytag: member="UserTable::OnEvent" ref="a795e26a707b148a092f85d1f2da02196" args="(InotifyEvent &amp;rEvt)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void UserTable::OnEvent </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classInotifyEvent.html">InotifyEvent</a> &amp;&#160;</td>
          <td class="paramname"><em>rEvt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Processes an inotify event. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">rEvt</td><td>inotify event </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ae22959dbccee9b31d8c732c65e660391"></a><!-- doxytag: member="UserTable::RunAsUser" ref="ae22959dbccee9b31d8c732c65e660391" args="(char *const *argv) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void UserTable::RunAsUser </td>
          <td>(</td>
          <td class="paramtype">char *const *&#160;</td>
          <td class="paramname"><em>argv</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Runs a program as the table's user. </p>
<dl class="attention"><dt><b>Attention:</b></dt><dd>Don't call from the main process (before forking)! </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="usertable_8h_source.html">usertable.h</a></li>
<li><a class="el" href="usertable_8cpp.html">usertable.cpp</a></li>
</ul>
</div>


<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>