acl.tab.cpp 48 KB

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