- if (!check_file_changed(current_blockfile, csp->config->blockfile, &fs))
- {
- /* No need to load */
- if (csp)
- {
- csp->blist = current_blockfile;
- }
- return(0);
- }
- if (!fs)
- {
- goto load_blockfile_error;
- }
-
- fs->f = bl = (struct block_spec *) zalloc(sizeof(*bl));
- if (bl == NULL)
- {
- goto load_blockfile_error;
- }
-
- if ((fp = fopen(csp->config->blockfile, "r")) == NULL)
- {
- goto load_blockfile_error;
- }
-
- while (read_config_line(buf, sizeof(buf), fp, fs) != NULL)
- {
- reject = 1;
-
- if (*buf == '~')
- {
- reject = 0;
- p = buf;
- q = p+1;
- while ((*p++ = *q++))
- {
- /* nop */
- }
- }
-
- /* skip lines containing only ~ */
- if (*buf == '\0')
- {
- continue;
- }
-
- /* allocate a new node */
- if ((b = zalloc(sizeof(*b))) == NULL)
- {
- fclose(fp);
- goto load_blockfile_error;
- }
-
- /* add it to the list */
- b->next = bl->next;
- bl->next = b;
-
- b->reject = reject;
-
- /* Save the URL pattern */
- if (create_url_spec(b->url, buf))
- {
- fclose(fp);
- goto load_blockfile_error;
- }
- }
-
- fclose(fp);
-
-#ifndef SPLIT_PROXY_ARGS
- if (!suppress_blocklists)
- {
- fs->proxy_args = strsav(fs->proxy_args, "</pre>");
- }
-#endif /* ndef SPLIT_PROXY_ARGS */
-
- /* the old one is now obsolete */
- if (current_blockfile)
- {
- current_blockfile->unloader = unload_blockfile;
- }
-
- fs->next = files->next;
- files->next = fs;
- current_blockfile = fs;
-
- if (csp)
- {
- csp->blist = fs;
- }
-
- return(0);
-
-load_blockfile_error:
- log_error(LOG_LEVEL_FATAL, "can't load blockfile '%s': %E", csp->config->blockfile);
- return(-1);
-
-}
+/*
+ * Note: this is special-cased in the code so we don't need to
+ * fill in the ->next fields.
+ */
+static const struct permission_alias standard_aliases[] =
+{
+ { "+block", PERMIT_MASK_ALL, PERMIT_BLOCK },
+/* { "+cookies", PERMIT_MASK_ALL, PERMIT_COOKIE_SET | PERMIT_COOKIE_READ }, */
+ { "+cookies-read", PERMIT_MASK_ALL, PERMIT_COOKIE_READ },
+ { "+cookies-set", PERMIT_MASK_ALL, PERMIT_COOKIE_SET },
+ { "+fast-redirects", PERMIT_MASK_ALL, PERMIT_FAST_REDIRECTS },
+ { "+filter", PERMIT_MASK_ALL, PERMIT_RE_FILTER },
+ { "+image", PERMIT_MASK_ALL, PERMIT_IMAGE },
+ { "+popup", PERMIT_MASK_ALL, PERMIT_POPUPS },
+ { "+popups", PERMIT_MASK_ALL, PERMIT_POPUPS },
+ { "+referer", PERMIT_MASK_ALL, PERMIT_REFERER },
+ { "+referrer", PERMIT_MASK_ALL, PERMIT_REFERER },
+ { "-block", ~PERMIT_BLOCK, 0 },
+/* { "-cookies", ~(PERMIT_COOKIE_SET | PERMIT_COOKIE_READ), 0 }, */
+ { "-cookies-read", ~PERMIT_COOKIE_READ, 0 },
+ { "-cookies-set", ~PERMIT_COOKIE_SET, 0 },
+ { "-fast-redirects", ~PERMIT_FAST_REDIRECTS, 0 },
+ { "-filter", ~PERMIT_RE_FILTER, 0 },
+ { "-image", ~PERMIT_IMAGE, 0 },
+ { "-popup", ~PERMIT_POPUPS, 0 },
+ { "-popups", ~PERMIT_POPUPS, 0 },
+ { "-referer", ~PERMIT_REFERER, 0 },
+ { "-referrer", ~PERMIT_REFERER, 0 },
+ { NULL, 0, 0 } /* End marker */
+};