4 * Copyright (c) 1998 - 2002 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the Institute nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 %#include <fs_errors.h>
44 error-function conv_to_arla_errno
53 const PRINEWUSER = 500;
54 const PRWHEREISIT = 501;
55 const PRDUMPENTRY = 502;
56 const PRADDTOGROUP = 503;
57 const PRNAMETOUID = 504;
58 const PRIDTONAME = 505;
60 const PRREMOVEFROMGROUP = 507;
62 const PRNEWENTRY = 509;
63 const PRLISTMAX = 510;
65 const PRLISTENTRY = 512;
66 const PRCHANGEENTRY = 513;
67 const PRLISTELEMENTS = 514;
68 const PROSAMEMBEROF = 515;
69 const PRSETFIELDSENTRY = 516;
70 const PRLISTOWNED = 517;
71 const PRGETCPS2 = 518;
72 const PRGETHOSTCPS = 519;
76 const PR_MAXNAMELEN = 64;
77 const PR_MAXGROUPS = 5000;
78 const PR_MAXLIST = 5000;
82 const ENTRYSIZE = 192;
83 const HASHSIZE = 8191;
85 const PRDBVERSION = 0;
87 /* Bits for PR_SetFieldsEntry() */
89 const PR_SF_NGROUPS = 0x80000000;
90 const PR_SF_NUSERS = 0x40000000;
91 const PR_SF_ALLBITS = 0xff;
94 const PR_SYSADMINID = -204;
95 const PR_ANYUSERID = -101;
96 const PR_AUTHUSERID = -102;
97 const PR_ANONYMOUSID = 32766;
98 const PR_BADID = 0x80000000;
100 /* Bits for struct prentry flags */
106 const PRFOREIGN = 16;
110 const PRACCESS = 0x40;
111 const PRQUOTA = 0x80;
115 const PRP_REMOVE_MEM = 0x010000;
116 const PRP_ADD_MEM = 0x020000;
117 const PRP_ADD_ANY = 0x040000;
118 const PRP_MEMBER_MEM = 0x080000;
119 const PRP_MEMBER_ANY = 0x100000;
120 const PRP_OWNED_ANY = 0x200000;
121 const PRP_STATUS_MEM = 0x400000;
122 const PRP_STATUS_ANY = 0x800000;
126 const PR_REMEMBER_TIMES = 1;
144 long nameHash[HASHSIZE];
145 long idHash[HASHSIZE];
148 struct prheader_disk {
164 long entries[PRSIZE];
178 char name[PR_MAXNAMELEN];
181 struct prentry_disk {
188 long owned<PR_MAXGROUPS>;
189 string name<PR_MAXNAMELEN>;
190 long entries<PR_MAXGROUPS>;
193 struct prdebugentry {
199 long entries[PRSIZE];
213 char name[PR_MAXNAMELEN];
216 struct prcheckentry {
225 char name[PR_MAXNAMELEN];
229 typedef char prname[PR_MAXNAMELEN];
231 typedef prname namelist<PR_MAXLIST>;
233 typedef long idlist<PR_MAXLIST>;
235 typedef long prlist<PR_MAXGROUPS>;
240 const PREXIST = 267264 ;
241 const PRIDEXIST = 267265 ;
242 const PRNOIDS = 267266 ;
243 const PRDBFAIL = 267267 ;
244 const PRNOENT = 267268 ;
245 const PRPERM = 267269 ;
246 const PRNOTGROUP = 267270 ;
247 const PRNOTUSER = 267271 ;
248 const PRBADNAM = 267272 ;
249 const PRBADARG = 267273 ;
250 const PRNOMORE = 267274 ;
251 const PRDBBAD = 267275 ;
252 const PRGROUPEMPTY = 267276 ;
253 const PRINCONSISTENT = 267277 ;
254 const PRBADDR = 267278 ;
255 const PRTOOMANY = 267279 ;
258 NameToID(IN namelist *nlist,
259 OUT idlist *ilist) = 504;
261 IDToName(IN idlist *ilist,
262 OUT namelist *nlist) = 505;
264 NewEntry(IN string name<PR_MAXNAMELEN>,
269 INewEntry(IN string name<PR_MAXNAMELEN>,
273 ListEntry(IN long id,
274 OUT struct prcheckentry *entry) = 512;
276 DumpEntry(IN long pos,
277 OUT struct prdebugentry *entry) = 502;
279 ChangeEntry(IN long id,
280 IN string name<PR_MAXNAMELEN>,
282 IN long newid) = 513;
284 SetFieldsEntry(IN long id,
290 IN long spare2) = 516;
293 * Group/entries that can't be deleted: SYSADMINID, ANYUSERID,
294 * AUTHUSERID, ANONYMOUSID. Error returned is PRPERM.
296 * Rights: member of SYSADMINID, or owner to entry, or member of the
299 * Success: PRSUCCESS.
302 Delete(IN long id) = 506;
304 WhereIsIt(IN long id,
307 AddToGroup(IN long uid,
310 RemoveFromGroup(IN long id,
313 ListMax(OUT long *uid,
314 OUT long *gid) = 510;
317 IN long gflag) = 511;
319 ListElements(IN long id,
321 OUT long *over) = 514;
325 OUT long *over) = 508;
327 ListOwned(IN long id,
329 INOUT long *over) = 517;
331 IsAMemberOf(IN long uid,
333 OUT long *flag) = 515;
338 OUT long *over) = 518;
340 GetHostCPS(IN long host,
342 OUT long *over) = 519;