acl.tab.cpp 48 KB

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