acl.tab.cpp 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  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. while ( ( *aclxi != -1 ) ||
  887. ( aclxi[1] != acl_state ) )
  888. {
  889. aclxi += 2;
  890. }
  891. while ( ( *(aclxi += 2) >= 0 ) &&
  892. ( *aclxi != aclchar ) )
  893. ;
  894. if ( ( acl_n = aclxi[1] ) < 0 )
  895. ACLACCEPT;
  896. }
  897. }
  898. /*
  899. ** check for syntax error
  900. */
  901. if ( acl_n == 0 ) /* have an error */
  902. {
  903. /* no worry about speed here! */
  904. switch ( aclerrflag )
  905. {
  906. case 0: /* new error */
  907. aclerror( "syntax error" );
  908. goto skip_init;
  909. aclerrlab:
  910. /*
  911. ** get globals into registers.
  912. ** we have a user generated syntax type error
  913. */
  914. acl_pv = aclpv;
  915. acl_ps = aclps;
  916. acl_state = aclstate;
  917. skip_init:
  918. aclnerrs++;
  919. /* FALLTHRU */
  920. case 1:
  921. case 2: /* incompletely recovered error */
  922. /* try again... */
  923. aclerrflag = 3;
  924. /*
  925. ** find state where "error" is a legal
  926. ** shift action
  927. */
  928. while ( acl_ps >= acls )
  929. {
  930. acl_n = aclpact[ *acl_ps ] + ACLERRCODE;
  931. if ( acl_n >= 0 && acl_n < ACLLAST &&
  932. aclchk[aclact[acl_n]] == ACLERRCODE) {
  933. /*
  934. ** simulate shift of "error"
  935. */
  936. acl_state = aclact[ acl_n ];
  937. goto acl_stack;
  938. }
  939. /*
  940. ** current state has no shift on
  941. ** "error", pop stack
  942. */
  943. #if ACLDEBUG
  944. # define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  945. if ( acldebug )
  946. printf( _POP_, *acl_ps,
  947. acl_ps[-1] );
  948. # undef _POP_
  949. #endif
  950. acl_ps--;
  951. acl_pv--;
  952. }
  953. /*
  954. ** there is no state on stack with "error" as
  955. ** a valid shift. give up.
  956. */
  957. ACLABORT;
  958. case 3: /* no shift yet; eat a token */
  959. #if ACLDEBUG
  960. /*
  961. ** if debugging, look up token in list of
  962. ** pairs. 0 and negative shouldn't occur,
  963. ** but since timing doesn't matter when
  964. ** debugging, it doesn't hurt to leave the
  965. ** tests here.
  966. */
  967. if ( acldebug )
  968. {
  969. register int acl_i;
  970. printf( "Error recovery discards " );
  971. if ( aclchar == 0 )
  972. printf( "token end-of-file\n" );
  973. else if ( aclchar < 0 )
  974. printf( "token -none-\n" );
  975. else
  976. {
  977. for ( acl_i = 0;
  978. acltoks[acl_i].t_val >= 0;
  979. acl_i++ )
  980. {
  981. if ( acltoks[acl_i].t_val
  982. == aclchar )
  983. {
  984. break;
  985. }
  986. }
  987. printf( "token %s\n",
  988. acltoks[acl_i].t_name );
  989. }
  990. }
  991. #endif /* ACLDEBUG */
  992. if ( aclchar == 0 ) /* reached EOF. quit */
  993. ACLABORT;
  994. aclchar = -1;
  995. goto acl_newstate;
  996. }
  997. }/* end if ( acl_n == 0 ) */
  998. /*
  999. ** reduction by production acl_n
  1000. ** put stack tops, etc. so things right after switch
  1001. */
  1002. #if ACLDEBUG
  1003. /*
  1004. ** if debugging, print the string that is the user's
  1005. ** specification of the reduction which is just about
  1006. ** to be done.
  1007. */
  1008. if ( acldebug )
  1009. printf( "Reduce by (%d) \"%s\"\n",
  1010. acl_n, aclreds[ acl_n ] );
  1011. #endif
  1012. acltmp = acl_n; /* value to switch over */
  1013. aclpvt = acl_pv; /* $vars top of value stack */
  1014. /*
  1015. ** Look in goto table for next state
  1016. ** Sorry about using acl_state here as temporary
  1017. ** register variable, but why not, if it works...
  1018. ** If aclr2[ acl_n ] doesn't have the low order bit
  1019. ** set, then there is no action to be done for
  1020. ** this reduction. So, no saving & unsaving of
  1021. ** registers done. The only difference between the
  1022. ** code just after the if and the body of the if is
  1023. ** the goto acl_stack in the body. This way the test
  1024. ** can be made before the choice of what to do is needed.
  1025. */
  1026. {
  1027. /* length of production doubled with extra bit */
  1028. register int acl_len = aclr2[ acl_n ];
  1029. if ( !( acl_len & 01 ) )
  1030. {
  1031. acl_len >>= 1;
  1032. aclval = ( acl_pv -= acl_len )[1]; /* $$ = $1 */
  1033. acl_state = aclpgo[ acl_n = aclr1[ acl_n ] ] +
  1034. *( acl_ps -= acl_len ) + 1;
  1035. if ( acl_state >= ACLLAST ||
  1036. aclchk[ acl_state =
  1037. aclact[ acl_state ] ] != -acl_n )
  1038. {
  1039. acl_state = aclact[ aclpgo[ acl_n ] ];
  1040. }
  1041. goto acl_stack;
  1042. }
  1043. acl_len >>= 1;
  1044. aclval = ( acl_pv -= acl_len )[1]; /* $$ = $1 */
  1045. acl_state = aclpgo[ acl_n = aclr1[ acl_n ] ] +
  1046. *( acl_ps -= acl_len ) + 1;
  1047. if ( acl_state >= ACLLAST ||
  1048. aclchk[ acl_state = aclact[ acl_state ] ] != -acl_n )
  1049. {
  1050. acl_state = aclact[ aclpgo[ acl_n ] ];
  1051. }
  1052. }
  1053. /* save until reenter driver code */
  1054. aclstate = acl_state;
  1055. aclps = acl_ps;
  1056. aclpv = acl_pv;
  1057. }
  1058. /*
  1059. ** code supplied by user is placed in this switch
  1060. */
  1061. switch( acltmp )
  1062. {
  1063. case 3:
  1064. # line 266 "acltext.y"
  1065. {
  1066. PERM_FREE(aclpvt[-0].string);
  1067. } break;
  1068. case 8:
  1069. # line 286 "acltext.y"
  1070. {
  1071. acl_free_args(curr_args_list);
  1072. } break;
  1073. case 9:
  1074. # line 292 "acltext.y"
  1075. {
  1076. curr_acl = ACL_AclNew(NULL, aclpvt[-0].string);
  1077. PERM_FREE(aclpvt[-0].string);
  1078. if ( ACL_ListAppend(NULL, curr_acl_list, curr_acl, 0) < 0 ) {
  1079. aclerror("Couldn't add ACL to list.");
  1080. return(-1);
  1081. }
  1082. acl_clear_args(curr_args_list);
  1083. use_generic_rights = 0;
  1084. if (strstr(curr_acl->tag, "READ")) {
  1085. use_generic_rights++;
  1086. acl_add_arg(curr_args_list, PERM_STRDUP("read"));
  1087. acl_add_arg(curr_args_list, PERM_STRDUP("execute"));
  1088. acl_add_arg(curr_args_list, PERM_STRDUP("list"));
  1089. acl_add_arg(curr_args_list, PERM_STRDUP("info"));
  1090. } if (strstr(curr_acl->tag, "WRITE")) {
  1091. use_generic_rights++;
  1092. acl_add_arg(curr_args_list, PERM_STRDUP("write"));
  1093. acl_add_arg(curr_args_list, PERM_STRDUP("delete"));
  1094. }
  1095. } break;
  1096. case 10:
  1097. # line 314 "acltext.y"
  1098. {
  1099. curr_acl = ACL_AclNew(NULL, aclpvt[-0].string);
  1100. PERM_FREE(aclpvt[-0].string);
  1101. if ( ACL_ListAppend(NULL, curr_acl_list, curr_acl, 0) < 0 ) {
  1102. aclerror("Couldn't add ACL to list.");
  1103. return(-1);
  1104. }
  1105. acl_clear_args(curr_args_list);
  1106. use_generic_rights = 0;
  1107. if (strstr(curr_acl->tag, "READ")) {
  1108. use_generic_rights++;
  1109. acl_add_arg(curr_args_list, PERM_STRDUP("read"));
  1110. acl_add_arg(curr_args_list, PERM_STRDUP("execute"));
  1111. acl_add_arg(curr_args_list, PERM_STRDUP("list"));
  1112. acl_add_arg(curr_args_list, PERM_STRDUP("info"));
  1113. } if (strstr(curr_acl->tag, "WRITE")) {
  1114. use_generic_rights++;
  1115. acl_add_arg(curr_args_list, PERM_STRDUP("write"));
  1116. acl_add_arg(curr_args_list, PERM_STRDUP("delete"));
  1117. }
  1118. } break;
  1119. case 13:
  1120. # line 342 "acltext.y"
  1121. {
  1122. char acl_tmp_arg[255];
  1123. char *acl_new_arg;
  1124. if (!use_generic_rights) {
  1125. acl_string_lower(aclpvt[-0].string);
  1126. strcpy(acl_tmp_arg, "http_");
  1127. strcat(acl_tmp_arg, aclpvt[-0].string);
  1128. PERM_FREE(aclpvt[-0].string);
  1129. acl_new_arg = PERM_STRDUP(acl_tmp_arg);
  1130. acl_add_arg(curr_args_list, acl_new_arg);
  1131. } else {
  1132. PERM_FREE(aclpvt[-0].string);
  1133. }
  1134. } break;
  1135. case 14:
  1136. # line 358 "acltext.y"
  1137. {
  1138. if (!use_generic_rights) {
  1139. acl_add_arg(curr_args_list, aclpvt[-0].string);
  1140. } else {
  1141. PERM_FREE(aclpvt[-0].string);
  1142. }
  1143. } break;
  1144. case 19:
  1145. # line 376 "acltext.y"
  1146. {
  1147. if ( ACL_ExprSetPFlags(NULL, curr_expr,
  1148. ACL_PFLAG_ABSOLUTE) < 0 ) {
  1149. aclerror("Could not set authorization processing flags");
  1150. return(-1);
  1151. }
  1152. } break;
  1153. case 22:
  1154. # line 388 "acltext.y"
  1155. {
  1156. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_ALLOW) ;
  1157. if ( curr_expr == NULL ) {
  1158. aclerror("ACL_ExprNew(allow) failed");
  1159. return(-1);
  1160. }
  1161. acl_clear_args(curr_user_list);
  1162. acl_clear_args(curr_ip_dns_list);
  1163. } break;
  1164. case 23:
  1165. # line 398 "acltext.y"
  1166. {
  1167. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_DENY) ;
  1168. if ( curr_expr == NULL ) {
  1169. aclerror("ACL_ExprNew(allow) failed");
  1170. return(-1);
  1171. }
  1172. acl_clear_args(curr_user_list);
  1173. acl_clear_args(curr_ip_dns_list);
  1174. } break;
  1175. case 24:
  1176. # line 411 "acltext.y"
  1177. {
  1178. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_AUTH) ;
  1179. if ( curr_expr == NULL ) {
  1180. aclerror("ACL_ExprNew(auth) failed");
  1181. return(-1);
  1182. }
  1183. if ( ACL_ExprSetPFlags(NULL, curr_expr,
  1184. ACL_PFLAG_ABSOLUTE) < 0 ) {
  1185. aclerror("Could not set authorization processing flags");
  1186. return(-1);
  1187. }
  1188. curr_auth_info = PListCreate(NULL, ACL_ATTR_INDEX_MAX, 0, 0);
  1189. if ( ACL_ExprAddAuthInfo(curr_expr, curr_auth_info) < 0 ) {
  1190. aclerror("Could not set authorization info");
  1191. return(-1);
  1192. }
  1193. } break;
  1194. case 26:
  1195. # line 430 "acltext.y"
  1196. {
  1197. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_AUTH) ;
  1198. if ( curr_expr == NULL ) {
  1199. aclerror("ACL_ExprNew(auth) failed");
  1200. return(-1);
  1201. }
  1202. curr_auth_info = PListCreate(NULL, ACL_ATTR_INDEX_MAX, 0, 0);
  1203. if ( ACL_ExprAddAuthInfo(curr_expr, curr_auth_info) < 0 ) {
  1204. aclerror("Could not set authorization info");
  1205. return(-1);
  1206. }
  1207. } break;
  1208. case 28:
  1209. # line 446 "acltext.y"
  1210. {
  1211. if ( acl_set_users_or_groups(curr_expr, curr_user_list) < 0 ) {
  1212. aclerror("acl_set_users_or_groups() failed");
  1213. return(-1);
  1214. }
  1215. if ( acl_set_ip_dns(curr_expr, curr_ip_dns_list) < 0 ) {
  1216. aclerror("acl_set_ip_dns() failed");
  1217. return(-1);
  1218. }
  1219. if ( ACL_ExprAnd(NULL, curr_expr) < 0 ) {
  1220. aclerror("ACL_ExprAnd() failed");
  1221. return(-1);
  1222. }
  1223. if ( acl_set_args(curr_expr, curr_args_list) < 0 ) {
  1224. aclerror("acl_set_args() failed");
  1225. return(-1);
  1226. }
  1227. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1228. aclerror("Could not add authorization");
  1229. return(-1);
  1230. }
  1231. } break;
  1232. case 29:
  1233. # line 473 "acltext.y"
  1234. {
  1235. if ( acl_set_users_or_groups(curr_expr, curr_user_list) < 0 ) {
  1236. aclerror("acl_set_users_or_groups() failed");
  1237. return(-1);
  1238. }
  1239. if ( acl_set_args(curr_expr, curr_args_list) < 0 ) {
  1240. aclerror("acl_set_args() failed");
  1241. return(-1);
  1242. }
  1243. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1244. aclerror("Could not add authorization");
  1245. return(-1);
  1246. }
  1247. } break;
  1248. case 34:
  1249. # line 500 "acltext.y"
  1250. {
  1251. acl_add_arg(curr_user_list, aclpvt[-0].string);
  1252. } break;
  1253. case 35:
  1254. # line 504 "acltext.y"
  1255. {
  1256. acl_add_arg(curr_user_list, aclpvt[-0].string);
  1257. } break;
  1258. case 39:
  1259. # line 516 "acltext.y"
  1260. {
  1261. acl_add_arg(curr_ip_dns_list, aclpvt[-0].string);
  1262. } break;
  1263. case 40:
  1264. # line 520 "acltext.y"
  1265. {
  1266. acl_add_arg(curr_ip_dns_list, aclpvt[-0].string);
  1267. } break;
  1268. case 41:
  1269. # line 526 "acltext.y"
  1270. {
  1271. char tmp_str[255];
  1272. util_sprintf(tmp_str, "%s+%s", aclpvt[-1].string, aclpvt[-0].string);
  1273. PERM_FREE(aclpvt[-1].string);
  1274. PERM_FREE(aclpvt[-0].string);
  1275. acl_add_arg(curr_ip_dns_list, PERM_STRDUP(tmp_str));
  1276. } break;
  1277. case 46:
  1278. # line 543 "acltext.y"
  1279. {
  1280. if ( ACL_ExprAddArg(NULL, curr_expr, "user") < 0 ) {
  1281. aclerror("ACL_ExprAddArg() failed");
  1282. return(-1);
  1283. }
  1284. if ( ACL_ExprAddArg(NULL, curr_expr, "group") < 0 ) {
  1285. aclerror("ACL_ExprAddArg() failed");
  1286. return(-1);
  1287. }
  1288. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1289. aclerror("Could not add authorization");
  1290. return(-1);
  1291. }
  1292. } break;
  1293. case 47:
  1294. # line 562 "acltext.y"
  1295. {
  1296. acl_string_lower(aclpvt[-2].string);
  1297. if (strcmp(aclpvt[-2].string, "database") == 0) {
  1298. PERM_FREE(aclpvt[-2].string);
  1299. PERM_FREE(aclpvt[-1].string);
  1300. } else {
  1301. if ( PListInitProp(curr_auth_info,
  1302. ACL_Attr2Index(aclpvt[-2].string), aclpvt[-2].string, aclpvt[-1].string, NULL) < 0 ) {
  1303. }
  1304. PERM_FREE(aclpvt[-2].string);
  1305. }
  1306. } break;
  1307. case 48:
  1308. # line 575 "acltext.y"
  1309. {
  1310. acl_string_lower(aclpvt[-2].string);
  1311. if (strcmp(aclpvt[-2].string, "database") == 0) {
  1312. PERM_FREE(aclpvt[-2].string);
  1313. PERM_FREE(aclpvt[-1].string);
  1314. } else {
  1315. if ( PListInitProp(curr_auth_info,
  1316. ACL_Attr2Index(aclpvt[-2].string), aclpvt[-2].string, aclpvt[-1].string, NULL) < 0 ) {
  1317. }
  1318. PERM_FREE(aclpvt[-2].string);
  1319. }
  1320. } break;
  1321. case 56:
  1322. # line 611 "acltext.y"
  1323. {
  1324. curr_acl = ACL_AclNew(NULL, aclpvt[-0].string);
  1325. PERM_FREE(aclpvt[-0].string);
  1326. if ( ACL_ListAppend(NULL, curr_acl_list, curr_acl, 0) < 0 ) {
  1327. aclerror("Couldn't add ACL to list.");
  1328. return(-1);
  1329. }
  1330. } break;
  1331. case 57:
  1332. # line 620 "acltext.y"
  1333. {
  1334. curr_acl = ACL_AclNew(NULL, aclpvt[-0].string);
  1335. PERM_FREE(aclpvt[-0].string);
  1336. if ( ACL_ListAppend(NULL, curr_acl_list, curr_acl, 0) < 0 ) {
  1337. aclerror("Couldn't add ACL to list.");
  1338. return(-1);
  1339. }
  1340. } break;
  1341. case 63:
  1342. # line 641 "acltext.y"
  1343. {
  1344. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_RESPONSE) ;
  1345. if ( curr_expr == NULL ) {
  1346. aclerror("ACL_ExprNew(deny) failed");
  1347. return(-1);
  1348. }
  1349. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1350. aclerror("Could not add authorization");
  1351. return(-1);
  1352. }
  1353. if ( ACL_ExprSetPFlags(NULL, curr_expr,
  1354. ACL_PFLAG_ABSOLUTE) < 0 ) {
  1355. aclerror("Could not set deny processing flags");
  1356. return(-1);
  1357. }
  1358. } break;
  1359. case 65:
  1360. # line 659 "acltext.y"
  1361. {
  1362. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_RESPONSE) ;
  1363. if ( curr_expr == NULL ) {
  1364. aclerror("ACL_ExprNew(deny) failed");
  1365. return(-1);
  1366. }
  1367. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1368. aclerror("Could not add authorization");
  1369. return(-1);
  1370. }
  1371. } break;
  1372. case 67:
  1373. # line 674 "acltext.y"
  1374. {
  1375. acl_string_lower(aclpvt[-2].string);
  1376. if ( ACL_ExprSetDenyWith(NULL, curr_expr,
  1377. aclpvt[-2].string, aclpvt[-0].string) < 0 ) {
  1378. aclerror("ACL_ExprSetDenyWith() failed");
  1379. return(-1);
  1380. }
  1381. PERM_FREE(aclpvt[-2].string);
  1382. PERM_FREE(aclpvt[-0].string);
  1383. } break;
  1384. case 68:
  1385. # line 687 "acltext.y"
  1386. {
  1387. pflags = 0;
  1388. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_AUTH) ;
  1389. if ( curr_expr == NULL ) {
  1390. aclerror("ACL_ExprNew(allow) failed");
  1391. return(-1);
  1392. }
  1393. curr_auth_info = PListCreate(NULL, ACL_ATTR_INDEX_MAX, 0, 0);
  1394. if ( ACL_ExprAddAuthInfo(curr_expr, curr_auth_info) < 0 ) {
  1395. aclerror("Could not set authorization info");
  1396. return(-1);
  1397. }
  1398. } break;
  1399. case 69:
  1400. # line 701 "acltext.y"
  1401. {
  1402. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1403. aclerror("Could not add authorization");
  1404. return(-1);
  1405. }
  1406. } break;
  1407. case 72:
  1408. # line 713 "acltext.y"
  1409. {
  1410. acl_string_lower(aclpvt[-0].string);
  1411. if ( ACL_ExprAddArg(NULL, curr_expr, aclpvt[-0].string) < 0 ) {
  1412. aclerror("ACL_ExprAddArg() failed");
  1413. return(-1);
  1414. }
  1415. PERM_FREE(aclpvt[-0].string);
  1416. } break;
  1417. case 75:
  1418. # line 728 "acltext.y"
  1419. {
  1420. acl_string_lower(aclpvt[-2].string);
  1421. if ( PListInitProp(curr_auth_info,
  1422. ACL_Attr2Index(aclpvt[-2].string), aclpvt[-2].string, aclpvt[-0].string, NULL) < 0 ) {
  1423. }
  1424. PERM_FREE(aclpvt[-2].string);
  1425. } break;
  1426. case 76:
  1427. # line 736 "acltext.y"
  1428. {
  1429. acl_string_lower(aclpvt[-2].string);
  1430. if ( PListInitProp(curr_auth_info,
  1431. ACL_Attr2Index(aclpvt[-2].string), aclpvt[-2].string, aclpvt[-0].string, NULL) < 0 ) {
  1432. }
  1433. PERM_FREE(aclpvt[-2].string);
  1434. } break;
  1435. case 77:
  1436. # line 746 "acltext.y"
  1437. {
  1438. pflags = 0;
  1439. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_ALLOW) ;
  1440. if ( curr_expr == NULL ) {
  1441. aclerror("ACL_ExprNew(allow) failed");
  1442. return(-1);
  1443. }
  1444. } break;
  1445. case 79:
  1446. # line 756 "acltext.y"
  1447. {
  1448. pflags = 0;
  1449. curr_expr = ACL_ExprNew(ACL_EXPR_TYPE_DENY) ;
  1450. if ( curr_expr == NULL ) {
  1451. aclerror("ACL_ExprNew(deny) failed");
  1452. return(-1);
  1453. }
  1454. } break;
  1455. case 81:
  1456. # line 768 "acltext.y"
  1457. {
  1458. if ( ACL_ExprAppend(NULL, curr_acl, curr_expr) < 0 ) {
  1459. aclerror("Could not add authorization");
  1460. return(-1);
  1461. }
  1462. } break;
  1463. case 82:
  1464. # line 775 "acltext.y"
  1465. {
  1466. if ( ACL_ExprSetPFlags (NULL, curr_expr, pflags) < 0 ) {
  1467. aclerror("Could not set authorization processing flags");
  1468. return(-1);
  1469. }
  1470. #ifdef DEBUG
  1471. if ( ACL_ExprDisplay(curr_expr) < 0 ) {
  1472. aclerror("ACL_ExprDisplay() failed");
  1473. return(-1);
  1474. }
  1475. printf("Parsed authorization.\n");
  1476. #endif
  1477. } break;
  1478. case 85:
  1479. # line 795 "acltext.y"
  1480. {
  1481. pflags = ACL_PFLAG_ABSOLUTE;
  1482. } break;
  1483. case 86:
  1484. # line 799 "acltext.y"
  1485. {
  1486. pflags = ACL_PFLAG_ABSOLUTE;
  1487. } break;
  1488. case 87:
  1489. # line 803 "acltext.y"
  1490. {
  1491. pflags = ACL_PFLAG_CONTENT;
  1492. } break;
  1493. case 88:
  1494. # line 807 "acltext.y"
  1495. {
  1496. pflags = ACL_PFLAG_CONTENT;
  1497. } break;
  1498. case 89:
  1499. # line 811 "acltext.y"
  1500. {
  1501. pflags = ACL_PFLAG_TERMINAL;
  1502. } break;
  1503. case 90:
  1504. # line 815 "acltext.y"
  1505. {
  1506. pflags = ACL_PFLAG_TERMINAL;
  1507. } break;
  1508. case 91:
  1509. # line 821 "acltext.y"
  1510. {
  1511. pflags |= ACL_PFLAG_CONTENT;
  1512. } break;
  1513. case 92:
  1514. # line 825 "acltext.y"
  1515. {
  1516. pflags |= ACL_PFLAG_ABSOLUTE;
  1517. } break;
  1518. case 93:
  1519. # line 829 "acltext.y"
  1520. {
  1521. pflags |= ACL_PFLAG_ABSOLUTE | ACL_PFLAG_CONTENT;
  1522. } break;
  1523. case 94:
  1524. # line 833 "acltext.y"
  1525. {
  1526. pflags |= ACL_PFLAG_ABSOLUTE | ACL_PFLAG_CONTENT;
  1527. } break;
  1528. case 95:
  1529. # line 839 "acltext.y"
  1530. {
  1531. pflags |= ACL_PFLAG_CONTENT;
  1532. } break;
  1533. case 96:
  1534. # line 843 "acltext.y"
  1535. {
  1536. pflags |= ACL_PFLAG_TERMINAL;
  1537. } break;
  1538. case 97:
  1539. # line 847 "acltext.y"
  1540. {
  1541. pflags |= ACL_PFLAG_TERMINAL | ACL_PFLAG_CONTENT;
  1542. } break;
  1543. case 98:
  1544. # line 851 "acltext.y"
  1545. {
  1546. pflags |= ACL_PFLAG_TERMINAL | ACL_PFLAG_CONTENT;
  1547. } break;
  1548. case 99:
  1549. # line 857 "acltext.y"
  1550. {
  1551. pflags |= ACL_PFLAG_ABSOLUTE;
  1552. } break;
  1553. case 100:
  1554. # line 861 "acltext.y"
  1555. {
  1556. pflags |= ACL_PFLAG_TERMINAL;
  1557. } break;
  1558. case 101:
  1559. # line 865 "acltext.y"
  1560. {
  1561. pflags |= ACL_PFLAG_TERMINAL | ACL_PFLAG_ABSOLUTE;
  1562. } break;
  1563. case 102:
  1564. # line 869 "acltext.y"
  1565. {
  1566. pflags |= ACL_PFLAG_TERMINAL | ACL_PFLAG_ABSOLUTE;
  1567. } break;
  1568. case 105:
  1569. # line 879 "acltext.y"
  1570. {
  1571. acl_string_lower(aclpvt[-0].string);
  1572. if ( ACL_ExprAddArg(NULL, curr_expr, aclpvt[-0].string) < 0 ) {
  1573. aclerror("ACL_ExprAddArg() failed");
  1574. return(-1);
  1575. }
  1576. PERM_FREE( aclpvt[-0].string );
  1577. } break;
  1578. case 107:
  1579. # line 891 "acltext.y"
  1580. {
  1581. if ( ACL_ExprAnd(NULL, curr_expr) < 0 ) {
  1582. aclerror("ACL_ExprAnd() failed");
  1583. return(-1);
  1584. }
  1585. } break;
  1586. case 108:
  1587. # line 898 "acltext.y"
  1588. {
  1589. if ( ACL_ExprOr(NULL, curr_expr) < 0 ) {
  1590. aclerror("ACL_ExprOr() failed");
  1591. return(-1);
  1592. }
  1593. } break;
  1594. case 111:
  1595. # line 909 "acltext.y"
  1596. {
  1597. if ( ACL_ExprNot(NULL, curr_expr) < 0 ) {
  1598. aclerror("ACL_ExprNot() failed");
  1599. return(-1);
  1600. }
  1601. } break;
  1602. case 112:
  1603. # line 918 "acltext.y"
  1604. {
  1605. acl_string_lower(aclpvt[-2].string);
  1606. if ( ACL_ExprTerm(NULL, curr_expr,
  1607. aclpvt[-2].string, (CmpOp_t) aclpvt[-1].ival, aclpvt[-0].string) < 0 ) {
  1608. aclerror("ACL_ExprTerm() failed");
  1609. PERM_FREE(aclpvt[-2].string);
  1610. PERM_FREE(aclpvt[-0].string);
  1611. return(-1);
  1612. }
  1613. PERM_FREE(aclpvt[-2].string);
  1614. PERM_FREE(aclpvt[-0].string);
  1615. } break;
  1616. case 113:
  1617. # line 931 "acltext.y"
  1618. {
  1619. acl_string_lower(aclpvt[-2].string);
  1620. if ( ACL_ExprTerm(NULL, curr_expr,
  1621. aclpvt[-2].string, (CmpOp_t) aclpvt[-1].ival, aclpvt[-0].string) < 0 ) {
  1622. aclerror("ACL_ExprTerm() failed");
  1623. PERM_FREE(aclpvt[-2].string);
  1624. PERM_FREE(aclpvt[-0].string);
  1625. return(-1);
  1626. }
  1627. PERM_FREE(aclpvt[-2].string);
  1628. PERM_FREE(aclpvt[-0].string);
  1629. } break;
  1630. }
  1631. goto aclstack; /* reset registers in driver code */
  1632. }