1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 #include <stdio.h> 23 #include <stdlib.h> 24 #include <unistd.h> 25 #include <libintl.h> 26 #include <locale.h> 27 #include <errno.h> 28 #include <string.h> 29 #include <stddef.h> 30 #include <sys/types.h> 31 32 #include "projent.h" 33 #include "util.h" 34 35 /* 36 * All the below test cases were copied from perl test code located at 37 * "usr/src/cmd/perl/contrib/Sun/Solaris/Project/t/Project.t". Part of the 38 * Parse/Validate test cases were commented out because the implementation 39 * of users list parsing is more permissive in this C code compared to the 40 * original perl code. It is more consistent this way that perl way. 41 * 42 * For example, the original perl code assume the below test succeeds 43 * { 0, 0, FLAG_000, "comma8:158:::root,,:"}, 44 * On the same time, it assumes, the below this test case to fail. 45 * { 1, 0, FLAG_000, "comma6:195:::,,root,bin:"}, 46 * This C implementations passes both of these cases and neglect the extra 47 * commas in both cases. 48 */ 49 50 /* 51 * file1, parse error (extra ":") on group.staff project. 52 */ 53 #define FILE1 "test1:123:project one:root,bin:adm:attr1=a;attr2=b\n" \ 54 "user.test2:456:project two:adm,uucp:staff:attr1=p;attr2=q\n" \ 55 "group.test3:678:project three::root,nobody:root,lp:attr1=y;attr2=z\n" \ 56 "test4:678:project four:root:root:\n" \ 57 "test5:679:project five::sys:\n" \ 58 "test6:690::::\n" 59 60 /* 61 * file2, duplicate project names. 62 */ 63 #define FILE2 "test1:123:project one:root,bin:adm:attr1=a;attr2=b\n" \ 64 "user.test2:456:project two:adm,uucp:staff:attr1=p;attr2=q\n" \ 65 "group.test3:677:project three:root,nobody:root,lp:attr1=y;attr2=z\n" \ 66 "test1:678:project four:root:root:\n" \ 67 "test5:679:project five::sys:\n" \ 68 "test6:690::::\n" 69 70 /* 71 * file3, duplicate project ids. 72 */ 73 #define FILE3 "test1:123:project one:root,bin:adm:attr1=a;attr2=b\n" \ 74 "user.test2:456:project two:adm,uucp:staff:attr1=p;attr2=q\n" \ 75 "group.test3:677:project three:root,nobody:root,lp:attr1=y;attr2=z\n" \ 76 "test4:678:project four:root:root:\n" \ 77 "test5:678:project five::sys:\n" \ 78 "test6:690::::\n" 79 80 /* 81 * file4, system project ids. 82 */ 83 #define FILE4 "system:0::::\n" \ 84 "user.root:1::::\n" \ 85 "noproject:2::::\n" \ 86 "default:3::::\n" \ 87 "group.staff:10::::\n" \ 88 "test1:123:project one:root,bin:adm:attr1=a;attr2=b\n" \ 89 "user.test2:456:project two:adm,uucp:staff:attr1=p;attr2=q\n" \ 90 "group.test3:677:project three:root,nobody:root,lp:attr1=y;attr2=z\n" \ 91 "test4:678:project four:root:root:\n" \ 92 "test5:679:project five::sys:\n" \ 93 "test6:690::::\n" 94 95 /* 96 * file5, all unique user projects. 97 */ 98 #define FILE5 "test1:123:project one:root,bin:adm:attr1=a;attr2=b\n" \ 99 "user.test2:456:project two:adm,uucp:staff:attr1=p;attr2=q\n" \ 100 "group.test3:677:project three:root,nobody:root,lp:attr1=y;attr2=z\n" \ 101 "test4:678:project four:root:root:\n" \ 102 "test5:679:project five::sys:\n" \ 103 "test6:690::::\n" 104 105 106 #define FLAG1 (0) 107 #define FLAG2 (F_PAR_VLD) 108 #define FLAG3 (F_PAR_VLD | F_PAR_RES) 109 #define FLAG4 (F_PAR_VLD | F_PAR_DUP) 110 111 112 typedef struct { 113 char *file; 114 int flags; 115 int res; 116 } read_test; 117 118 #define READ_TESTS_SIZE 20 119 read_test rtests[READ_TESTS_SIZE] = { 120 {FILE1, FLAG1, 1}, 121 {FILE1, FLAG2, 1}, 122 {FILE1, FLAG3, 1}, 123 {FILE1, FLAG4, 1}, 124 {FILE2, FLAG1, 0}, 125 {FILE2, FLAG2, 1}, 126 {FILE2, FLAG3, 1}, 127 {FILE2, FLAG4, 1}, 128 {FILE3, FLAG1, 0}, 129 {FILE3, FLAG2, 1}, 130 {FILE3, FLAG3, 1}, 131 {FILE3, FLAG4, 0}, 132 {FILE4, FLAG1, 0}, 133 {FILE4, FLAG2, 1}, 134 {FILE4, FLAG3, 0}, 135 {FILE4, FLAG4, 1}, 136 {FILE5, FLAG1, 0}, 137 {FILE5, FLAG2, 0}, 138 {FILE5, FLAG3, 0}, 139 {FILE5, FLAG4, 0}, 140 }; 141 142 143 typedef struct { 144 int pres; 145 int vres; 146 int flags; 147 char *pline; 148 } parse_validate_test; 149 150 151 152 #define FLAG_000 0 153 #define FLAG_RES F_PAR_RES 154 #define FLAG_SPC F_PAR_SPC 155 #define FLAG_UNT F_PAR_UNT 156 157 #define PARSE_VALIDATE_TESTS_SIZE 302 158 parse_validate_test pvtests[PARSE_VALIDATE_TESTS_SIZE] = { 159 /* positive */ 160 { 0, 0, FLAG_RES, "system:0::::"}, 161 { 0, 0, FLAG_RES, "user.root:1::::"}, 162 { 0, 0, FLAG_RES, "noproject:2::::"}, 163 { 0, 0, FLAG_RES, "default:3::::"}, 164 { 0, 0, FLAG_RES, "group.staff:10::::"}, 165 { 0, 0, FLAG_000, "long:100::::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, 166 { 0, 0, FLAG_000, "Validname:101::::"}, 167 { 0, 0, FLAG_000, "Validname2:102::::"}, 168 { 0, 0, FLAG_000, "valid3name:103::::"}, 169 { 0, 0, FLAG_000, "VALIDNAME:104::::"}, 170 { 0, 0, FLAG_000, "VALIDNAME5:105::::"}, 171 { 0, 0, FLAG_000, "vAlid5name:106::::"}, 172 { 0, 0, FLAG_000, "valid.name:107::::"}, 173 { 0, 0, FLAG_000, "valid8.NAME:108::::"}, 174 { 0, 0, FLAG_000, "Valid_name9:109::::"}, 175 { 0, 0, FLAG_000, "V_alid.name10:110::::"}, 176 { 0, 0, FLAG_000, "valid12345678901234567890123456789012345678901234567890123456789:111::::"}, 177 { 0, 0, FLAG_000, "projid:2147483647::::"}, 178 { 0, 0, FLAG_000, "comment:111: this is ! & my crazy !@#$%^&*()_+|~`\\=-]{ 0, 0, FLAG_000,}{';\\\"/.,?>< comment:::"}, 179 { 0, 0, FLAG_000, "user1:112::*::"}, 180 { 0, 0, FLAG_000, "user2:113::!*::"}, 181 { 0, 0, FLAG_000, "user3:114::root::"}, 182 { 0, 0, FLAG_000, "user4:115::!root::"}, 183 { 0, 0, FLAG_000, "user5:116::*,!sys::"}, 184 { 0, 0, FLAG_000, "user6:117::!*,daemon::"}, 185 { 0, 0, FLAG_000, "user7:118::root,sys,daemon,bin::"}, 186 { 0, 0, FLAG_000, "user8:119::root,!sys,daemon,!bin::"}, 187 { 0, 0, FLAG_SPC, "user9:116::*, !sys::"}, 188 { 0, 0, FLAG_SPC, "user10:117::!* ,daemon::"}, 189 { 0, 0, FLAG_SPC, "user11:118::root ,sys ,daemon, bin::"}, 190 { 0, 0, FLAG_SPC, "user12:119::root, !sys, daemon ,!bin::"}, 191 { 0, 0, FLAG_000, "group1:120:::*:"}, 192 { 0, 0, FLAG_000, "group2:121:::!*:"}, 193 { 0, 0, FLAG_000, "group3:122:::root:"}, 194 { 0, 0, FLAG_000, "group4:123:::!root:"}, 195 { 0, 0, FLAG_000, "group5:124:::*,!sys:"}, 196 { 0, 0, FLAG_000, "group6:125:::!*,daemon:"}, 197 { 0, 0, FLAG_000, "group7:126:::root,sys,daemon,bin:"}, 198 { 0, 0, FLAG_000, "group8:127:::root,!sys,daemon,!bin:"}, 199 { 0, 0, FLAG_SPC, "group9:124:::*, !sys:"}, 200 { 0, 0, FLAG_SPC, "group10:125:::!* ,daemon:"}, 201 { 0, 0, FLAG_SPC, "group11:126:::root, sys ,daemon, bin:"}, 202 { 0, 0, FLAG_SPC, "group12:127:::root ,!sys, daemon ,!bin:"}, 203 { 0, 0, FLAG_000, "group9:128:::sys:"}, 204 { 0, 0, FLAG_000, "attrib1:129::::one"}, 205 { 0, 0, FLAG_000, "attrib2:130::::One"}, 206 { 0, 0, FLAG_000, "attrib3:131::::ONE"}, 207 { 0, 0, FLAG_000, "attrib4:132::::attrib10"}, 208 { 0, 0, FLAG_000, "attrib5:133::::attrib.attrib="}, 209 { 0, 0, FLAG_000, "attrib6:134::::attib_"}, 210 { 0, 0, FLAG_000, "attrib7:135::::a10-._attib"}, 211 { 0, 0, FLAG_000, "attrib8:136::::SUNW,attrib"}, 212 { 0, 0, FLAG_000, "attrib9:137::::A,A10="}, 213 { 0, 0, FLAG_000, "attrib10:138::::FIVEE,name"}, 214 { 0, 0, FLAG_000, "attrib11:139::::one;two"}, 215 { 0, 0, FLAG_000, "attrib12:140::::one=1;two=four"}, 216 { 0, 0, FLAG_000, "attrib13:141::::one;two=;three=four"}, 217 { 0, 0, FLAG_000, "value1:142::::one=foo,bar"}, 218 { 0, 0, FLAG_000, "value2:143::::one=,bar,"}, 219 { 0, 0, FLAG_000, "value3:144::::one=(foo,bar)"}, 220 { 0, 0, FLAG_000, "value4:145::::one=(foo,bar,baz),boo"}, 221 { 0, 0, FLAG_000, "value5:146::::one;two=bar,(baz),foo,((baz)),(,)"}, 222 { 0, 0, FLAG_000, "value6:147::::one=100/200"}, 223 { 0, 0, FLAG_000, "value7:148::::two=.-_/="}, 224 { 0, 0, FLAG_000, "value8:149::::name=one=two"}, 225 { 0, 0, FLAG_UNT, "value9:150::::task.max-lwps=(priv,1000M,deny,signal=SIGHUP),(priv,1000k,deny,signal=SIGKILL)"}, 226 { 0, 0, FLAG_000, "comma1:151::,::"}, 227 { 0, 0, FLAG_000, "comma2:152::,,::"}, 228 { 0, 0, FLAG_000, "comma3:153::root,::"}, 229 { 0, 0, FLAG_000, "comma4:154::bin,root,,::"}, 230 { 0, 0, FLAG_000, "comma5:155:::,:"}, 231 { 0, 0, FLAG_000, "comma6:156:::,,:"}, 232 { 0, 0, FLAG_000, "comma7:157:::bin,root,:"}, 233 { 0, 0, FLAG_000, "comma8:158:::root,,:"}, 234 { 0, 0, FLAG_000, "semi1:159::::;"}, 235 { 0, 0, FLAG_000, "semi2:160::::;;"}, 236 { 0, 0, FLAG_000, "semi3:161::::foo=(one,two);"}, 237 { 0, 0, FLAG_000, "semi4:162::::foo;;"}, 238 { 0, 0, FLAG_UNT, "rctl1:163::::task.max-lwps=(priv,1000,deny,signal=HUP),(priv,1000k,deny,signal=15)"}, 239 { 0, 0, FLAG_000, "rctl1:163::::task.max-lwps=(priv,1000,deny,signal=HUP),(priv,10001,deny,signal=15)"}, 240 { 0, 0, FLAG_000, "rctl2:164::::process.max-port-events=(basic,1000,deny)"}, 241 { 0, 0, FLAG_UNT, "rctl3:165::::project.max-crypto-memory=(priv,2.2gb,deny)"}, 242 { 0, 0, FLAG_000, "rctl3:165::::project.max-crypto-memory=(priv,10,deny)"}, 243 { 0, 0, FLAG_UNT, "rctl4:166::::project.max-crypto-memory=(privileged,100m,deny)"}, 244 { 0, 0, FLAG_000, "rctl4:166::::project.max-crypto-memory=(privileged,100,deny)"}, 245 { 0, 0, FLAG_UNT, "rctl5:167::::project.max-crypto-memory=(priv,1000m,deny)"}, 246 { 0, 0, FLAG_000, "rctl5:167::::project.max-crypto-memory=(priv,1000,deny)"}, 247 { 0, 0, FLAG_UNT, "rctl6:168::::project.max-crypto-memory=(priv,1000k,deny)"}, 248 { 0, 0, FLAG_UNT, "rctl6:168::::project.max-crypto-memory=(priv,1000m,deny)"}, 249 { 0, 0, FLAG_000, "rctl7:169::::process.max-msg-messages=(priv,10,deny)"}, 250 { 0, 0, FLAG_UNT, "rctl8:170::::process.max-msg-qbytes=(priv,10000kb,deny)"}, 251 { 0, 0, FLAG_000, "rctl8:170::::process.max-msg-qbytes=(priv,10000,deny)"}, 252 { 0, 0, FLAG_000, "rctl9:171::::process.max-sem-ops=(priv,10000000,deny)"}, 253 { 0, 0, FLAG_000, "rctl10:172::::process.max-sem-nsems=(basic,1,deny)"}, 254 { 0, 0, FLAG_UNT, "rctl11:173::::process.max-address-space=(priv,2GB,deny)"}, 255 { 0, 0, FLAG_UNT, "rctl12:174::::process.max-file-descriptor=(basic,1K,deny),(basic,2K,deny)"}, 256 { 0, 0, FLAG_UNT, "rctl13:175::::process.max-core-size=(priv,10Mb,deny),(priv,2GB,deny)"}, 257 { 0, 0, FLAG_UNT, "rctl14:176::::process.max-stack-size=(priv,1.8Gb,deny),(priv,100MB,deny)"}, 258 { 0, 0, FLAG_000, "rctl15:177::::process.max-data-size=(priv,1010100101,deny)"}, 259 { 0, 0, FLAG_UNT, "rctl16:178::::process.max-file-size=(priv,100mb,deny,signal=SIGXFSZ),(priv,1000mb,deny,signal=31)"}, 260 { 0, 0, FLAG_UNT, "rctl17:179::::process.max-cpu-time=(priv,1t,signal=XCPU),(priv,100ms,sig=30)"}, 261 { 0, 0, FLAG_UNT, "rctl18:180::::task.max-cpu-time=(priv,1M,sig=SIGKILL)"}, 262 { 0, 0, FLAG_UNT, "rctl19:181::::task.max-lwps=(basic,10,signal=1),(priv,100,deny,signal=KILL)"}, 263 { 0, 0, FLAG_000, "rctl20:182::::project.max-device-locked-memory=(priv,1000,deny,sig=TERM)"}, 264 { 0, 0, FLAG_000, "rctl21:183::::project.max-port-ids=(priv,100,deny)"}, 265 { 0, 0, FLAG_UNT, "rctl22:184::::project.max-shm-memory=(priv,1000mb,deny)"}, 266 { 0, 0, FLAG_UNT, "rctl23:185::::project.max-shm-ids=(priv,1k,deny,signal=SIGSTOP)"}, 267 { 0, 0, FLAG_UNT, "rctl24:186::::project.max-msg-ids=(priv,1m,deny,signal=XRES)"}, 268 { 0, 0, FLAG_000, "rctl25:187::::project.max-sem-ids=(priv,10,deny,signal=ABRT)"}, 269 { 0, 0, FLAG_UNT, "rctl26:188::::project.cpu-shares=(priv,63k,none)"}, 270 { 0, 0, FLAG_UNT, "rctl27:189::::zone.cpu-shares=(priv,20k,none)"}, 271 { 0, 0, FLAG_000, "rctl28:190::::zone.cpu-shares=(priv,100,none)"}, 272 { 0, 0, FLAG_UNT, "rctl29:191::::project.max-shm-memory=(priv,200G,deny)"}, 273 { 0, 0, FLAG_UNT, "rctl30:192::::project.max-shm-memory=(priv,200Gb,deny)"}, 274 { 0, 0, FLAG_UNT, "rctl31:193::::project.max-shm-memory=(priv,2000B,deny)"}, 275 { 0, 0, FLAG_000, "rctl32:194::::project.max-shm-memory=(priv,2000,deny)"}, 276 { 0, 0, FLAG_000, "rctl33:195::::task.max-cpu-time=(priv,2000,none)"}, 277 { 0, 0, FLAG_UNT, "rctl34:196::::task.max-cpu-time=(priv,2000s,none)"}, 278 { 0, 0, FLAG_UNT, "rctl35:197::::task.max-cpu-time=(priv,20.1ps,none)"}, 279 { 0, 0, FLAG_UNT, "rctl36:198::::task.max-cpu-time=(priv,20T,none)"}, 280 /* negative */ 281 { 0, 1, FLAG_000, "system:0::::"}, 282 { 0, 1, FLAG_000, "user.root:1::::"}, 283 { 0, 1, FLAG_000, "noproject:2::::"}, 284 { 0, 1, FLAG_000, "default:3::::"}, 285 { 0, 1, FLAG_000, "group.staff:10::::"}, 286 { 0, 1, FLAG_000, "long:100::::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, 287 { 1, 0, FLAG_000, "extrafields:101:::::"}, 288 { 1, 0, FLAG_000, "missingfields:102:::"}, 289 { 1, 0, FLAG_000, "_invalidname:103::::"}, 290 { 1, 0, FLAG_000, "10invlidname:104::::"}, 291 { 1, 0, FLAG_000, "invalid%name:105::::"}, 292 { 1, 0, FLAG_000, "invalid/name:106::::"}, 293 { 1, 0, FLAG_000, ".invalidname:107::::"}, 294 { 1, 0, FLAG_000, "=invalidName:108::::"}, 295 { 1, 0, FLAG_000, "invalid=name:109::::"}, 296 { 1, 0, FLAG_000, "invalid/name:110::::"}, 297 { 1, 0, FLAG_000, "/invalidname:111::::"}, 298 { 1, 0, FLAG_000, "/invalidname:112::::"}, 299 { 1, 0, FLAG_000, "invalidname*:113::::"}, 300 { 1, 0, FLAG_000, "invalid?name:114::::"}, 301 { 1, 0, FLAG_000, ":115:invalid name comment:::"}, 302 { 1, 0, FLAG_000, "invalid!name:116::::"}, 303 { 1, 0, FLAG_000, "invalidname!:117::::"}, 304 { 1, 0, FLAG_000, "invalid12345678901234567890123456789012345678901234567890123456789:118::::"}, 305 { 1, 0, FLAG_000, "projid:-1::::"}, 306 { 1, 0, FLAG_000, "projid:abc::::"}, 307 { 1, 0, FLAG_000, "projid:2147483648::::"}, 308 { 1, 0, FLAG_000, "projid:::::"}, 309 { 1, 0, FLAG_000, "user1:118::*!::"}, 310 { 1, 0, FLAG_000, "user2:119::10user::"}, 311 { 0, 1, FLAG_000, "user3:120::NOLOWER::"}, 312 { 0, 1, FLAG_000, "user4:121::toooolong::"}, 313 { 1, 0, FLAG_000, "user5:122::root!::"}, 314 { 1, 0, FLAG_000, "user6:123::root;sys::"}, 315 { 0, 1, FLAG_000, "user7:124::sys,NOLOWER::"}, 316 { 1, 0, FLAG_000, "user8:125::sys/bin,root::"}, 317 { 1, 0, FLAG_000, "user9:116::*, !sys::"}, 318 { 1, 0, FLAG_000, "user10:117::!* ,daemon::"}, 319 { 1, 0, FLAG_000, "user11:118::root ,sys ,daemon, bin::"}, 320 { 1, 0, FLAG_000, "user12:119::root, !sys, daemon ,!bin::"}, 321 { 1, 0, FLAG_000, "group1:126:::*!:"}, 322 { 0, 1, FLAG_000, "group2:127:::oneUpper:"}, 323 { 0, 1, FLAG_000, "group3:128:::NOLOWER:"}, 324 { 0, 1, FLAG_000, "group4:129:::toooolong:"}, 325 { 1, 0, FLAG_000, "group5:130:::root!:"}, 326 { 1, 0, FLAG_000, "group6:131:::root;sys:"}, 327 { 0, 1, FLAG_000, "group7:132:::sys,NOLOWER:"}, 328 { 1, 0, FLAG_000, "group8:133:::sys-bin,root:"}, 329 { 1, 0, FLAG_000, "group9:124:::*, !sys:"}, 330 { 1, 0, FLAG_000, "group10:125:::!* ,daemon:"}, 331 { 1, 0, FLAG_000, "group11:126:::root, sys ,daemon, bin:"}, 332 { 1, 0, FLAG_000, "group12:127:::root ,!sys, daemon ,!bin:"}, 333 { 1, 0, FLAG_000, "attrib1:134::::10"}, 334 { 1, 0, FLAG_000, "attrib2:135::::_foo="}, 335 { 1, 0, FLAG_000, "attrib3:136::::,foo"}, 336 { 1, 0, FLAG_000, "attrib4:137::::sun,foo"}, 337 { 1, 0, FLAG_000, "attrib6:139::::!attrib"}, 338 { 1, 0, FLAG_000, "attrib7:140::::_attrib"}, 339 { 1, 0, FLAG_000, "attrib8:141::::attib,attrib"}, 340 { 1, 0, FLAG_000, "attrib9:142::::attrib/attrib"}, 341 { 1, 0, FLAG_000, "attrib10:143::::one;two,three"}, 342 { 1, 0, FLAG_000, "attrib11:144::::one=two;three/"}, 343 { 1, 0, FLAG_000, "value1:145::::one=foo%"}, 344 { 1, 0, FLAG_000, "value2:146::::one= two"}, 345 { 1, 0, FLAG_000, "value3:147::::var=foo?"}, 346 { 1, 0, FLAG_000, "value4:148::::name=value;name=value2)"}, 347 { 1, 0, FLAG_000, "value5:149::::(foo)"}, 348 { 1, 0, FLAG_000, "value6:150::::name=(foo,bar"}, 349 { 1, 0, FLAG_000, "value7:151::::name=(value)(value)"}, 350 { 1, 0, FLAG_000, "value8:152::::name=)"}, 351 { 1, 0, FLAG_000, "value9:153::::name=value,(value value)"}, 352 { 1, 0, FLAG_000, "value10:154::::name=(value(value))"}, 353 { 1, 0, FLAG_000, "value11:155::::name=(value)value"}, 354 { 1, 0, FLAG_000, "value11:156::::name=va?lue"}, 355 { 1, 0, FLAG_000, "value12:157::::name=(value,value))"}, 356 { 1, 0, FLAG_000, "value13:158::::name=(value),value)"}, 357 { 1, 0, FLAG_000, "space1 :159::::"}, 358 { 1, 0, FLAG_000, " space2:160::::"}, 359 { 1, 0, FLAG_000, "space3: 161::::"}, 360 { 1, 0, FLAG_000, "space4:162 ::::"}, 361 { 1, 0, FLAG_000, "space 5:163::::"}, 362 { 1, 0, FLAG_000, "space6:1 64::::"}, 363 { 1, 0, FLAG_000, "space7:165:: root::"}, 364 { 1, 0, FLAG_000, "space8:166::root ::"}, 365 { 1, 0, FLAG_000, "space9:167::daemon, root::"}, 366 { 1, 0, FLAG_000, "space10:168::bin root::"}, 367 { 1, 0, FLAG_000, "space11:169::daemon ,root::"}, 368 { 1, 0, FLAG_000, "space12 :170::::"}, 369 { 1, 0, FLAG_000, " space13:171::::"}, 370 { 1, 0, FLAG_000, "space14: 172::::"}, 371 { 1, 0, FLAG_000, "space15:173 ::::"}, 372 { 1, 0, FLAG_000, "space 16:174::::"}, 373 { 1, 0, FLAG_000, "space17:1 75::::"}, 374 { 1, 0, FLAG_000, "space18:176::: root:"}, 375 { 1, 0, FLAG_000, "space19:177:::root :"}, 376 { 1, 0, FLAG_000, "space20:178:::daemon, root:"}, 377 { 1, 0, FLAG_000, "space21:179:::bin root:"}, 378 { 1, 0, FLAG_000, "space22:180:::daemon ,root:"}, 379 { 1, 0, FLAG_000, "space23:181:::: foo"}, 380 { 1, 0, FLAG_000, "space34:182::::foo =one"}, 381 { 1, 0, FLAG_000, "space35:183::::foo= (one)"}, 382 { 1, 0, FLAG_000, "space36:184::::foo=(one, two)"}, 383 { 1, 0, FLAG_000, "space37:185::::foo=(one ,two)"}, 384 { 1, 0, FLAG_000, "space38:186::::foo=( one)"}, 385 { 1, 0, FLAG_000, "space39:187::::foo=(one )"}, 386 { 1, 0, FLAG_000, "space40:188::::foo=(one) ,two"}, 387 { 1, 0, FLAG_000, "space41:189::::foo=one, (two)"}, 388 /* 389 * { 1, 0, FLAG_000, "comma1:190::,root,bin::"}, 390 * { 1, 0, FLAG_000, "comma2:191::root,,bin::"}, 391 * { 1, 0, FLAG_000, "comma3:192::,,root,bin::"}, 392 * { 1, 0, FLAG_000, "comma4:193:::,root,bin:"}, 393 * { 1, 0, FLAG_000, "comma5:194:::root,,bin:"}, 394 * { 1, 0, FLAG_000, "comma6:195:::,,root,bin:"}, 395 * { 1, 0, FLAG_000, "semi1:196::::;foo"}, 396 * { 1, 0, FLAG_000, "semi2:197::::foo;;bar=1"}, 397 * { 1, 0, FLAG_000, "semi3:198::::;;bar=(10)"}, 398 */ 399 { 0, 1, FLAG_000, "rctl1:199::::task.max-lwps=,"}, 400 { 0, 1, FLAG_000, "rctl2:200::::task.max-lwps="}, 401 { 0, 1, FLAG_000, "rctl3:201::::task.max-lwps=priv"}, 402 { 0, 1, FLAG_000, "rctl4:202::::task.max-lwps=priv,1000"}, 403 { 0, 1, FLAG_000, "rctl5:203::::task.max-lwps=priv,1000,deny"}, 404 { 0, 1, FLAG_000, "rctl6:204::::task.max-lwps=(priv)"}, 405 { 0, 1, FLAG_000, "rctl7:205::::task.max-lwps=(priv,1000)"}, 406 { 0, 1, FLAG_000, "rctl8:206::::task.max-lwps=(foo,100,deny)"}, 407 { 0, 1, FLAG_000, "rctl9:207::::task.max-lwps=(priv,foo,none)"}, 408 { 1, 0, FLAG_UNT, "rctl9:207::::task.max-lwps=(priv,foo,none)"}, 409 { 1, 0, FLAG_UNT, "rctl10:208::::task.max-lwps=(priv,100foo,none)"}, 410 { 0, 1, FLAG_000, "rctl11:209::::task.max-lwps=(priv,1000,foo)"}, 411 { 0, 1, FLAG_UNT, "rctl12:210::::task.max-lwps=(priv,1000k,deny,signal)"}, 412 { 0, 1, FLAG_000, "rctl13:211::::task.max-lwps=(priv,1000,deny,signal=)"}, 413 { 0, 1, FLAG_000, "rctl14:212::::task.max-lwps=(priv,1000,deny,signal=foo)"}, 414 { 0, 1, FLAG_000, "rctl15:213::::task.max-lwps=(priv,1000,deny,signal=1fo)"}, 415 { 0, 1, FLAG_000, "rctl16:214::::task.max-lwps=(priv,1000,deny,signal=100)"}, 416 { 0, 1, FLAG_000, "rctl17:215::::task.max-lwps=(priv,1000,deny,signal=SIG)"}, 417 { 0, 1, FLAG_000, "rctl18:216::::task.max-lwps=(priv,1000,deny,signal=SIG1)"}, 418 { 0, 1, FLAG_000, "rctl19:217::::task.max-lwps=(priv,1000,deny,signal=SIGhup)"}, 419 { 0, 1, FLAG_000, "rctl20:218::::task.max-lwps=(priv,1000,deny,signal=SIGHU)"}, 420 { 0, 1, FLAG_000, "rctl21:219::::task.max-lwps=(priv,1000,deny,signal=SIGHUPP)"}, 421 { 0, 1, FLAG_000, "rctl22:220::::task.max-lwps=(priv,1000,deny,signal=SIGURG)"}, 422 { 0, 1, FLAG_000, "rctl23:221::::task.max-lwps=(priv,1000,deny,signal=SIGXCPU)"}, 423 { 0, 1, FLAG_000, "rctl24:222::::task.max-lwps=(priv,1000,deny,signal=SIGKILL,10)"}, 424 { 0, 1, FLAG_000, "rctl25:223::::task.max-lwps=(priv,1000,deny,signal=SIGKILL,foo)"}, 425 { 0, 1, FLAG_000, "rctl26:224::::process.max-port-events=(priv,1000,none)"}, 426 { 0, 1, FLAG_UNT, "rctl27:225::::process.max-address-space=(basic,1024mb,deny,signal=TERM)"}, 427 { 0, 1, FLAG_000, "rctl28:226::::process.max-cpu-time=(basic,3600,deny)"}, 428 { 0, 1, FLAG_000, "rctl29:227::::task.max-lwps=()"}, 429 { 0, 1, FLAG_000, "rctl30:228::::task.max-lwps=((priv),deny)"}, 430 { 0, 1, FLAG_000, "rctl31:229::::task.max-lwps=((priv,1000,deny))"}, 431 { 0, 1, FLAG_000, "rctl32:230::::task.max-lwps=(priv,((1000,2000,1000)),deny)"}, 432 { 0, 1, FLAG_000, "rctl33:231::::task.max-lwps=(,,,)"}, 433 { 0, 1, FLAG_000, "rctl34:232::::task.max-lwps=(priv,1000,(deny))"}, 434 { 0, 1, FLAG_000, "rctl35:233::::task.max-lwps=(priv,1000,deny),foo"}, 435 { 0, 1, FLAG_000, "rctl36:234::::task.max-lwps=(priv,1000,deny),(priv,1000)"}, 436 { 1, 0, FLAG_UNT, "rctl37:235::::project.max-msg-ids=(priv,15EB,deny)"}, 437 { 1, 0, FLAG_UNT, "rctl38:236::::process.max-address-space=(priv,16.1EB,deny)"}, 438 { 1, 0, FLAG_UNT, "rctl39:237::::process.max-address-space=(priv,18000000000gb,deny)"}, 439 { 1, 0, FLAG_UNT, "rctl40:238::::zone.cpu-shares=(priv,10kb,none)"}, 440 { 1, 0, FLAG_UNT, "rctl41:239::::zone.cpu-shares=(priv,10Ks,none)"}, 441 { 1, 0, FLAG_UNT, "rctl42:240::::zone.cpu-shares=(priv,10s,none)"}, 442 { 1, 0, FLAG_UNT, "rctl43:241::::zone.cpu-shares=(priv,100000b,none)"}, 443 { 1, 0, FLAG_UNT, "rctl44:242::::project.max-shm-memory=(priv,200Ts,deny)"}, 444 { 1, 0, FLAG_UNT, "rctl45:243::::project.max-shm-memory=(priv,200s,deny)"}, 445 { 1, 0, FLAG_UNT, "rctl46:244::::task.max-cpu-time=(priv,20B,none)"}, 446 { 1, 0, FLAG_UNT, "rctl47:245::::task.max-cpu-time=(priv,20Kb,none)"}, 447 { 0, 1, FLAG_UNT, "rctl48:246::::project.cpu-shares=(priv,100k,none)"}, 448 { 0, 1, FLAG_000, "rctl147:150::::task.max-lwps=(priv,1000M,deny,signal=SIGHUP),(priv,1000k,deny,signal=SIGKILL)"}, 449 { 0, 1, FLAG_000, "rctl148:163::::task.max-lwps=(priv,1000,deny,signal=HUP),(priv,1000k,deny,signal=15)"}, 450 { 0, 1, FLAG_000, "rctl3:165::::project.max-crypto-memory=(priv,10eb,deny)"}, 451 { 0, 1, FLAG_000, "rctl4:166::::project.max-crypto-memory=(privileged,100p,deny)"}, 452 { 0, 1, FLAG_000, "rctl5:167::::project.max-crypto-memory=(priv,1000t,deny)"}, 453 { 0, 1, FLAG_000, "rctl6:168::::project.max-crypto-memory=(priv,1000g,deny)"}, 454 { 0, 1, FLAG_000, "rctl7:169::::process.max-msg-messages=(priv,10m,deny)"}, 455 { 0, 1, FLAG_000, "rctl8:170::::process.max-msg-qbytes=(priv,10000kb,deny)"}, 456 { 0, 1, FLAG_000, "rctl11:173::::process.max-address-space=(priv,10EB,deny)"}, 457 { 0, 1, FLAG_000, "rctl12:174::::process.max-file-descriptor=(basic,1K,deny),(basic,2K,deny)"}, 458 { 0, 1, FLAG_000, "rctl13:175::::process.max-core-size=(priv,1Eb,deny),(priv,10PB,deny)"}, 459 { 0, 1, FLAG_000, "rctl14:176::::process.max-stack-size=(priv,10Tb,deny),(priv,10TB,deny)"}, 460 { 0, 1, FLAG_000, "rctl16:178::::process.max-file-size=(priv,100mb,deny,signal=SIGXFSZ),(priv,1000mb,deny,signal=31)"}, 461 { 0, 1, FLAG_000, "rctl17:179::::process.max-cpu-time=(priv,1t,signal=XCPU),(priv,100ms,sig=30)"}, 462 { 0, 1, FLAG_000, "rctl18:180::::task.max-cpu-time=(priv,1M,sig=SIGKILL)"}, 463 { 0, 1, FLAG_000, "rctl22:184::::project.max-shm-memory=(priv,1000mb,deny)"}, 464 { 0, 1, FLAG_000, "rctl23:185::::project.max-shm-ids=(priv,1k,deny,signal=SIGSTOP)"}, 465 { 0, 1, FLAG_000, "rctl24:186::::project.max-msg-ids=(priv,1m,deny,signal=XRES)"}, 466 { 0, 1, FLAG_000, "rctl26:188::::project.cpu-shares=(priv,63k,none)"}, 467 { 0, 1, FLAG_000, "rctl27:189::::zone.cpu-shares=(priv,20k,none)"}, 468 { 0, 1, FLAG_000, "rctl29:191::::project.max-shm-memory=(priv,200G,deny)"}, 469 { 0, 1, FLAG_000, "rctl30:192::::project.max-shm-memory=(priv,200Gb,deny)"}, 470 { 0, 1, FLAG_000, "rctl31:193::::project.max-shm-memory=(priv,2000B,deny)"}, 471 { 0, 1, FLAG_000, "rctl34:196::::task.max-cpu-time=(priv,2000s,none)"}, 472 { 0, 1, FLAG_000, "rctl35:197::::task.max-cpu-time=(priv,20.1ps,none)"}, 473 { 0, 1, FLAG_000, "rctl36:198::::task.max-cpu-time=(priv,20T,none)"}, 474 }; 475 476 477 boolean_t vflag = B_FALSE; 478 boolean_t kflag = B_FALSE; 479 480 int 481 projtest_compare_two_files(char *file1, char *file2, lst_t *errlst) 482 { 483 FILE *fp1, *fp2; 484 int c1, c2; 485 486 if ((fp1 = fopen(file1, "r")) == NULL) { 487 util_add_errmsg(errlst, "failed to open \"%s\"", file1); 488 return (1); 489 } 490 491 if ((fp2 = fopen(file2, "r")) == NULL) { 492 util_add_errmsg(errlst, "failed to open \"%s\"", file2); 493 return (1); 494 } 495 496 c1 = getc(fp1); 497 c2 = getc(fp2); 498 while ((c1 != EOF) && (c2 != EOF) && (c1 == c2)) { 499 c1 = getc(fp1); 500 c2 = getc(fp2); 501 } 502 (void) fclose(fp1); 503 (void) fclose(fp2); 504 505 if (c1 != c2) { 506 util_add_errmsg(errlst, "files differ \"%s\" \"%s\"", 507 file1, file2); 508 return (1); 509 } 510 511 return (0); 512 } 513 514 void 515 projtest_free_errlst(lst_t *errlst) 516 { 517 char *msg; 518 while (!lst_is_empty(errlst)) { 519 msg = lst_at(errlst, 0); 520 (void) lst_remove(errlst, msg); 521 free(msg); 522 } 523 } 524 525 void 526 do_read_test(read_test *rt, int tnum) 527 { 528 FILE *fp; 529 char *projfile, *projwrite; 530 lst_t *plst; 531 lst_t errlst; 532 lst_create(&errlst); 533 534 535 (void) asprintf(&projfile, "/tmp/project_%ld_%d_tmp", getpid(), tnum); 536 (void) unlink(projfile); 537 if ((fp = fopen(projfile, "wx")) == NULL) { 538 (void) fprintf(stderr, "error opening %s\n", projfile); 539 exit(1); 540 } 541 (void) fputs(rt->file, fp); 542 (void) fclose(fp); 543 544 (void) asprintf(&projwrite, "/tmp/project_%ld_%d_wrt", getpid(), tnum); 545 if ((fp = fopen(projwrite, "wx")) == NULL) { 546 (void) fprintf(stderr, "error opening %s\n", projfile); 547 exit(1); 548 } 549 (void) fclose(fp); 550 551 552 plst = projent_get_lst(projfile, rt->flags, &errlst); 553 554 555 if (plst == NULL && rt->res == 1) { 556 (void) printf("Read test[%02d]: **************[-SUCCESS-]\n", 557 tnum); 558 } else if (plst != NULL && rt->res == 0) { 559 560 projent_put_lst(projwrite, plst, &errlst); 561 (void) projtest_compare_two_files(projfile, projwrite, &errlst); 562 (void) printf("Read test[%02d]: **************[%s]\n", tnum, 563 lst_is_empty(&errlst) ? "-SUCCESS-" : "*FAILURE*"); 564 565 } else { 566 (void) printf("Read test[%02d]: **************[*FAILURE*]\n", 567 tnum); 568 } 569 570 if (vflag) { 571 util_print_errmsgs(&errlst); 572 } 573 574 if (!kflag) { 575 (void) unlink(projfile); 576 (void) unlink(projwrite); 577 } 578 579 projent_free_lst(plst); 580 projtest_free_errlst(&errlst); 581 } 582 583 584 void 585 do_parse_validate_test(parse_validate_test *pvt, int tnum) 586 { 587 lst_t errlst; 588 projent_t *ent; 589 int vres; 590 591 592 lst_create(&errlst); 593 594 595 ent = projent_parse(pvt->pline, pvt->flags, &errlst); 596 597 if (ent == NULL && pvt->pres == 1) { 598 (void) printf("Prse test[%02d]: **************[-SUCCESS-]\n", tnum); 599 } else if (ent != NULL && pvt->pres == 0) { 600 (void) printf("Prse test[%02d]: **************[-SUCCESS-]\n", tnum); 601 vres = projent_validate(ent, pvt->flags, &errlst); 602 (void) printf("Vdte test[%02d]: **************[%s]\n", tnum, 603 ((vres == 0 && pvt->vres == 0) || 604 (vres != 0 && pvt->vres != 0)) ? 605 "-SUCCESS-" : "*FAILURE*"); 606 } else { 607 (void) printf("Prse test[%02d]: **************[*FAILURE*]\n", tnum); 608 } 609 610 if (vflag) { 611 util_print_errmsgs(&errlst); 612 } 613 614 if (ent != NULL) { 615 projent_free(ent); 616 free(ent); 617 } 618 projtest_free_errlst(&errlst); 619 } 620 621 void 622 start_read_test(void) 623 { 624 int i; 625 for (i = 0; i < READ_TESTS_SIZE; i++) { 626 do_read_test(&rtests[i], i); 627 } 628 } 629 630 void 631 start_parse_validate_test(void) 632 { 633 int i; 634 for (i = 0; i < PARSE_VALIDATE_TESTS_SIZE; i++) { 635 do_parse_validate_test(&pvtests[i], i); 636 } 637 } 638 639 void 640 usage(void) 641 { 642 (void) fprintf(stderr, 643 "Usage:\n" 644 "projtest [-k] [-v]\n"); 645 } 646 647 int 648 main(int argc, char **argv) 649 { 650 int c; 651 652 while ((c = getopt(argc, argv, "vk")) != EOF) { 653 switch (c) { 654 case 'v': 655 vflag = B_TRUE; 656 break; 657 case 'k': 658 kflag = B_TRUE; 659 break; 660 default: 661 usage(); 662 exit(1); 663 break; 664 } 665 } 666 667 start_read_test(); 668 start_parse_validate_test(); 669 return (0); 670 }