acl.tab.cpp 46 KB

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