b311480e |
1 | // Copyright (c) 1998-1999 Matra Datavision |
2 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
3 | // |
4 | // The content of this file is subject to the Open CASCADE Technology Public |
5 | // License Version 6.5 (the "License"). You may not use the content of this file |
6 | // except in compliance with the License. Please obtain a copy of the License |
7 | // at http://www.opencascade.org and read it completely before using this file. |
8 | // |
9 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
10 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
11 | // |
12 | // The Original Code and all software distributed under the License is |
13 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
14 | // Initial Developer hereby disclaims all such warranties, including without |
15 | // limitation, any warranties of merchantability, fitness for a particular |
16 | // purpose or non-infringement. Please see the License for the specific terms |
17 | // and conditions governing the rights and limitations under the License. |
18 | |
7fd59977 |
19 | |
20 | #ifndef WNT |
21 | |
22 | #include <OSD_WhoAmI.hxx> |
23 | #include <OSD_Protection.ixx> |
24 | |
25 | #include <sys/stat.h> |
7fd59977 |
26 | // Ci-joint le tableau de gestion des protection (Ajout et Retrait). Les |
27 | // tableaux sont des tableaux a deux dimensions, indices par l'enumeration |
28 | // OSD_SingleProtection. Il y a en tout 16 possibilites dans l enumeration. |
29 | // Voir JPT pour tous renseignements.... |
7fd59977 |
30 | static OSD_SingleProtection TabProtAdd [16][16] = |
31 | { |
32 | {OSD_None,OSD_R,OSD_W,OSD_RW,OSD_X,OSD_RX,OSD_WX,OSD_RWX,OSD_D,OSD_RD,OSD_WD,OSD_RWD,OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD}, |
33 | |
34 | {OSD_R,OSD_R,OSD_RW,OSD_RW,OSD_RX,OSD_RX,OSD_RWX,OSD_RWX,OSD_RD,OSD_RD,OSD_RWD,OSD_RWD,OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD}, |
35 | |
36 | {OSD_W,OSD_RW,OSD_W,OSD_RW,OSD_WX,OSD_RWX,OSD_WX,OSD_RWX,OSD_WD,OSD_RWD,OSD_WD,OSD_RWD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD}, |
37 | |
38 | {OSD_RW,OSD_RW,OSD_RW,OSD_RW,OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWD,OSD_RWD,OSD_RWD,OSD_RWD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD}, |
39 | |
40 | {OSD_X,OSD_RX,OSD_WX,OSD_RWX,OSD_X,OSD_RX,OSD_WX,OSD_RWX,OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD,OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD}, |
41 | |
42 | {OSD_RX,OSD_RX,OSD_RWX,OSD_RWX,OSD_RX,OSD_RX,OSD_RWX,OSD_RWX,OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD,OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD}, |
43 | |
44 | {OSD_WX,OSD_RWX,OSD_RWX,OSD_RWX,OSD_WX,OSD_RWX,OSD_WX,OSD_RWX,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD}, |
45 | |
46 | {OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWX,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD}, |
47 | |
48 | {OSD_D,OSD_RD,OSD_WD,OSD_RWD,OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD,OSD_D,OSD_RD,OSD_WD,OSD_RWD,OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD}, |
49 | |
50 | {OSD_RD,OSD_RD,OSD_RWD,OSD_RWD,OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD,OSD_RD,OSD_RD,OSD_RWD,OSD_RWD,OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD}, |
51 | |
52 | {OSD_WD,OSD_RWD,OSD_WD,OSD_RWD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WD,OSD_RWD,OSD_WD,OSD_RWD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD}, |
53 | |
54 | {OSD_RWD,OSD_RWD,OSD_RWD,OSD_RWD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWD,OSD_RWD,OSD_RWD,OSD_RWD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD}, |
55 | |
56 | {OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD,OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD,OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD,OSD_XD,OSD_RXD,OSD_WXD,OSD_RWXD}, |
57 | |
58 | {OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD,OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD,OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD,OSD_RXD,OSD_RXD,OSD_RWXD,OSD_RWXD}, |
59 | |
60 | {OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD,OSD_WXD,OSD_RWXD}, |
61 | |
62 | {OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD,OSD_RWXD} |
63 | |
64 | }; |
65 | |
66 | // ----------------------- |
67 | |
68 | static OSD_SingleProtection TabProtSub [16][16] = |
69 | { |
70 | {OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None}, |
71 | |
72 | {OSD_R,OSD_None,OSD_R,OSD_None,OSD_R,OSD_None,OSD_R,OSD_None,OSD_R,OSD_None,OSD_R,OSD_None,OSD_R,OSD_None,OSD_R,OSD_None}, |
73 | |
74 | {OSD_W,OSD_W,OSD_None,OSD_None,OSD_W,OSD_W,OSD_None,OSD_None,OSD_W,OSD_W,OSD_None,OSD_None,OSD_W,OSD_W,OSD_None,OSD_None}, |
75 | |
76 | {OSD_RW,OSD_W,OSD_R,OSD_None,OSD_RW,OSD_W,OSD_R,OSD_None,OSD_RW,OSD_W,OSD_R,OSD_None,OSD_RW,OSD_W,OSD_R,OSD_None}, |
77 | |
78 | {OSD_X,OSD_X,OSD_X,OSD_None,OSD_None,OSD_None,OSD_None,OSD_X,OSD_X,OSD_X,OSD_X,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None}, |
79 | |
80 | {OSD_RX,OSD_X,OSD_RX,OSD_X,OSD_R,OSD_None,OSD_R,OSD_None,OSD_RX,OSD_X,OSD_RX,OSD_X,OSD_R,OSD_None,OSD_R,OSD_None}, |
81 | |
82 | {OSD_WX,OSD_WX,OSD_X,OSD_X,OSD_W,OSD_W,OSD_None,OSD_None,OSD_WX,OSD_WX,OSD_X,OSD_X,OSD_W,OSD_W,OSD_None,OSD_None}, |
83 | |
84 | {OSD_RWX,OSD_WX,OSD_RX,OSD_X,OSD_RW,OSD_W,OSD_R,OSD_None,OSD_RWX,OSD_WX,OSD_RX,OSD_X,OSD_RW,OSD_W,OSD_R,OSD_None}, |
85 | |
86 | {OSD_D,OSD_D,OSD_D,OSD_D,OSD_D,OSD_D,OSD_D,OSD_D,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None,OSD_None}, |
87 | |
88 | {OSD_RD,OSD_D,OSD_RD,OSD_D,OSD_RD,OSD_D,OSD_RD,OSD_D,OSD_R,OSD_None,OSD_R,OSD_None,OSD_R,OSD_None,OSD_R,OSD_None}, |
89 | |
90 | {OSD_WD,OSD_WD,OSD_D,OSD_D,OSD_WD,OSD_WD,OSD_D,OSD_D,OSD_W,OSD_W,OSD_None,OSD_None,OSD_W,OSD_W,OSD_None,OSD_None}, |
91 | |
92 | {OSD_RWD,OSD_WD,OSD_RD,OSD_D,OSD_RWD,OSD_WD,OSD_RD,OSD_D,OSD_RW,OSD_W,OSD_R,OSD_None,OSD_RW,OSD_W,OSD_R,OSD_None}, |
93 | |
94 | {OSD_XD,OSD_XD,OSD_XD,OSD_XD,OSD_D,OSD_D,OSD_D,OSD_D,OSD_X,OSD_X,OSD_X,OSD_X,OSD_None,OSD_None,OSD_None,OSD_None}, |
95 | |
96 | {OSD_RXD,OSD_XD,OSD_RXD,OSD_XD,OSD_RD,OSD_D,OSD_RD,OSD_D,OSD_RX,OSD_X,OSD_RX,OSD_X,OSD_R,OSD_None,OSD_R,OSD_None}, |
97 | |
98 | {OSD_WXD,OSD_WXD,OSD_XD,OSD_XD,OSD_WD,OSD_WD,OSD_D,OSD_D,OSD_WX,OSD_WX,OSD_X,OSD_X,OSD_W,OSD_W,OSD_None,OSD_None}, |
99 | |
100 | {OSD_RWXD,OSD_WXD,OSD_RXD,OSD_XD,OSD_RWD,OSD_WD,OSD_RD,OSD_D,OSD_RWX,OSD_WX,OSD_RX,OSD_X,OSD_RW,OSD_W,OSD_R,OSD_None} |
101 | |
102 | }; |
103 | //const OSD_WhoAmI Iam = OSD_WProtection; |
104 | |
105 | |
106 | // Initialize System, Group, World for read only and User for read & write |
107 | |
108 | OSD_Protection::OSD_Protection(){ |
109 | s = OSD_R; |
110 | u = OSD_RWD; |
111 | g = OSD_R; |
112 | w = OSD_R; |
113 | } |
114 | |
115 | OSD_Protection::OSD_Protection(const OSD_SingleProtection System, |
116 | const OSD_SingleProtection User, |
117 | const OSD_SingleProtection Group, |
118 | const OSD_SingleProtection World){ |
119 | |
120 | s = System; |
121 | u = User; |
122 | g = Group; |
123 | w = World; |
124 | } |
125 | |
126 | void OSD_Protection::Values(OSD_SingleProtection& System, |
127 | OSD_SingleProtection& User, |
128 | OSD_SingleProtection& Group, |
129 | OSD_SingleProtection& World){ |
130 | System = s; |
131 | User = u; |
132 | Group = g; |
133 | World = w; |
134 | } |
135 | |
136 | |
137 | void OSD_Protection::SetValues(const OSD_SingleProtection System, |
138 | const OSD_SingleProtection User, |
139 | const OSD_SingleProtection Group, |
140 | const OSD_SingleProtection World){ |
141 | |
142 | s = System; |
143 | u = User; |
144 | g = Group; |
145 | w = World; |
146 | } |
147 | |
148 | |
149 | void OSD_Protection::SetSystem (const OSD_SingleProtection priv){ |
150 | s = priv; |
151 | } |
152 | |
153 | void OSD_Protection::SetUser (const OSD_SingleProtection priv){ |
154 | u = priv; |
155 | } |
156 | |
157 | void OSD_Protection::SetGroup (const OSD_SingleProtection priv){ |
158 | g = priv; |
159 | } |
160 | |
161 | void OSD_Protection::SetWorld (const OSD_SingleProtection priv){ |
162 | w = priv; |
163 | } |
164 | |
165 | |
166 | OSD_SingleProtection OSD_Protection::System()const{ |
167 | return(s); |
168 | } |
169 | |
170 | OSD_SingleProtection OSD_Protection::User()const{ |
171 | return(u); |
172 | } |
173 | |
174 | OSD_SingleProtection OSD_Protection::Group()const{ |
175 | return(g); |
176 | } |
177 | |
178 | OSD_SingleProtection OSD_Protection::World()const{ |
179 | return(w); |
180 | } |
181 | |
182 | |
183 | void OSD_Protection::Add(OSD_SingleProtection& aProtection, |
184 | const OSD_SingleProtection aRight){ |
185 | aProtection = TabProtAdd[aProtection][aRight]; |
186 | } |
187 | |
188 | |
189 | void OSD_Protection::Sub(OSD_SingleProtection& aProtection, |
190 | const OSD_SingleProtection aRight){ |
191 | aProtection = TabProtSub[aProtection][aRight]; |
192 | } |
193 | |
194 | |
195 | /* Get internal UNIX's access rights for user, group and other */ |
196 | |
197 | Standard_Integer OSD_Protection::Internal()const{ |
198 | |
199 | Standard_Integer internal_prot = 0; |
200 | |
201 | if (u & OSD_R) internal_prot |= S_IRUSR; |
202 | if (u & OSD_W) internal_prot |= S_IWUSR; |
203 | if (u & OSD_D) internal_prot |= S_IWUSR; |
204 | if (u & OSD_X) internal_prot |= S_IXUSR; |
205 | |
206 | if (g & OSD_R) internal_prot |= S_IRGRP; |
207 | if (g & OSD_W) internal_prot |= S_IWGRP; |
208 | if (g & OSD_D) internal_prot |= S_IWGRP; |
209 | if (g & OSD_X) internal_prot |= S_IXGRP; |
210 | |
211 | if (w & OSD_R) internal_prot |= S_IROTH; |
212 | if (w & OSD_W) internal_prot |= S_IWOTH; |
213 | if (w & OSD_D) internal_prot |= S_IWOTH; |
214 | if (w & OSD_X) internal_prot |= S_IXOTH; |
215 | |
216 | if (s & OSD_R) internal_prot |= S_IROTH; |
217 | if (s & OSD_W) internal_prot |= S_IWOTH; |
218 | if (s & OSD_D) internal_prot |= S_IWOTH; |
219 | if (s & OSD_X) internal_prot |= S_IXOTH; |
220 | |
221 | return ( internal_prot ); |
222 | } |
223 | |
224 | |
225 | #else |
226 | |
227 | //------------------------------------------------------------------------ |
228 | //------------------- WNT Sources of OSD_Protection --------------------- |
229 | //------------------------------------------------------------------------ |
230 | |
231 | #include <OSD_Protection.hxx> |
232 | |
233 | #define FLAG_READ 0x00000001 |
234 | #define FLAG_WRITE 0x00000002 |
235 | #define FLAG_EXECUTE 0x00000004 |
236 | #define FLAG_DELETE 0x00000008 |
237 | |
238 | static Standard_Integer __fastcall _get_mask ( OSD_SingleProtection ); |
239 | static OSD_SingleProtection __fastcall _get_prot ( Standard_Integer ); |
240 | |
241 | OSD_Protection :: OSD_Protection () { |
242 | |
243 | s = OSD_RWXD; |
244 | u = OSD_RWXD; |
245 | g = OSD_RX; |
246 | w = OSD_RX; |
247 | |
248 | } // end constructor ( 1 ) |
249 | |
250 | OSD_Protection :: OSD_Protection ( |
251 | const OSD_SingleProtection System, |
252 | const OSD_SingleProtection User, |
253 | const OSD_SingleProtection Group, |
254 | const OSD_SingleProtection World |
255 | ) { |
256 | |
257 | SetValues ( System, User, Group, World ); |
258 | |
259 | } // end constructor ( 2 ) |
260 | |
261 | void OSD_Protection :: Values ( |
262 | OSD_SingleProtection& System, |
263 | OSD_SingleProtection& User, |
264 | OSD_SingleProtection& Group, |
265 | OSD_SingleProtection& World |
266 | ) { |
267 | System = s; |
268 | User = u; |
269 | Group = g; |
270 | World = w; |
271 | |
272 | } // end OSD_Protection :: Values |
273 | |
274 | void OSD_Protection :: SetValues ( |
275 | const OSD_SingleProtection System, |
276 | const OSD_SingleProtection User, |
277 | const OSD_SingleProtection Group, |
278 | const OSD_SingleProtection World |
279 | ) { |
280 | |
281 | s = System; |
282 | u = User; |
283 | g = Group; |
284 | w = World; |
285 | |
286 | } // end OSD_Protection :: SetValues |
287 | |
288 | void OSD_Protection :: SetSystem ( const OSD_SingleProtection priv ) { |
289 | |
290 | s = priv; |
291 | |
292 | } // end OSD_Protection :: SetSystem |
293 | |
294 | void OSD_Protection :: SetUser ( const OSD_SingleProtection priv ) { |
295 | |
296 | u = priv; |
297 | |
298 | } // end OSD_Protection :: SetUser |
299 | |
300 | void OSD_Protection :: SetGroup ( const OSD_SingleProtection priv ) { |
301 | |
302 | g = priv; |
303 | |
304 | } // end OSD_Protection :: SetGroup |
305 | |
306 | void OSD_Protection :: SetWorld ( const OSD_SingleProtection priv ) { |
307 | |
308 | w = priv; |
309 | |
310 | } // end OSD_Protection :: SetWorld |
311 | |
312 | OSD_SingleProtection OSD_Protection :: System () const { |
313 | |
314 | return s; |
315 | |
316 | } // end OSD_Protection :: System |
317 | |
318 | OSD_SingleProtection OSD_Protection :: User () const { |
319 | |
320 | return u; |
321 | |
322 | } // end OSD_Protection :: User |
323 | |
324 | OSD_SingleProtection OSD_Protection :: Group () const { |
325 | |
326 | return g; |
327 | |
328 | } // end OSD_Protection :: Group |
329 | |
330 | OSD_SingleProtection OSD_Protection :: World () const { |
331 | |
332 | return w; |
333 | |
334 | } // end OSD_Protection :: World |
335 | |
336 | void OSD_Protection :: Add ( |
337 | OSD_SingleProtection& aProt, |
338 | const OSD_SingleProtection aRight |
339 | ) { |
340 | |
341 | Standard_Integer pMask = 0; |
342 | Standard_Integer rMask = 0; |
343 | Standard_Integer sMask = 0; |
344 | |
345 | pMask = _get_mask ( aProt ); |
346 | rMask = _get_mask ( aRight ); |
347 | |
348 | if ( ( rMask & FLAG_READ && !( pMask & FLAG_READ ) ) || pMask & FLAG_READ ) |
349 | |
350 | sMask |= FLAG_READ; |
351 | |
352 | if ( ( rMask & FLAG_WRITE && !( pMask & FLAG_WRITE ) ) || pMask & FLAG_WRITE ) |
353 | |
354 | sMask |= FLAG_WRITE; |
355 | |
356 | if ( ( rMask & FLAG_EXECUTE && !( pMask & FLAG_EXECUTE ) ) || pMask & FLAG_EXECUTE ) |
357 | |
358 | sMask |= FLAG_EXECUTE; |
359 | |
360 | if ( ( rMask & FLAG_DELETE && !( pMask & FLAG_DELETE ) ) || pMask & FLAG_DELETE ) |
361 | |
362 | sMask |= FLAG_DELETE; |
363 | |
364 | aProt = _get_prot ( sMask ); |
365 | |
366 | } // end OSD_Protection :: Add |
367 | |
368 | void OSD_Protection :: Sub ( |
369 | OSD_SingleProtection& aProt, |
370 | const OSD_SingleProtection aRight |
371 | ) { |
372 | |
373 | Standard_Integer pMask = 0; |
374 | Standard_Integer rMask = 0; |
375 | |
376 | pMask = _get_mask ( aProt ); |
377 | rMask = _get_mask ( aRight ); |
378 | |
379 | if ( rMask & FLAG_READ ) |
380 | |
381 | pMask &= ~FLAG_READ; |
382 | |
383 | if ( rMask & FLAG_WRITE ) |
384 | |
385 | pMask &= ~FLAG_WRITE; |
386 | |
387 | if ( rMask & FLAG_EXECUTE ) |
388 | |
389 | pMask &= ~FLAG_EXECUTE; |
390 | |
391 | if ( rMask & FLAG_DELETE ) |
392 | |
393 | pMask &= ~FLAG_DELETE; |
394 | |
395 | aProt = _get_prot ( pMask ); |
396 | |
397 | } // end OSD_Protection :: Sub |
398 | |
399 | Standard_Integer OSD_Protection :: Internal () const { |
400 | |
401 | return 0; |
402 | |
403 | } // end OSD_Protection :: Internal |
404 | |
405 | static Standard_Integer __fastcall _get_mask ( OSD_SingleProtection p ) { |
406 | |
407 | Standard_Integer retVal = 0; |
408 | |
409 | if ( p == OSD_R || p == OSD_RW || p == OSD_RX || p == OSD_RWX || |
410 | p == OSD_RXD || p == OSD_RWXD || p == OSD_RD || p == OSD_RWD |
411 | ) retVal |= FLAG_READ; |
412 | |
413 | if ( p == OSD_W || p == OSD_RW || p == OSD_WX || p == OSD_RWX || |
414 | p == OSD_WXD || p == OSD_RWXD || p == OSD_WD || p == OSD_RWD |
415 | ) retVal |= FLAG_WRITE; |
416 | |
417 | if ( p == OSD_X || p == OSD_RX || p == OSD_WX || p == OSD_RWX || |
418 | p == OSD_XD || p == OSD_RXD || p == OSD_WXD || p == OSD_RWXD |
419 | ) retVal |= FLAG_EXECUTE; |
420 | |
421 | if ( p == OSD_D || p == OSD_RD || p == OSD_WD || p == OSD_RWD || |
422 | p == OSD_XD || p == OSD_RXD || p == OSD_WXD || p == OSD_RWXD |
423 | ) retVal |= FLAG_DELETE; |
424 | |
425 | return retVal; |
426 | |
427 | } // end _get_mask |
428 | |
429 | static OSD_SingleProtection __fastcall _get_prot ( Standard_Integer m ) { |
430 | |
431 | OSD_SingleProtection retVal; |
432 | |
433 | switch ( m ) { |
434 | |
435 | case FLAG_READ: |
436 | |
437 | retVal = OSD_R; |
438 | |
439 | break; |
440 | |
441 | case FLAG_WRITE: |
442 | |
443 | retVal = OSD_W; |
444 | |
445 | break; |
446 | |
447 | case FLAG_READ | FLAG_WRITE: |
448 | |
449 | retVal = OSD_RW; |
450 | |
451 | break; |
452 | |
453 | case FLAG_EXECUTE: |
454 | |
455 | retVal = OSD_X; |
456 | |
457 | break; |
458 | |
459 | case FLAG_READ | FLAG_EXECUTE: |
460 | |
461 | retVal = OSD_RX; |
462 | |
463 | break; |
464 | |
465 | case FLAG_WRITE | FLAG_EXECUTE: |
466 | |
467 | retVal = OSD_WX; |
468 | |
469 | break; |
470 | |
471 | case FLAG_READ | FLAG_WRITE | FLAG_EXECUTE: |
472 | |
473 | retVal = OSD_RWX; |
474 | |
475 | break; |
476 | |
477 | case FLAG_DELETE: |
478 | |
479 | retVal = OSD_D; |
480 | |
481 | break; |
482 | |
483 | case FLAG_READ | FLAG_DELETE: |
484 | |
485 | retVal = OSD_RD; |
486 | |
487 | break; |
488 | |
489 | case FLAG_WRITE | FLAG_DELETE: |
490 | |
491 | retVal = OSD_WD; |
492 | |
493 | break; |
494 | |
495 | case FLAG_READ | FLAG_WRITE | FLAG_DELETE: |
496 | |
497 | retVal = OSD_RWD; |
498 | |
499 | break; |
500 | |
501 | case FLAG_EXECUTE | FLAG_DELETE: |
502 | |
503 | retVal = OSD_XD; |
504 | |
505 | break; |
506 | |
507 | case FLAG_READ | FLAG_EXECUTE | FLAG_DELETE: |
508 | |
509 | retVal = OSD_RXD; |
510 | |
511 | break; |
512 | |
513 | case FLAG_WRITE | FLAG_EXECUTE | FLAG_DELETE: |
514 | |
515 | retVal = OSD_WXD; |
516 | |
517 | break; |
518 | |
519 | case FLAG_READ | FLAG_WRITE | FLAG_EXECUTE | FLAG_DELETE: |
520 | |
521 | retVal = OSD_RWXD; |
522 | |
523 | break; |
524 | |
525 | default: |
526 | |
527 | retVal = OSD_None; |
528 | |
529 | } // end switch |
530 | |
531 | return retVal; |
532 | |
533 | } // end _get_prot |
534 | |
535 | #endif |