acl.tab.cpp 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. # line 8 "acltext.y"
  42. #include <string.h>
  43. #include <netsite.h>
  44. #include <base/util.h>
  45. #include <base/plist.h>
  46. #include <libaccess/acl.h>
  47. #include "aclpriv.h"
  48. #include <libaccess/aclproto.h>
  49. #include <libaccess/nserror.h>
  50. #include "parse.h"
  51. #include "aclscan.h"
  52. #define MAX_LIST_SIZE 255
  53. static ACLListHandle_t *curr_acl_list; /* current acl list */
  54. static ACLHandle_t *curr_acl; /* current acl */
  55. static ACLExprHandle_t *curr_expr; /* current expression */
  56. static PFlags_t pflags; /* current authorization flags */
  57. static char *curr_args_list[MAX_LIST_SIZE]; /* current args */
  58. static char *curr_user_list[MAX_LIST_SIZE]; /* current users v2 */
  59. static char *curr_ip_dns_list[MAX_LIST_SIZE]; /* current ip/dns v2 */
  60. static PList_t curr_auth_info; /* current authorization method */
  61. static int use_generic_rights; /* use generic rights for conversion */
  62. int acl_PushListHandle(ACLListHandle_t *handle)
  63. {
  64. curr_acl_list = handle;
  65. return(0);
  66. }
  67. static void
  68. acl_string_lower(char *s)
  69. {
  70. int ii;
  71. int len;
  72. len = strlen(s);
  73. for (ii = 0; ii < len; ii++)
  74. s[ii] = tolower(s[ii]);
  75. return;
  76. }
  77. static void
  78. acl_clear_args(char **args_list)
  79. {
  80. args_list[0] = NULL;
  81. }
  82. static void
  83. acl_add_arg(char **args_list, char *arg)
  84. {
  85. static int args_index;
  86. if ( args_list[0] == NULL ) {
  87. args_index = 0;
  88. }
  89. args_list[args_index] = arg;
  90. args_index++;
  91. args_list[args_index] = NULL;
  92. }
  93. static void
  94. acl_free_args(char **args_list)
  95. {
  96. int ii;
  97. for (ii = 0; ii < MAX_LIST_SIZE; ii++) {
  98. if ( args_list[ii] )
  99. PERM_FREE(args_list[ii]);
  100. else
  101. break;
  102. }
  103. }
  104. static int
  105. acl_set_args(ACLExprHandle_t *expr, char **args_list)
  106. {
  107. int ii;
  108. if (expr == NULL)
  109. return(-1);
  110. for (ii = 0; ii < MAX_LIST_SIZE; ii++) {
  111. if ( args_list[ii] ) {
  112. if ( ACL_ExprAddArg(NULL, expr, args_list[ii]) < 0 ) {
  113. aclerror("ACL_ExprAddArg() failed");
  114. return(-1);
  115. }
  116. } else
  117. break;
  118. }
  119. return(0);
  120. }
  121. static int
  122. acl_set_users_or_groups(ACLExprHandle_t *expr, char **user_list)
  123. {
  124. int ii;
  125. int jj;
  126. if (expr == NULL)
  127. return(-1);
  128. for (ii = 0; ii < MAX_LIST_SIZE; ii++) {
  129. if ( user_list[ii] ) {
  130. if ( ACL_ExprTerm(NULL, expr, "user", CMP_OP_EQ,
  131. user_list[ii]) < 0 ) {
  132. aclerror("ACL_ExprTerm() failed");
  133. acl_free_args(user_list);
  134. return(-1);
  135. }
  136. if ( ACL_ExprTerm(NULL, expr, "group", CMP_OP_EQ,
  137. user_list[ii]) < 0 ) {
  138. aclerror("ACL_ExprTerm() failed");
  139. acl_free_args(user_list);
  140. return(-1);
  141. }
  142. } else
  143. break;
  144. }
  145. acl_free_args(user_list);
  146. for (jj = 0; jj < (ii * 2) - 1; jj++) {
  147. if ( ACL_ExprOr(NULL, expr) < 0 ) {
  148. aclerror("ACL_ExprOr() failed");
  149. return(-1);
  150. }
  151. }
  152. return(0);
  153. }
  154. static int
  155. acl_set_ip_dns(ACLExprHandle_t *expr, char **ip_dns)
  156. {
  157. int ii;
  158. int jj;
  159. int len;
  160. char *attr;
  161. char *val;
  162. if (expr == NULL)
  163. return(-1);
  164. for (ii = 0; ii < MAX_LIST_SIZE; ii++) {
  165. if ( ip_dns[ii] ) {
  166. attr = "ip";
  167. val = ip_dns[ii];
  168. len = strlen(val);
  169. for (jj = 0; jj < len; jj++) {
  170. if ( strchr("0123456789.*", val[jj]) == 0 ) {
  171. attr = "dns";
  172. break;
  173. }
  174. }
  175. if ( ACL_ExprTerm(NULL, expr, attr, CMP_OP_EQ,
  176. val) < 0 ) {
  177. aclerror("ACL_ExprTerm() failed");
  178. acl_free_args(ip_dns);
  179. return(-1);
  180. }
  181. } else
  182. break;
  183. }
  184. acl_free_args(ip_dns);
  185. for (jj = 0; jj < ii - 1; jj++) {
  186. if ( ACL_ExprOr(NULL, expr) < 0 ) {
  187. aclerror("ACL_ExprOr() failed");
  188. return(-1);
  189. }
  190. }
  191. return(0);
  192. }
  193. # line 223 "acltext.y"
  194. typedef union
  195. #ifdef __cplusplus
  196. ACLSTYPE
  197. #endif
  198. {
  199. char *string;
  200. int ival;
  201. } ACLSTYPE;
  202. # define ACL_ABSOLUTE_TOK 257
  203. # define ACL_ACL_TOK 258
  204. # define ACL_ALLOW_TOK 259
  205. # define ACL_ALWAYS_TOK 260
  206. # define ACL_AND_TOK 261
  207. # define ACL_AT_TOK 262
  208. # define ACL_AUTHENTICATE_TOK 263
  209. # define ACL_CONTENT_TOK 264
  210. # define ACL_DEFAULT_TOK 265
  211. # define ACL_DENY_TOK 266
  212. # define ACL_GROUP_TOK 267
  213. # define ACL_IN_TOK 268
  214. # define ACL_INHERIT_TOK 269
  215. # define ACL_NOT_TOK 270
  216. # define ACL_NULL_TOK 271
  217. # define ACL_OR_TOK 272
  218. # define ACL_QSTRING_TOK 273
  219. # define ACL_READ_TOK 274
  220. # define ACL_TERMINAL_TOK 275
  221. # define ACL_VARIABLE_TOK 276
  222. # define ACL_VERSION_TOK 277
  223. # define ACL_WRITE_TOK 278
  224. # define ACL_WITH_TOK 279
  225. # define ACL_EQ_TOK 280
  226. # define ACL_GE_TOK 281
  227. # define ACL_GT_TOK 282
  228. # define ACL_LE_TOK 283
  229. # define ACL_LT_TOK 284
  230. # define ACL_NE_TOK 285
  231. #ifdef __STDC__
  232. #include <stdlib.h>
  233. #include <string.h>
  234. #else
  235. #include <netsite.h>
  236. #include <memory.h>
  237. #endif
  238. #ifdef __cplusplus
  239. #ifndef aclerror
  240. void aclerror(const char *);
  241. #endif
  242. #ifndef acllex
  243. #ifdef __EXTERN_C__
  244. extern "C" { int acllex(void); }
  245. #else
  246. int acllex(void);
  247. #endif
  248. #endif
  249. int acl_Parse(void);
  250. #endif
  251. #define aclclearin aclchar = -1
  252. #define aclerrok aclerrflag = 0
  253. extern int aclchar;
  254. extern int aclerrflag;
  255. ACLSTYPE acllval;
  256. ACLSTYPE aclval;
  257. typedef int acltabelem;
  258. #ifndef ACLMAXDEPTH
  259. #define ACLMAXDEPTH 150
  260. #endif
  261. #if ACLMAXDEPTH > 0
  262. int acl_acls[ACLMAXDEPTH], *acls = acl_acls;
  263. ACLSTYPE acl_aclv[ACLMAXDEPTH], *aclv = acl_aclv;
  264. #else /* user does initial allocation */
  265. int *acls;
  266. ACLSTYPE *aclv;
  267. #endif
  268. static int aclmaxdepth = ACLMAXDEPTH;
  269. # define ACLERRCODE 256
  270. # line 952 "acltext.y"
  271. acltabelem aclexca[] ={
  272. -1, 1,
  273. 0, -1,
  274. -2, 0,
  275. };
  276. # define ACLNPROD 120
  277. # define ACLLAST 251
  278. acltabelem aclact[]={
  279. 176, 177, 178, 180, 179, 181, 156, 109, 69, 53,
  280. 160, 116, 76, 6, 185, 169, 118, 186, 170, 117,
  281. 150, 78, 85, 149, 77, 18, 144, 29, 17, 86,
  282. 28, 11, 3, 126, 10, 136, 140, 82, 89, 104,
  283. 87, 101, 7, 129, 127, 171, 133, 79, 72, 40,
  284. 132, 38, 102, 55, 108, 37, 172, 105, 39, 60,
  285. 60, 107, 128, 63, 59, 45, 61, 61, 93, 23,
  286. 46, 6, 131, 130, 158, 142, 137, 157, 125, 134,
  287. 154, 147, 56, 122, 112, 30, 75, 94, 81, 111,
  288. 139, 138, 88, 73, 165, 164, 155, 57, 50, 49,
  289. 48, 27, 14, 41, 65, 58, 145, 97, 153, 146,
  290. 98, 152, 120, 25, 184, 151, 119, 24, 99, 64,
  291. 13, 32, 15, 21, 5, 175, 159, 106, 103, 8,
  292. 100, 124, 84, 83, 66, 54, 52, 143, 80, 51,
  293. 67, 90, 36, 35, 26, 34, 33, 22, 31, 20,
  294. 135, 113, 62, 74, 96, 47, 92, 71, 44, 68,
  295. 43, 70, 42, 95, 16, 91, 9, 4, 19, 12,
  296. 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
  297. 0, 0, 0, 110, 115, 114, 121, 123, 0, 0,
  298. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  299. 0, 0, 0, 0, 0, 0, 0, 95, 141, 0,
  300. 0, 0, 0, 0, 0, 148, 0, 0, 0, 0,
  301. 0, 0, 0, 0, 0, 163, 0, 0, 0, 166,
  302. 167, 168, 0, 0, 0, 0, 174, 0, 173, 0,
  303. 161, 0, 0, 0, 118, 78, 162, 117, 77, 182,
  304. 183 };
  305. acltabelem aclpact[]={
  306. -245,-10000000,-10000000, -234, -187,-10000000, -242,-10000000,-10000000, 80,
  307. -10000000,-10000000, 43, -248, -189, 76, 69,-10000000,-10000000,-10000000,
  308. -189,-10000000, 42, -246, -38, -248,-10000000, -208,-10000000,-10000000,
  309. -195,-10000000,-10000000, -208, 41, 40, 39,-10000000,-10000000, -270,
  310. -213, -43, 38,-10000000,-10000000, -199, -200,-10000000,-10000000,-10000000,
  311. -10000000, 79,-10000000,-10000000,-10000000, -271,-10000000, -195,-10000000, -220,
  312. -10000000,-10000000, -28, -221, -239,-10000000, -235, -238,-10000000,-10000000,
  313. -10000000, -28,-10000000,-10000000, -194,-10000000, -252,-10000000,-10000000,-10000000,
  314. 66,-10000000,-10000000,-10000000, 78, -223, -218, -203,-10000000, -273,
  315. -238,-10000000, -39, -29, 75, 68, -39, -40, -239, -243,
  316. -10000000, -231, -202,-10000000, -232, -184,-10000000, -185, -214, -227,
  317. -10000000,-10000000, -241,-10000000,-10000000,-10000000, -257, -240,-10000000,-10000000,
  318. -252,-10000000, -250,-10000000, 65,-10000000,-10000000,-10000000,-10000000,-10000000,
  319. -10000000,-10000000,-10000000,-10000000, -44, -241, -253, 74, 67, 64,
  320. -10000000,-10000000, -45, 37, -274, -30, -243,-10000000,-10000000, 36,
  321. 35,-10000000, -257, -257,-10000000, -250, -258,-10000000, -216,-10000000,
  322. -30, -30, -280,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,
  323. -10000000, -30, -30, 73,-10000000, -259,-10000000,-10000000,-10000000,-10000000,
  324. -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000 };
  325. acltabelem aclpgo[]={
  326. 0, 171, 170, 169, 168, 167, 124, 166, 122, 103,
  327. 164, 162, 160, 158, 105, 157, 93, 156, 89, 154,
  328. 153, 151, 86, 87, 91, 90, 76, 79, 150, 149,
  329. 123, 147, 121, 146, 145, 143, 142, 141, 92, 140,
  330. 139, 138, 75, 88, 137, 136, 104, 135, 134, 133,
  331. 132, 131, 77, 130, 128, 127, 78, 74, 126, 125 };
  332. acltabelem aclr1[]={
  333. 0, 1, 1, 3, 1, 2, 5, 5, 6, 7,
  334. 7, 8, 8, 10, 10, 9, 9, 11, 11, 15,
  335. 13, 13, 14, 14, 17, 12, 19, 12, 16, 16,
  336. 20, 20, 23, 23, 22, 22, 21, 21, 21, 24,
  337. 24, 25, 26, 26, 26, 26, 18, 28, 28, 27,
  338. 27, 4, 29, 29, 30, 30, 31, 31, 32, 32,
  339. 33, 33, 33, 37, 36, 39, 36, 38, 40, 34,
  340. 41, 41, 43, 42, 42, 44, 44, 45, 35, 47,
  341. 35, 48, 46, 49, 50, 50, 50, 50, 50, 50,
  342. 50, 55, 55, 55, 55, 53, 53, 53, 53, 54,
  343. 54, 54, 54, 51, 51, 56, 52, 52, 52, 57,
  344. 57, 57, 58, 58, 59, 59, 59, 59, 59, 59 };
  345. acltabelem aclr2[]={
  346. 0, 0, 2, 1, 10, 2, 2, 4, 17, 3,
  347. 3, 2, 6, 3, 3, 4, 6, 2, 2, 1,
  348. 8, 6, 3, 3, 1, 10, 1, 10, 7, 3,
  349. 2, 6, 2, 6, 3, 3, 2, 2, 6, 3,
  350. 3, 5, 2, 2, 6, 6, 7, 7, 7, 2,
  351. 4, 2, 2, 4, 6, 4, 5, 5, 2, 4,
  352. 4, 4, 4, 1, 10, 1, 8, 7, 1, 17,
  353. 2, 6, 3, 4, 6, 7, 7, 1, 6, 1,
  354. 6, 1, 5, 10, 0, 3, 5, 3, 5, 3,
  355. 5, 3, 3, 5, 5, 3, 3, 5, 5, 3,
  356. 3, 5, 5, 2, 6, 3, 2, 7, 7, 2,
  357. 6, 5, 7, 7, 2, 2, 2, 2, 2, 2 };
  358. acltabelem aclchk[]={
  359. -10000000, -1, -2, 277, -5, -6, 258, 276, -6, -7,
  360. 276, 273, -3, 40, 59, -8, -10, 276, 273, -4,
  361. -29, -30, -31, 258, 41, 44, -30, 59, 276, 273,
  362. 123, -8, -32, -33, -34, -35, -36, 263, 259, 266,
  363. 257, -9, -11, -12, -13, 260, 265, -32, 59, 59,
  364. 59, -40, -45, 279, -47, 266, 125, 59, -14, 263,
  365. 259, 266, -14, 263, 40, -46, -48, -39, -46, 279,
  366. -9, -15, 268, -16, -20, -22, 40, 276, 273, 268,
  367. -41, -43, 276, -49, -50, 257, 264, 275, -38, 276,
  368. -37, -16, -17, 262, -23, -22, -19, 41, 44, 40,
  369. -53, 264, 275, -54, 257, 275, -55, 264, 257, 280,
  370. -38, -18, 123, -21, -24, -25, 40, 276, 273, 41,
  371. 44, -18, 123, -43, -51, -56, 276, 275, 264, 275,
  372. 257, 257, 264, 273, -27, -28, 276, -26, -24, -25,
  373. 276, -23, -42, -44, 276, 41, 44, 125, -27, 276,
  374. 273, 41, 44, 44, 125, 59, 280, -52, -57, -58,
  375. 40, 270, 276, -56, 59, 59, -26, -26, -42, 273,
  376. 276, 261, 272, -52, -57, -59, 280, 281, 282, 284,
  377. 283, 285, -52, -52, 41, 273, 276 };
  378. acltabelem acldef[]={
  379. 1, -2, 2, 0, 5, 6, 0, 3, 7, 0,
  380. 9, 10, 0, 0, 0, 0, 11, 13, 14, 4,
  381. 51, 52, 0, 0, 0, 0, 53, 55, 56, 57,
  382. 0, 12, 54, 58, 0, 0, 0, 68, 77, 79,
  383. 0, 0, 0, 17, 18, 0, 0, 59, 60, 61,
  384. 62, 0, 81, 65, 81, 0, 8, 15, 19, 0,
  385. 22, 23, 0, 0, 0, 78, 84, 0, 80, 63,
  386. 16, 0, 24, 21, 29, 30, 0, 34, 35, 26,
  387. 0, 70, 72, 82, 0, 85, 87, 89, 66, 0,
  388. 0, 20, 0, 0, 0, 32, 0, 0, 0, 0,
  389. 86, 95, 96, 88, 99, 100, 90, 91, 92, 0,
  390. 64, 25, 0, 28, 36, 37, 0, 39, 40, 31,
  391. 0, 27, 0, 71, 0, 103, 105, 97, 98, 101,
  392. 102, 93, 94, 67, 0, 49, 0, 0, 42, 43,
  393. 41, 33, 0, 0, 0, 0, 0, 46, 50, 0,
  394. 0, 38, 0, 0, 69, 73, 0, 83, 106, 109,
  395. 0, 0, 0, 104, 47, 48, 44, 45, 74, 75,
  396. 76, 0, 0, 0, 111, 0, 114, 115, 116, 117,
  397. 118, 119, 107, 108, 110, 112, 113 };
  398. typedef struct
  399. #ifdef __cplusplus
  400. acltoktype
  401. #endif
  402. { char *t_name; int t_val; } acltoktype;
  403. #ifndef ACLDEBUG
  404. # define ACLDEBUG 0 /* don't allow debugging */
  405. #endif
  406. #if ACLDEBUG
  407. acltoktype acltoks[] =
  408. {
  409. "ACL_ABSOLUTE_TOK", 257,
  410. "ACL_ACL_TOK", 258,
  411. "ACL_ALLOW_TOK", 259,
  412. "ACL_ALWAYS_TOK", 260,
  413. "ACL_AND_TOK", 261,
  414. "ACL_AT_TOK", 262,
  415. "ACL_AUTHENTICATE_TOK", 263,
  416. "ACL_CONTENT_TOK", 264,
  417. "ACL_DEFAULT_TOK", 265,
  418. "ACL_DENY_TOK", 266,
  419. "ACL_GROUP_TOK", 267,
  420. "ACL_IN_TOK", 268,
  421. "ACL_INHERIT_TOK", 269,
  422. "ACL_NOT_TOK", 270,
  423. "ACL_NULL_TOK", 271,
  424. "ACL_OR_TOK", 272,
  425. "ACL_QSTRING_TOK", 273,
  426. "ACL_READ_TOK", 274,
  427. "ACL_TERMINAL_TOK", 275,
  428. "ACL_VARIABLE_TOK", 276,
  429. "ACL_VERSION_TOK", 277,
  430. "ACL_WRITE_TOK", 278,
  431. "ACL_WITH_TOK", 279,
  432. "ACL_EQ_TOK", 280,
  433. "ACL_GE_TOK", 281,
  434. "ACL_GT_TOK", 282,
  435. "ACL_LE_TOK", 283,
  436. "ACL_LT_TOK", 284,
  437. "ACL_NE_TOK", 285,
  438. "-unknown-", -1 /* ends search */
  439. };
  440. char * aclreds[] =
  441. {
  442. "-no such reduction-",
  443. "start : /* empty */",
  444. "start : start_acl_v2",
  445. "start : ACL_VERSION_TOK ACL_VARIABLE_TOK",
  446. "start : ACL_VERSION_TOK ACL_VARIABLE_TOK ';' start_acl_v3",
  447. "start_acl_v2 : acl_list_v2",
  448. "acl_list_v2 : acl_v2",
  449. "acl_list_v2 : acl_list_v2 acl_v2",
  450. "acl_v2 : ACL_ACL_TOK acl_name_v2 '(' arg_list_v2 ')' '{' directive_list_v2 '}'",
  451. "acl_name_v2 : ACL_VARIABLE_TOK",
  452. "acl_name_v2 : ACL_QSTRING_TOK",
  453. "arg_list_v2 : arg_v2",
  454. "arg_list_v2 : arg_v2 ',' arg_list_v2",
  455. "arg_v2 : ACL_VARIABLE_TOK",
  456. "arg_v2 : ACL_QSTRING_TOK",
  457. "directive_list_v2 : directive_v2 ';'",
  458. "directive_list_v2 : directive_v2 ';' directive_list_v2",
  459. "directive_v2 : auth_method_v2",
  460. "directive_v2 : auth_statement_v2",
  461. "auth_statement_v2 : ACL_ALWAYS_TOK auth_type_v2",
  462. "auth_statement_v2 : ACL_ALWAYS_TOK auth_type_v2 host_spec_list_action_v2",
  463. "auth_statement_v2 : ACL_DEFAULT_TOK auth_type_v2 host_spec_list_action_v2",
  464. "auth_type_v2 : ACL_ALLOW_TOK",
  465. "auth_type_v2 : ACL_DENY_TOK",
  466. "auth_method_v2 : ACL_ALWAYS_TOK ACL_AUTHENTICATE_TOK ACL_IN_TOK",
  467. "auth_method_v2 : ACL_ALWAYS_TOK ACL_AUTHENTICATE_TOK ACL_IN_TOK realm_definition_v2",
  468. "auth_method_v2 : ACL_DEFAULT_TOK ACL_AUTHENTICATE_TOK ACL_IN_TOK",
  469. "auth_method_v2 : ACL_DEFAULT_TOK ACL_AUTHENTICATE_TOK ACL_IN_TOK realm_definition_v2",
  470. "host_spec_list_action_v2 : user_expr_v2 ACL_AT_TOK host_spec_list_v2",
  471. "host_spec_list_action_v2 : user_expr_v2",
  472. "user_expr_v2 : user_v2",
  473. "user_expr_v2 : '(' user_list_v2 ')'",
  474. "user_list_v2 : user_v2",
  475. "user_list_v2 : user_v2 ',' user_list_v2",
  476. "user_v2 : ACL_VARIABLE_TOK",
  477. "user_v2 : ACL_QSTRING_TOK",
  478. "host_spec_list_v2 : dns_spec_v2",
  479. "host_spec_list_v2 : ip_spec_v2",
  480. "host_spec_list_v2 : '(' dns_ip_spec_list_v2 ')'",
  481. "dns_spec_v2 : ACL_VARIABLE_TOK",
  482. "dns_spec_v2 : ACL_QSTRING_TOK",
  483. "ip_spec_v2 : ACL_VARIABLE_TOK ACL_VARIABLE_TOK",
  484. "dns_ip_spec_list_v2 : dns_spec_v2",
  485. "dns_ip_spec_list_v2 : ip_spec_v2",
  486. "dns_ip_spec_list_v2 : dns_spec_v2 ',' dns_ip_spec_list_v2",
  487. "dns_ip_spec_list_v2 : ip_spec_v2 ',' dns_ip_spec_list_v2",
  488. "realm_definition_v2 : '{' methods_list_v2 '}'",
  489. "method_v2 : ACL_VARIABLE_TOK ACL_VARIABLE_TOK ';'",
  490. "method_v2 : ACL_VARIABLE_TOK ACL_QSTRING_TOK ';'",
  491. "methods_list_v2 : method_v2",
  492. "methods_list_v2 : method_v2 methods_list_v2",
  493. "start_acl_v3 : acl_list",
  494. "acl_list : acl",
  495. "acl_list : acl_list acl",
  496. "acl : named_acl ';' body_list",
  497. "acl : named_acl ';'",
  498. "named_acl : ACL_ACL_TOK ACL_VARIABLE_TOK",
  499. "named_acl : ACL_ACL_TOK ACL_QSTRING_TOK",
  500. "body_list : body",
  501. "body_list : body body_list",
  502. "body : authenticate_statement ';'",
  503. "body : authorization_statement ';'",
  504. "body : deny_statement ';'",
  505. "deny_statement : ACL_ABSOLUTE_TOK ACL_DENY_TOK ACL_WITH_TOK",
  506. "deny_statement : ACL_ABSOLUTE_TOK ACL_DENY_TOK ACL_WITH_TOK deny_common",
  507. "deny_statement : ACL_DENY_TOK ACL_WITH_TOK",
  508. "deny_statement : ACL_DENY_TOK ACL_WITH_TOK deny_common",
  509. "deny_common : ACL_VARIABLE_TOK ACL_EQ_TOK ACL_QSTRING_TOK",
  510. "authenticate_statement : ACL_AUTHENTICATE_TOK",
  511. "authenticate_statement : ACL_AUTHENTICATE_TOK '(' attribute_list ')' '{' parameter_list '}'",
  512. "attribute_list : attribute",
  513. "attribute_list : attribute_list ',' attribute",
  514. "attribute : ACL_VARIABLE_TOK",
  515. "parameter_list : parameter ';'",
  516. "parameter_list : parameter ';' parameter_list",
  517. "parameter : ACL_VARIABLE_TOK ACL_EQ_TOK ACL_QSTRING_TOK",
  518. "parameter : ACL_VARIABLE_TOK ACL_EQ_TOK ACL_VARIABLE_TOK",
  519. "authorization_statement : ACL_ALLOW_TOK",
  520. "authorization_statement : ACL_ALLOW_TOK auth_common_action",
  521. "authorization_statement : ACL_DENY_TOK",
  522. "authorization_statement : ACL_DENY_TOK auth_common_action",
  523. "auth_common_action : /* empty */",
  524. "auth_common_action : auth_common",
  525. "auth_common : flag_list '(' args_list ')' expression",
  526. "flag_list : /* empty */",
  527. "flag_list : ACL_ABSOLUTE_TOK",
  528. "flag_list : ACL_ABSOLUTE_TOK content_static",
  529. "flag_list : ACL_CONTENT_TOK",
  530. "flag_list : ACL_CONTENT_TOK absolute_static",
  531. "flag_list : ACL_TERMINAL_TOK",
  532. "flag_list : ACL_TERMINAL_TOK content_absolute",
  533. "content_absolute : ACL_CONTENT_TOK",
  534. "content_absolute : ACL_ABSOLUTE_TOK",
  535. "content_absolute : ACL_CONTENT_TOK ACL_ABSOLUTE_TOK",
  536. "content_absolute : ACL_ABSOLUTE_TOK ACL_CONTENT_TOK",
  537. "content_static : ACL_CONTENT_TOK",
  538. "content_static : ACL_TERMINAL_TOK",
  539. "content_static : ACL_CONTENT_TOK ACL_TERMINAL_TOK",
  540. "content_static : ACL_TERMINAL_TOK ACL_CONTENT_TOK",
  541. "absolute_static : ACL_ABSOLUTE_TOK",
  542. "absolute_static : ACL_TERMINAL_TOK",
  543. "absolute_static : ACL_ABSOLUTE_TOK ACL_TERMINAL_TOK",
  544. "absolute_static : ACL_TERMINAL_TOK ACL_ABSOLUTE_TOK",
  545. "args_list : arg",
  546. "args_list : args_list ',' arg",
  547. "arg : ACL_VARIABLE_TOK",
  548. "expression : factor",
  549. "expression : factor ACL_AND_TOK expression",
  550. "expression : factor ACL_OR_TOK expression",
  551. "factor : base_expr",
  552. "factor : '(' expression ')'",
  553. "factor : ACL_NOT_TOK factor",
  554. "base_expr : ACL_VARIABLE_TOK relop ACL_QSTRING_TOK",
  555. "base_expr : ACL_VARIABLE_TOK relop ACL_VARIABLE_TOK",
  556. "relop : ACL_EQ_TOK",
  557. "relop : ACL_GE_TOK",
  558. "relop : ACL_GT_TOK",
  559. "relop : ACL_LT_TOK",
  560. "relop : ACL_LE_TOK",
  561. "relop : ACL_NE_TOK",
  562. };
  563. #endif /* ACLDEBUG */
  564. /*
  565. ** Skeleton parser driver for yacc output
  566. */
  567. /*
  568. ** yacc user known macros and defines
  569. */
  570. #define ACLERROR goto aclerrlab
  571. #define ACLACCEPT return(0)
  572. #define ACLABORT return(1)
  573. #define ACLBACKUP( newtoken, newvalue )\
  574. {\
  575. if ( aclchar >= 0 || ( aclr2[ acltmp ] >> 1 ) != 1 )\
  576. {\
  577. aclerror( "syntax error - cannot backup" );\
  578. goto aclerrlab;\
  579. }\
  580. aclchar = newtoken;\
  581. aclstate = *aclps;\
  582. acllval = newvalue;\
  583. goto aclnewstate;\
  584. }
  585. #define ACLRECOVERING() (!!aclerrflag)
  586. #define ACLNEW(type) PERM_MALLOC(sizeof(type) * aclnewmax)
  587. #define ACLCOPY(to, from, type) \
  588. (type *) memcpy(to, (char *) from, aclnewmax * sizeof(type))
  589. #define ACLENLARGE( from, type) \
  590. (type *) PERM_REALLOC((char *) from, aclnewmax * sizeof(type))
  591. #ifndef ACLDEBUG
  592. # define ACLDEBUG 1 /* make debugging available */
  593. #endif
  594. /*
  595. ** user known globals
  596. */
  597. int acldebug; /* set to 1 to get debugging */
  598. /*
  599. ** driver internal defines
  600. */
  601. #define ACLFLAG (-10000000)
  602. /*
  603. ** global variables used by the parser
  604. */
  605. ACLSTYPE *aclpv; /* top of value stack */
  606. int *aclps; /* top of state stack */
  607. int aclstate; /* current state */
  608. int acltmp; /* extra var (lasts between blocks) */
  609. int aclnerrs; /* number of errors */
  610. int aclerrflag; /* error recovery flag */
  611. int aclchar; /* current input token number */
  612. #ifdef ACLNMBCHARS
  613. #define ACLLEX() aclcvtok(acllex())
  614. /*
  615. ** aclcvtok - return a token if i is a wchar_t value that exceeds 255.
  616. ** If i<255, i itself is the token. If i>255 but the neither
  617. ** of the 30th or 31st bit is on, i is already a token.
  618. */
  619. #if defined(__STDC__) || defined(__cplusplus)
  620. int aclcvtok(int i)
  621. #else
  622. int aclcvtok(i) int i;
  623. #endif
  624. {
  625. int first = 0;
  626. int last = ACLNMBCHARS - 1;
  627. int mid;
  628. wchar_t j;
  629. if(i&0x60000000){/*Must convert to a token. */
  630. if( aclmbchars[last].character < i ){
  631. return i;/*Giving up*/
  632. }
  633. while ((last>=first)&&(first>=0)) {/*Binary search loop*/
  634. mid = (first+last)/2;
  635. j = aclmbchars[mid].character;
  636. if( j==i ){/*Found*/
  637. return aclmbchars[mid].tvalue;
  638. }else if( j<i ){
  639. first = mid + 1;
  640. }else{
  641. last = mid -1;
  642. }
  643. }
  644. /*No entry in the table.*/
  645. return i;/* Giving up.*/
  646. }else{/* i is already a token. */
  647. return i;
  648. }
  649. }
  650. #else/*!ACLNMBCHARS*/
  651. #define ACLLEX() acllex()
  652. #endif/*!ACLNMBCHARS*/
  653. /*
  654. ** acl_Parse - return 0 if worked, 1 if syntax error not recovered from
  655. */
  656. #if defined(__STDC__) || defined(__cplusplus)
  657. int acl_Parse(void)
  658. #else
  659. int acl_Parse()
  660. #endif
  661. {
  662. register ACLSTYPE *aclpvt = 0; /* top of value stack for $vars */
  663. #if defined(__cplusplus) || defined(lint)
  664. /*
  665. hacks to please C++ and lint - goto's inside switch should never be
  666. executed; aclpvt is set to 0 to avoid "used before set" warning.
  667. */
  668. static int __yaccpar_lint_hack__ = 0;
  669. switch (__yaccpar_lint_hack__)
  670. {
  671. case 1: goto aclerrlab;
  672. case 2: goto aclnewstate;
  673. }
  674. #endif
  675. /*
  676. ** Initialize externals - acl_Parse may be called more than once
  677. */
  678. aclpv = &aclv[-1];
  679. aclps = &acls[-1];
  680. aclstate = 0;
  681. acltmp = 0;
  682. aclnerrs = 0;
  683. aclerrflag = 0;
  684. aclchar = -1;
  685. #if ACLMAXDEPTH <= 0
  686. if (aclmaxdepth <= 0)
  687. {
  688. if ((aclmaxdepth = ACLEXPAND(0)) <= 0)
  689. {
  690. aclerror("yacc initialization error");
  691. ACLABORT;
  692. }
  693. }
  694. #endif
  695. {
  696. register ACLSTYPE *acl_pv; /* top of value stack */
  697. register int *acl_ps; /* top of state stack */
  698. register int acl_state; /* current state */
  699. register int acl_n; /* internal state number info */
  700. goto aclstack; /* moved from 6 lines above to here to please C++ */
  701. /*
  702. ** get globals into registers.
  703. ** branch to here only if ACLBACKUP was called.
  704. */
  705. aclnewstate:
  706. acl_pv = aclpv;
  707. acl_ps = aclps;
  708. acl_state = aclstate;
  709. goto acl_newstate;
  710. /*
  711. ** get globals into registers.
  712. ** either we just started, or we just finished a reduction
  713. */
  714. aclstack:
  715. acl_pv = aclpv;
  716. acl_ps = aclps;
  717. acl_state = aclstate;
  718. /*
  719. ** top of for (;;) loop while no reductions done
  720. */
  721. acl_stack:
  722. /*
  723. ** put a state and value onto the stacks
  724. */
  725. #if ACLDEBUG
  726. /*
  727. ** if debugging, look up token value in list of value vs.
  728. ** name pairs. 0 and negative (-1) are special values.
  729. ** Note: linear search is used since time is not a real
  730. ** consideration while debugging.
  731. */
  732. if ( acldebug )
  733. {
  734. register int acl_i;
  735. printf( "State %d, token ", acl_state );
  736. if ( aclchar == 0 )
  737. printf( "end-of-file\n" );
  738. else if ( aclchar < 0 )
  739. printf( "-none-\n" );
  740. else
  741. {
  742. for ( acl_i = 0; acltoks[acl_i].t_val >= 0;
  743. acl_i++ )
  744. {
  745. if ( acltoks[acl_i].t_val == aclchar )
  746. break;
  747. }
  748. printf( "%s\n", acltoks[acl_i].t_name );
  749. }
  750. }
  751. #endif /* ACLDEBUG */
  752. if ( ++acl_ps >= &acls[ aclmaxdepth ] ) /* room on stack? */
  753. {
  754. /*
  755. ** reallocate and recover. Note that pointers
  756. ** have to be reset, or bad things will happen
  757. */
  758. int aclps_index = (acl_ps - acls);
  759. int aclpv_index = (acl_pv - aclv);
  760. int aclpvt_index = (aclpvt - aclv);
  761. int aclnewmax;
  762. #ifdef ACLEXPAND
  763. aclnewmax = ACLEXPAND(aclmaxdepth);
  764. #else
  765. aclnewmax = 2 * aclmaxdepth; /* double table size */
  766. if (aclmaxdepth == ACLMAXDEPTH) /* first time growth */
  767. {
  768. char *newacls = (char *)ACLNEW(int);
  769. char *newaclv = (char *)ACLNEW(ACLSTYPE);
  770. if (newacls != 0 && newaclv != 0)
  771. {
  772. acls = ACLCOPY(newacls, acls, int);
  773. aclv = ACLCOPY(newaclv, aclv, ACLSTYPE);
  774. }
  775. else
  776. {
  777. aclnewmax = 0; /* failed */
  778. if (newacls) PERM_FREE(newacls);
  779. if (newaclv) PERM_FREE(newaclv);
  780. }
  781. }
  782. else /* not first time */
  783. {
  784. acls = ACLENLARGE(acls, int);
  785. aclv = ACLENLARGE(aclv, ACLSTYPE);
  786. if (acls == 0 || aclv == 0)
  787. aclnewmax = 0; /* failed */
  788. }
  789. #endif
  790. if (aclnewmax <= aclmaxdepth) /* tables not expanded */
  791. {
  792. aclerror( "yacc stack overflow" );
  793. ACLABORT;
  794. }
  795. aclmaxdepth = aclnewmax;
  796. acl_ps = acls + aclps_index;
  797. acl_pv = aclv + aclpv_index;
  798. aclpvt = aclv + aclpvt_index;
  799. }
  800. *acl_ps = acl_state;
  801. *++acl_pv = aclval;
  802. /*
  803. ** we have a new state - find out what to do
  804. */
  805. acl_newstate:
  806. if ( ( acl_n = aclpact[ acl_state ] ) <= ACLFLAG )
  807. goto acldefault; /* simple state */
  808. #if ACLDEBUG
  809. /*
  810. ** if debugging, need to mark whether new token grabbed
  811. */
  812. acltmp = aclchar < 0;
  813. #endif
  814. if ( ( aclchar < 0 ) && ( ( aclchar = ACLLEX() ) < 0 ) )
  815. aclchar = 0; /* reached EOF */
  816. #if ACLDEBUG
  817. if ( acldebug && acltmp )
  818. {
  819. register int acl_i;
  820. printf( "Received token " );
  821. if ( aclchar == 0 )
  822. printf( "end-of-file\n" );
  823. else if ( aclchar < 0 )
  824. printf( "-none-\n" );
  825. else
  826. {
  827. for ( acl_i = 0; acltoks[acl_i].t_val >= 0;
  828. acl_i++ )
  829. {
  830. if ( acltoks[acl_i].t_val == aclchar )
  831. break;
  832. }
  833. printf( "%s\n", acltoks[acl_i].t_name );
  834. }
  835. }
  836. #endif /* ACLDEBUG */
  837. if ( ( ( acl_n += aclchar ) < 0 ) || ( acl_n >= ACLLAST ) )
  838. goto acldefault;
  839. if ( aclchk[ acl_n = aclact[ acl_n ] ] == aclchar ) /*valid shift*/
  840. {
  841. aclchar = -1;
  842. aclval = acllval;
  843. acl_state = acl_n;
  844. if ( aclerrflag > 0 )
  845. aclerrflag--;
  846. goto acl_stack;
  847. }
  848. acldefault:
  849. if ( ( acl_n = acldef[ acl_state ] ) == -2 )
  850. {
  851. #if ACLDEBUG
  852. acltmp = aclchar < 0;
  853. #endif
  854. if ( ( aclchar < 0 ) && ( ( aclchar = ACLLEX() ) < 0 ) )
  855. aclchar = 0; /* reached EOF */
  856. #if ACLDEBUG
  857. if ( acldebug && acltmp )
  858. {
  859. register int acl_i;
  860. printf( "Received token " );
  861. if ( aclchar == 0 )
  862. printf( "end-of-file\n" );
  863. else if ( aclchar < 0 )
  864. printf( "-none-\n" );
  865. else
  866. {
  867. for ( acl_i = 0;
  868. acltoks[acl_i].t_val >= 0;
  869. acl_i++ )
  870. {
  871. if ( acltoks[acl_i].t_val
  872. == aclchar )
  873. {
  874. break;
  875. }
  876. }
  877. printf( "%s\n", acltoks[acl_i].t_name );
  878. }
  879. }
  880. #endif /* ACLDEBUG */
  881. /*
  882. ** look through exception table
  883. */
  884. {
  885. register int *aclxi = aclexca;
  886. /* The first element of the last pair is -2, so we
  887. * need to make sure we don't increment past it. */
  888. while ( (*aclxi != -2) && ((*aclxi != -1) ||
  889. (aclxi[1] != acl_state)) )
  890. {
  891. aclxi += 2;
  892. }
  893. while ( (*aclxi != -2) && (*(aclxi += 2) >= 0) &&
  894. (*aclxi != aclchar) )
  895. {
  896. ;
  897. }
  898. if ( ( acl_n = aclxi[1] ) < 0 )
  899. ACLACCEPT;
  900. }
  901. }
  902. /*
  903. ** check for syntax error
  904. */
  905. if ( acl_n == 0 ) /* have an error */
  906. {
  907. /* no worry about speed here! */
  908. switch ( aclerrflag )
  909. {
  910. case 0: /* new error */
  911. aclerror( "syntax error" );
  912. goto skip_init;
  913. aclerrlab:
  914. /*
  915. ** get globals into registers.
  916. ** we have a user generated syntax type error
  917. */
  918. acl_pv = aclpv;
  919. acl_ps = aclps;
  920. acl_state = aclstate;
  921. skip_init:
  922. aclnerrs++;
  923. /* FALLTHRU */
  924. case 1:
  925. case 2: /* incompletely recovered error */
  926. /* try again... */
  927. aclerrflag = 3;
  928. /*
  929. ** find state where "error" is a legal
  930. ** shift action
  931. */
  932. while ( acl_ps >= acls )
  933. {
  934. acl_n = aclpact[ *acl_ps ] + ACLERRCODE;
  935. if ( acl_n >= 0 && acl_n < ACLLAST &&
  936. aclchk[aclact[acl_n]] == ACLERRCODE) {
  937. /*
  938. ** simulate shift of "error"
  939. */
  940. acl_state = aclact[ acl_n ];
  941. goto acl_stack;
  942. }
  943. /*
  944. ** current state has no shift on
  945. ** "error", pop stack
  946. */
  947. #if ACLDEBUG
  948. # define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  949. if ( acldebug )
  950. printf( _POP_, *acl_ps,
  951. acl_ps[-1] );
  952. # undef _POP_
  953. #endif
  954. acl_ps--;
  955. acl_pv--;
  956. }
  957. /*
  958. ** there is no state on stack with "error" as
  959. ** a valid shift. give up.
  960. */
  961. ACLABORT;
  962. case 3: /* no shift yet; eat a token */
  963. #if ACLDEBUG
  964. /*
  965. ** if debugging, look up token in list of
  966. ** pairs. 0 and negative shouldn't occur,
  967. ** but since timing doesn't matter when
  968. ** debugging, it doesn't hurt to leave the
  969. ** tests here.
  970. */
  971. if ( acldebug )
  972. {
  973. register int acl_i;
  974. printf( "Error recovery discards " );
  975. if ( aclchar == 0 )
  976. printf( "token end-of-file\n" );
  977. else if ( aclchar < 0 )
  978. printf( "token -none-\n" );
  979. else
  980. {
  981. for ( acl_i = 0;
  982. acltoks[acl_i].t_val >= 0;
  983. acl_i++ )
  984. {
  985. if ( acltoks[acl_i].t_val
  986. == aclchar )
  987. {
  988. break;
  989. }
  990. }
  991. printf( "token %s\n",
  992. acltoks[acl_i].t_name );
  993. }
  994. }
  995. #endif /* ACLDEBUG */
  996. if ( aclchar == 0 ) /* reached EOF. quit */
  997. ACLABORT;
  998. aclchar = -1;
  999. goto acl_newstate;
  1000. }
  1001. }/* end if ( acl_n == 0 ) */
  1002. /*
  1003. ** reduction by production acl_n
  1004. ** put stack tops, etc. so things right after switch
  1005. */
  1006. #if ACLDEBUG
  1007. /*
  1008. ** if debugging, print the string that is the user's
  1009. ** specification of the reduction which is just about
  1010. ** to be done.
  1011. */
  1012. if ( acldebug )
  1013. printf( "Reduce by (%d) \"%s\"\n",
  1014. acl_n, aclreds[ acl_n ] );
  1015. #endif
  1016. acltmp = acl_n; /* value to switch over */
  1017. aclpvt = acl_pv; /* $vars top of value stack */
  1018. /*
  1019. ** Look in goto table for next state
  1020. ** Sorry about using acl_state here as temporary
  1021. ** register variable, but why not, if it works...
  1022. ** If aclr2[ acl_n ] doesn't have the low order bit
  1023. ** set, then there is no action to be done for
  1024. ** this reduction. So, no saving & unsaving of
  1025. ** registers done. The only difference between the
  1026. ** code just after the if and the body of the if is
  1027. ** the goto acl_stack in the body. This way the test
  1028. ** can be made before the choice of what to do is needed.
  1029. */
  1030. {
  1031. /* length of production doubled with extra bit */
  1032. register int acl_len = aclr2[ acl_n ];
  1033. if ( !( acl_len & 01 ) )
  1034. {
  1035. acl_len >>= 1;
  1036. aclval = ( acl_pv -= acl_len )[1]; /* $$ = $1 */
  1037. acl_state = aclpgo[ acl_n = aclr1[ acl_n ] ] +
  1038. *( acl_ps -= acl_len ) + 1;
  1039. if ( acl_state >= ACLLAST ||
  1040. aclchk[ acl_state =
  1041. aclact[ acl_state ] ] != -acl_n )
  1042. {
  1043. acl_state = aclact[ aclpgo[ acl_n ] ];
  1044. }
  1045. goto acl_stack;
  1046. }
  1047. acl_len >>= 1;
  1048. aclval = ( acl_pv -= acl_len )[1]; /* $$ = $1 */
  1049. acl_state = aclpgo[ acl_n = aclr1[ acl_n ] ] +
  1050. *( acl_ps -= acl_len ) + 1;
  1051. if ( acl_state >= ACLLAST ||
  1052. aclchk[ acl_state = aclact[ acl_state ] ] != -acl_n )
  1053. {
  1054. acl_state = aclact[ aclpgo[ acl_n ] ];
  1055. }
  1056. }
  1057. /* save until reenter driver code */
  1058. aclstate = acl_state;
  1059. aclps = acl_ps;
  1060. aclpv = acl_pv;
  1061. }
  1062. /*
  1063. ** code supplied by user is placed in this switch
  1064. */
  1065. switch( acltmp )
  1066. {
  1067. case 3:
  1068. # line 266 "acltext.y"
  1069. {
  1070. PERM_FREE(aclpvt[-0].string);
  1071. } break;
  1072. case 8:
  1073. # line 286 "acltext.y"
  1074. {
  1075. acl_free_args(curr_args_list);
  1076. } break;
  1077. case 9:
  1078. # line 292 "acltext.y"
  1079. {
  1080. curr_acl = ACL_AclNew(NULL, aclpvt[-0].string);
  1081. PERM_FREE(aclpvt[-0].string);
  1082. if ( ACL_ListAppend(NULL, curr_acl_list, curr_acl, 0) < 0 ) {
  1083. aclerror("Couldn't add ACL to list.");
  1084. return(-1);
  1085. }
  1086. acl_clear_args(curr_args_list);
  1087. use_generic_rights = 0;
  1088. if (strstr(curr_acl->tag, "READ")) {
  1089. use_generic_rights++;
  1090. acl_add_arg(curr_args_list, PERM_STRDUP("read"));
  1091. acl_add_arg(curr_args_list, PERM_STRDUP("execute"));
  1092. acl_add_arg(curr_args_list, PERM_STRDUP("list"));
  1093. acl_add_arg(curr_args_list, PERM_STRDUP("info"));
  1094. } if (strstr(curr_acl->tag, "WRITE")) {
  1095. use_generic_rights++;
  1096. acl_add_arg(curr_args_list, PERM_STRDUP("write"));
  1097. acl_add_arg(curr_args_list, PERM_STRDUP("delete"));
  1098. }
  1099. } break;
  1100. case 10:
  1101. # line 314 "acltext.y"
  1102. {
  1103. curr_acl = ACL_AclNew(NULL, aclpvt[-0].string);
  1104. PERM_FREE(aclpvt[-0].string);
  1105. if ( ACL_ListAppend(NULL, curr_acl_list, curr_acl, 0) < 0 ) {
  1106. aclerror("Couldn't add ACL to list.");
  1107. return(-1);
  1108. }
  1109. acl_clear_args(curr_args_list);
  1110. use_generic_rights = 0;
  1111. if (strstr(curr_acl->tag, "READ")) {
  1112. use_generic_rights++;
  1113. acl_add_arg(curr_args_list, PERM_STRDUP("read"));
  1114. acl_add_arg(curr_args_list, PERM_STRDUP("execute"));
  1115. acl_add_arg(curr_args_list, PERM_STRDUP("list"));
  1116. acl_add_arg(curr_args_list, PERM_STRDUP("info"));
  1117. } if (strstr(curr_acl->tag, "WRITE")) {
  1118. use_generic_rights++;
  1119. acl_add_arg(curr_args_list, PERM_STRDUP("write"));
  1120. acl_add_arg(curr_args_list, PERM_STRDUP("delete"));
  1121. }
  1122. } break;
  1123. case 13:
  1124. # line 342 "acltext.y"
  1125. {
  1126. char acl_tmp_arg[255];
  1127. char *acl_new_arg;
  1128. if (!use_generic_rights) {
  1129. acl_string_lower(aclpvt[-0].string);
  1130. snprintf(acl_tmp_arg, sizeof(acl_tmp_arg), "http_%s", aclpvt[-0].string);
  1131. acl_tmp_arg[sizeof(acl_tmp_arg)-1] = '\0';
  1132. PERM_FREE(aclpvt[-0].string);
  1133. acl_new_arg = PERM_STRDUP(acl_tmp_arg);
  1134. acl_add_arg(curr_args_list, acl_new_arg);
  1135. } else {
  1136. PERM_FREE(aclpvt[-0].string);
  1137. }
  1138. } break;
  1139. case 14:
  1140. # line 358 "acltext.y"
  1141. {
  1142. if (!use_generic_rights) {
  1143. acl_add_arg(curr_args_list, aclpvt[-0].string);
  1144. } else {
  1145. PERM_FREE(aclpvt[-0].string);
  1146. }
  1147. } break;
  1148. case 19:
  1149. # line 376 "acltext.y"
  1150. {
  1151. if ( ACL_ExprSetPFlags(NULL, curr_expr,
  1152. ACL_PFLAG_ABSOLUTE) < 0 ) {
  1153. aclerror("Could not set authorization processing flags");
  1154. return(-1);
  1155. }
  1156. } break;
  1157. case 22:
  1158. # line 388 "acltext.y"
  1159. {
  1160. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_ALLOW) ;
  1161. if ( curr_expr == NULL ) {
  1162. aclerror("ACL_ExprNew(allow) failed");
  1163. return(-1);
  1164. }
  1165. acl_clear_args(curr_user_list);
  1166. acl_clear_args(curr_ip_dns_list);
  1167. } break;
  1168. case 23:
  1169. # line 398 "acltext.y"
  1170. {
  1171. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_DENY) ;
  1172. if ( curr_expr == NULL ) {
  1173. aclerror("ACL_ExprNew(allow) failed");
  1174. return(-1);
  1175. }
  1176. acl_clear_args(curr_user_list);
  1177. acl_clear_args(curr_ip_dns_list);
  1178. } break;
  1179. case 24:
  1180. # line 411 "acltext.y"
  1181. {
  1182. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_AUTH) ;
  1183. if ( curr_expr == NULL ) {
  1184. aclerror("ACL_ExprNew(auth) failed");
  1185. return(-1);
  1186. }
  1187. if ( ACL_ExprSetPFlags(NULL, curr_expr,
  1188. ACL_PFLAG_ABSOLUTE) < 0 ) {
  1189. aclerror("Could not set authorization processing flags");
  1190. return(-1);
  1191. }
  1192. curr_auth_info = PListCreate(NULL, ACL_ATTR_INDEX_MAX, 0, 0);
  1193. if ( ACL_ExprAddAuthInfo(curr_expr, curr_auth_info) < 0 ) {
  1194. aclerror("Could not set authorization info");
  1195. return(-1);
  1196. }
  1197. } break;
  1198. case 26:
  1199. # line 430 "acltext.y"
  1200. {
  1201. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_AUTH) ;
  1202. if ( curr_expr == NULL ) {
  1203. aclerror("ACL_ExprNew(auth) failed");
  1204. return(-1);
  1205. }
  1206. curr_auth_info = PListCreate(NULL, ACL_ATTR_INDEX_MAX, 0, 0);
  1207. if ( ACL_ExprAddAuthInfo(curr_expr, curr_auth_info) < 0 ) {
  1208. aclerror("Could not set authorization info");
  1209. return(-1);
  1210. }
  1211. } break;
  1212. case 28:
  1213. # line 446 "acltext.y"
  1214. {
  1215. if ( acl_set_users_or_groups(curr_expr, curr_user_list) < 0 ) {
  1216. aclerror("acl_set_users_or_groups() failed");
  1217. return(-1);
  1218. }
  1219. if ( acl_set_ip_dns(curr_expr, curr_ip_dns_list) < 0 ) {
  1220. aclerror("acl_set_ip_dns() failed");
  1221. return(-1);
  1222. }
  1223. if ( ACL_ExprAnd(NULL, curr_expr) < 0 ) {
  1224. aclerror("ACL_ExprAnd() failed");
  1225. return(-1);
  1226. }
  1227. if ( acl_set_args(curr_expr, curr_args_list) < 0 ) {
  1228. aclerror("acl_set_args() failed");
  1229. return(-1);
  1230. }
  1231. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1232. aclerror("Could not add authorization");
  1233. return(-1);
  1234. }
  1235. } break;
  1236. case 29:
  1237. # line 473 "acltext.y"
  1238. {
  1239. if ( acl_set_users_or_groups(curr_expr, curr_user_list) < 0 ) {
  1240. aclerror("acl_set_users_or_groups() failed");
  1241. return(-1);
  1242. }
  1243. if ( acl_set_args(curr_expr, curr_args_list) < 0 ) {
  1244. aclerror("acl_set_args() failed");
  1245. return(-1);
  1246. }
  1247. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1248. aclerror("Could not add authorization");
  1249. return(-1);
  1250. }
  1251. } break;
  1252. case 34:
  1253. # line 500 "acltext.y"
  1254. {
  1255. acl_add_arg(curr_user_list, aclpvt[-0].string);
  1256. } break;
  1257. case 35:
  1258. # line 504 "acltext.y"
  1259. {
  1260. acl_add_arg(curr_user_list, aclpvt[-0].string);
  1261. } break;
  1262. case 39:
  1263. # line 516 "acltext.y"
  1264. {
  1265. acl_add_arg(curr_ip_dns_list, aclpvt[-0].string);
  1266. } break;
  1267. case 40:
  1268. # line 520 "acltext.y"
  1269. {
  1270. acl_add_arg(curr_ip_dns_list, aclpvt[-0].string);
  1271. } break;
  1272. case 41:
  1273. # line 526 "acltext.y"
  1274. {
  1275. char tmp_str[255];
  1276. util_sprintf(tmp_str, "%s+%s", aclpvt[-1].string, aclpvt[-0].string);
  1277. PERM_FREE(aclpvt[-1].string);
  1278. PERM_FREE(aclpvt[-0].string);
  1279. acl_add_arg(curr_ip_dns_list, PERM_STRDUP(tmp_str));
  1280. } break;
  1281. case 46:
  1282. # line 543 "acltext.y"
  1283. {
  1284. if ( ACL_ExprAddArg(NULL, curr_expr, "user") < 0 ) {
  1285. aclerror("ACL_ExprAddArg() failed");
  1286. return(-1);
  1287. }
  1288. if ( ACL_ExprAddArg(NULL, curr_expr, "group") < 0 ) {
  1289. aclerror("ACL_ExprAddArg() failed");
  1290. return(-1);
  1291. }
  1292. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1293. aclerror("Could not add authorization");
  1294. return(-1);
  1295. }
  1296. } break;
  1297. case 47:
  1298. # line 562 "acltext.y"
  1299. {
  1300. acl_string_lower(aclpvt[-2].string);
  1301. if (strcmp(aclpvt[-2].string, "database") == 0) {
  1302. PERM_FREE(aclpvt[-2].string);
  1303. PERM_FREE(aclpvt[-1].string);
  1304. } else {
  1305. if ( PListInitProp(curr_auth_info,
  1306. ACL_Attr2Index(aclpvt[-2].string), aclpvt[-2].string, aclpvt[-1].string, NULL) < 0 ) {
  1307. }
  1308. PERM_FREE(aclpvt[-2].string);
  1309. }
  1310. } break;
  1311. case 48:
  1312. # line 575 "acltext.y"
  1313. {
  1314. acl_string_lower(aclpvt[-2].string);
  1315. if (strcmp(aclpvt[-2].string, "database") == 0) {
  1316. PERM_FREE(aclpvt[-2].string);
  1317. PERM_FREE(aclpvt[-1].string);
  1318. } else {
  1319. if ( PListInitProp(curr_auth_info,
  1320. ACL_Attr2Index(aclpvt[-2].string), aclpvt[-2].string, aclpvt[-1].string, NULL) < 0 ) {
  1321. }
  1322. PERM_FREE(aclpvt[-2].string);
  1323. }
  1324. } break;
  1325. case 56:
  1326. # line 611 "acltext.y"
  1327. {
  1328. curr_acl = ACL_AclNew(NULL, aclpvt[-0].string);
  1329. PERM_FREE(aclpvt[-0].string);
  1330. if ( ACL_ListAppend(NULL, curr_acl_list, curr_acl, 0) < 0 ) {
  1331. aclerror("Couldn't add ACL to list.");
  1332. return(-1);
  1333. }
  1334. } break;
  1335. case 57:
  1336. # line 620 "acltext.y"
  1337. {
  1338. curr_acl = ACL_AclNew(NULL, aclpvt[-0].string);
  1339. PERM_FREE(aclpvt[-0].string);
  1340. if ( ACL_ListAppend(NULL, curr_acl_list, curr_acl, 0) < 0 ) {
  1341. aclerror("Couldn't add ACL to list.");
  1342. return(-1);
  1343. }
  1344. } break;
  1345. case 63:
  1346. # line 641 "acltext.y"
  1347. {
  1348. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_RESPONSE) ;
  1349. if ( curr_expr == NULL ) {
  1350. aclerror("ACL_ExprNew(deny) failed");
  1351. return(-1);
  1352. }
  1353. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1354. aclerror("Could not add authorization");
  1355. return(-1);
  1356. }
  1357. if ( ACL_ExprSetPFlags(NULL, curr_expr,
  1358. ACL_PFLAG_ABSOLUTE) < 0 ) {
  1359. aclerror("Could not set deny processing flags");
  1360. return(-1);
  1361. }
  1362. } break;
  1363. case 65:
  1364. # line 659 "acltext.y"
  1365. {
  1366. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_RESPONSE) ;
  1367. if ( curr_expr == NULL ) {
  1368. aclerror("ACL_ExprNew(deny) failed");
  1369. return(-1);
  1370. }
  1371. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1372. aclerror("Could not add authorization");
  1373. return(-1);
  1374. }
  1375. } break;
  1376. case 67:
  1377. # line 674 "acltext.y"
  1378. {
  1379. acl_string_lower(aclpvt[-2].string);
  1380. if ( ACL_ExprSetDenyWith(NULL, curr_expr,
  1381. aclpvt[-2].string, aclpvt[-0].string) < 0 ) {
  1382. aclerror("ACL_ExprSetDenyWith() failed");
  1383. return(-1);
  1384. }
  1385. PERM_FREE(aclpvt[-2].string);
  1386. PERM_FREE(aclpvt[-0].string);
  1387. } break;
  1388. case 68:
  1389. # line 687 "acltext.y"
  1390. {
  1391. pflags = 0;
  1392. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_AUTH) ;
  1393. if ( curr_expr == NULL ) {
  1394. aclerror("ACL_ExprNew(allow) failed");
  1395. return(-1);
  1396. }
  1397. curr_auth_info = PListCreate(NULL, ACL_ATTR_INDEX_MAX, 0, 0);
  1398. if ( ACL_ExprAddAuthInfo(curr_expr, curr_auth_info) < 0 ) {
  1399. aclerror("Could not set authorization info");
  1400. return(-1);
  1401. }
  1402. } break;
  1403. case 69:
  1404. # line 701 "acltext.y"
  1405. {
  1406. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1407. aclerror("Could not add authorization");
  1408. return(-1);
  1409. }
  1410. } break;
  1411. case 72:
  1412. # line 713 "acltext.y"
  1413. {
  1414. acl_string_lower(aclpvt[-0].string);
  1415. if ( ACL_ExprAddArg(NULL, curr_expr, aclpvt[-0].string) < 0 ) {
  1416. aclerror("ACL_ExprAddArg() failed");
  1417. return(-1);
  1418. }
  1419. PERM_FREE(aclpvt[-0].string);
  1420. } break;
  1421. case 75:
  1422. # line 728 "acltext.y"
  1423. {
  1424. acl_string_lower(aclpvt[-2].string);
  1425. if ( PListInitProp(curr_auth_info,
  1426. ACL_Attr2Index(aclpvt[-2].string), aclpvt[-2].string, aclpvt[-0].string, NULL) < 0 ) {
  1427. }
  1428. PERM_FREE(aclpvt[-2].string);
  1429. } break;
  1430. case 76:
  1431. # line 736 "acltext.y"
  1432. {
  1433. acl_string_lower(aclpvt[-2].string);
  1434. if ( PListInitProp(curr_auth_info,
  1435. ACL_Attr2Index(aclpvt[-2].string), aclpvt[-2].string, aclpvt[-0].string, NULL) < 0 ) {
  1436. }
  1437. PERM_FREE(aclpvt[-2].string);
  1438. } break;
  1439. case 77:
  1440. # line 746 "acltext.y"
  1441. {
  1442. pflags = 0;
  1443. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_ALLOW) ;
  1444. if ( curr_expr == NULL ) {
  1445. aclerror("ACL_ExprNew(allow) failed");
  1446. return(-1);
  1447. }
  1448. } break;
  1449. case 79:
  1450. # line 756 "acltext.y"
  1451. {
  1452. pflags = 0;
  1453. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_DENY) ;
  1454. if ( curr_expr == NULL ) {
  1455. aclerror("ACL_ExprNew(deny) failed");
  1456. return(-1);
  1457. }
  1458. } break;
  1459. case 81:
  1460. # line 768 "acltext.y"
  1461. {
  1462. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1463. aclerror("Could not add authorization");
  1464. return(-1);
  1465. }
  1466. } break;
  1467. case 82:
  1468. # line 775 "acltext.y"
  1469. {
  1470. if ( ACL_ExprSetPFlags (NULL, curr_expr, pflags) < 0 ) {
  1471. aclerror("Could not set authorization processing flags");
  1472. return(-1);
  1473. }
  1474. #ifdef DEBUG
  1475. if ( ACL_ExprDisplay(curr_expr) < 0 ) {
  1476. aclerror("ACL_ExprDisplay() failed");
  1477. return(-1);
  1478. }
  1479. printf("Parsed authorization.\n");
  1480. #endif
  1481. } break;
  1482. case 85:
  1483. # line 795 "acltext.y"
  1484. {
  1485. pflags = ACL_PFLAG_ABSOLUTE;
  1486. } break;
  1487. case 86:
  1488. # line 799 "acltext.y"
  1489. {
  1490. pflags = ACL_PFLAG_ABSOLUTE;
  1491. } break;
  1492. case 87:
  1493. # line 803 "acltext.y"
  1494. {
  1495. pflags = ACL_PFLAG_CONTENT;
  1496. } break;
  1497. case 88:
  1498. # line 807 "acltext.y"
  1499. {
  1500. pflags = ACL_PFLAG_CONTENT;
  1501. } break;
  1502. case 89:
  1503. # line 811 "acltext.y"
  1504. {
  1505. pflags = ACL_PFLAG_TERMINAL;
  1506. } break;
  1507. case 90:
  1508. # line 815 "acltext.y"
  1509. {
  1510. pflags = ACL_PFLAG_TERMINAL;
  1511. } break;
  1512. case 91:
  1513. # line 821 "acltext.y"
  1514. {
  1515. pflags |= ACL_PFLAG_CONTENT;
  1516. } break;
  1517. case 92:
  1518. # line 825 "acltext.y"
  1519. {
  1520. pflags |= ACL_PFLAG_ABSOLUTE;
  1521. } break;
  1522. case 93:
  1523. # line 829 "acltext.y"
  1524. {
  1525. pflags |= ACL_PFLAG_ABSOLUTE | ACL_PFLAG_CONTENT;
  1526. } break;
  1527. case 94:
  1528. # line 833 "acltext.y"
  1529. {
  1530. pflags |= ACL_PFLAG_ABSOLUTE | ACL_PFLAG_CONTENT;
  1531. } break;
  1532. case 95:
  1533. # line 839 "acltext.y"
  1534. {
  1535. pflags |= ACL_PFLAG_CONTENT;
  1536. } break;
  1537. case 96:
  1538. # line 843 "acltext.y"
  1539. {
  1540. pflags |= ACL_PFLAG_TERMINAL;
  1541. } break;
  1542. case 97:
  1543. # line 847 "acltext.y"
  1544. {
  1545. pflags |= ACL_PFLAG_TERMINAL | ACL_PFLAG_CONTENT;
  1546. } break;
  1547. case 98:
  1548. # line 851 "acltext.y"
  1549. {
  1550. pflags |= ACL_PFLAG_TERMINAL | ACL_PFLAG_CONTENT;
  1551. } break;
  1552. case 99:
  1553. # line 857 "acltext.y"
  1554. {
  1555. pflags |= ACL_PFLAG_ABSOLUTE;
  1556. } break;
  1557. case 100:
  1558. # line 861 "acltext.y"
  1559. {
  1560. pflags |= ACL_PFLAG_TERMINAL;
  1561. } break;
  1562. case 101:
  1563. # line 865 "acltext.y"
  1564. {
  1565. pflags |= ACL_PFLAG_TERMINAL | ACL_PFLAG_ABSOLUTE;
  1566. } break;
  1567. case 102:
  1568. # line 869 "acltext.y"
  1569. {
  1570. pflags |= ACL_PFLAG_TERMINAL | ACL_PFLAG_ABSOLUTE;
  1571. } break;
  1572. case 105:
  1573. # line 879 "acltext.y"
  1574. {
  1575. acl_string_lower(aclpvt[-0].string);
  1576. if ( ACL_ExprAddArg(NULL, curr_expr, aclpvt[-0].string) < 0 ) {
  1577. aclerror("ACL_ExprAddArg() failed");
  1578. return(-1);
  1579. }
  1580. PERM_FREE( aclpvt[-0].string );
  1581. } break;
  1582. case 107:
  1583. # line 891 "acltext.y"
  1584. {
  1585. if ( ACL_ExprAnd(NULL, curr_expr) < 0 ) {
  1586. aclerror("ACL_ExprAnd() failed");
  1587. return(-1);
  1588. }
  1589. } break;
  1590. case 108:
  1591. # line 898 "acltext.y"
  1592. {
  1593. if ( ACL_ExprOr(NULL, curr_expr) < 0 ) {
  1594. aclerror("ACL_ExprOr() failed");
  1595. return(-1);
  1596. }
  1597. } break;
  1598. case 111:
  1599. # line 909 "acltext.y"
  1600. {
  1601. if ( ACL_ExprNot(NULL, curr_expr) < 0 ) {
  1602. aclerror("ACL_ExprNot() failed");
  1603. return(-1);
  1604. }
  1605. } break;
  1606. case 112:
  1607. # line 918 "acltext.y"
  1608. {
  1609. acl_string_lower(aclpvt[-2].string);
  1610. if ( ACL_ExprTerm(NULL, curr_expr,
  1611. aclpvt[-2].string, (CmpOp_t) aclpvt[-1].ival, aclpvt[-0].string) < 0 ) {
  1612. aclerror("ACL_ExprTerm() failed");
  1613. PERM_FREE(aclpvt[-2].string);
  1614. PERM_FREE(aclpvt[-0].string);
  1615. return(-1);
  1616. }
  1617. PERM_FREE(aclpvt[-2].string);
  1618. PERM_FREE(aclpvt[-0].string);
  1619. } break;
  1620. case 113:
  1621. # line 931 "acltext.y"
  1622. {
  1623. acl_string_lower(aclpvt[-2].string);
  1624. if ( ACL_ExprTerm(NULL, curr_expr,
  1625. aclpvt[-2].string, (CmpOp_t) aclpvt[-1].ival, aclpvt[-0].string) < 0 ) {
  1626. aclerror("ACL_ExprTerm() failed");
  1627. PERM_FREE(aclpvt[-2].string);
  1628. PERM_FREE(aclpvt[-0].string);
  1629. return(-1);
  1630. }
  1631. PERM_FREE(aclpvt[-2].string);
  1632. PERM_FREE(aclpvt[-0].string);
  1633. } break;
  1634. }
  1635. goto aclstack; /* reset registers in driver code */
  1636. }