1 --- setmode.c.orig 2009-11-08 14:13:46.000000000 -0800
2 +++ setmode.c 2009-11-08 14:13:39.000000000 -0800
3 @@ -66,12 +66,15 @@ typedef struct bitcmd {
4 #define CMD2_OBITS 0x08
5 #define CMD2_UBITS 0x10
7 +#define compress_mode _sm_compress_mode
9 static BITCMD *addcmd(BITCMD *, int, int, int, u_int);
10 -static void compress_mode(BITCMD *);
11 +__private_extern__ void compress_mode(BITCMD *);
13 static void dumpmode(BITCMD *);
16 +#ifndef BUILDING_VARIANT
18 * Given the old mode and an array of bitcmd structures, apply the operations
19 * described in the bitcmd structures to the old mode, and return the new mode.
20 @@ -145,6 +148,7 @@ common: if (set->cmd2 & CMD2_CLR) {
24 +#endif /* BUILDING_VARIANT */
26 #define ADDCMD(a, b, c, d) \
27 if (set >= endset) { \
28 @@ -163,7 +167,11 @@ common: if (set->cmd2 & CMD2_CLR) {
30 set = addcmd(set, (a), (b), (c), (d))
32 +#ifndef VARIANT_LEGACY
33 +#define STANDARD_BITS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO|S_ISTXT)
34 +#else /* VARIANT_LEGACY */
35 #define STANDARD_BITS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
36 +#endif /* !VARIANT_LEGACY */
39 setmode(const char *p)
40 @@ -204,12 +212,21 @@ setmode(const char *p)
42 if (isdigit((unsigned char)*p)) {
43 perml = strtol(p, &ep, 8);
44 - if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT)) {
45 +#ifndef VARIANT_LEGACY
46 + if (*ep || perml < 0 || perml & ~STANDARD_BITS)
47 +#else /* VARIANT_LEGACY */
48 + if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT))
49 +#endif /* !VARIANT_LEGACY */
55 +#ifndef VARIANT_LEGACY
56 + ADDCMD('=', STANDARD_BITS, perm, mask);
57 +#else /* VARIANT_LEGACY */
58 ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
59 +#endif /* !VARIANT_LEGACY */
63 @@ -246,7 +263,9 @@ getop: if ((op = *p++) != '+' && op !=
67 +#ifdef VARIANT_LEGACY
69 +#endif /* VARIANT_LEGACY */
70 for (perm = 0, permXbits = 0;; ++p) {
73 @@ -260,7 +279,9 @@ getop: if ((op = *p++) != '+' && op !=
75 /* If only "other" bits ignore sticky. */
76 if (!who || who & ~S_IRWXO) {
77 +#ifdef VARIANT_LEGACY
79 +#endif /* VARIANT_LEGACY */
83 @@ -390,13 +411,14 @@ dumpmode(BITCMD *set)
87 +#ifndef BUILDING_VARIANT
89 * Given an array of bitcmd structures, compress by compacting consecutive
90 * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
91 * 'g' and 'o' commands continue to be separate. They could probably be
92 * compacted, but it's not worth the effort.
95 +__private_extern__ void
96 compress_mode(BITCMD *set)
99 @@ -444,3 +466,4 @@ compress_mode(BITCMD *set)
103 +#endif /* BUILDING_VARIANT */