Revision 1b6e38da src/acl/AclRule.cc

View differences:

src/acl/AclRule.cc
24 24
const long long AclRule::INDIVIDUAL_ID  = 0x0000000100000000LL;
25 25
const long long AclRule::GROUP_ID       = 0x0000000200000000LL;
26 26
const long long AclRule::ALL_ID         = 0x0000000400000000LL;
27
const long long AclRule::CLUSTER_ID     = 0x0000000800000000LL;
27 28

  
28 29
const long long AclRule::NONE_ID        = 0x1000000000000000LL;
29 30

  
......
122 123

  
123 124
    // Check resource
124 125

  
125
    if ( (resource & INDIVIDUAL_ID) != 0 && (resource & GROUP_ID) != 0 )
126
    if ( ( (resource & INDIVIDUAL_ID) != 0 && (resource & 0xF00000000LL) != INDIVIDUAL_ID ) ||
127
         ( (resource & GROUP_ID)      != 0 && (resource & 0xF00000000LL) != GROUP_ID ) ||
128
         ( (resource & CLUSTER_ID)    != 0 && (resource & 0xF00000000LL) != CLUSTER_ID ) ||
129
         ( (resource & ALL_ID)        != 0 && (resource & 0xF00000000LL) != ALL_ID )
130
        )
126 131
    {
127 132
        if ( error )
128 133
        {
......
130 135
        }
131 136

  
132 137
        error = true;
133
        oss << "[resource] INDIVIDUAL (#) and GROUP (@) bits are exclusive";
138
        oss << "[resource] INDIVIDUAL (#), GROUP (@), CLUSTER (%) "
139
            << "and ALL (*) bits are exclusive";
134 140
    }
135 141

  
136
    if ( (resource & INDIVIDUAL_ID) != 0 && (resource & ALL_ID) != 0 )
142
    if ( (resource & 0xF00000000LL) == 0 )
137 143
    {
138 144
        if ( error )
139 145
        {
......
141 147
        }
142 148

  
143 149
        error = true;
144
        oss << "[resource] INDIVIDUAL (#) and ALL (*) bits are exclusive";
145
    }
146

  
147
    if ( (resource & GROUP_ID) != 0 && (resource & ALL_ID) != 0 )
148
    {
149
        if ( error )
150
        {
151
            oss << "; ";
152
        }
153

  
154
        error = true;
155
        oss << "[resource] GROUP (@) and ALL (*) bits are exclusive";
156
    }
157

  
158
    if ( (resource & 0x700000000LL) == 0 )
159
    {
160
        if ( error )
161
        {
162
            oss << "; ";
163
        }
164

  
165
        error = true;
166
        oss << "[resource] is missing one of the INDIVIDUAL, GROUP or ALL bits";
150
        oss << "[resource] is missing one of the INDIVIDUAL, GROUP, CLUSTER or ALL bits";
167 151
    }
168 152

  
169 153
    if ( resource_id() < 0 )
......
294 278
    {
295 279
        oss << "#" << resource_id();
296 280
    }
281
    else if ( (resource & CLUSTER_ID) != 0 )
282
    {
283
        oss << "%" << resource_id();
284
    }
297 285
    else if ( (resource & ALL_ID) != 0 )
298 286
    {
299 287
        oss << "*";

Also available in: Unified diff