-#ifdef KILLPOPUPS
-/*********************************************************************
- *
- * Function : load_popupfile
- *
- * Description : Load, and parse the popup blocklist.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- *
- * Returns : 0 => success, else there was an error.
- *
- *********************************************************************/
-int load_popupfile(struct client_state *csp)
-{
- FILE *fp;
- char buf[BUFSIZ], *p, *q;
- struct popup_blocklist *entry = NULL;
- struct popup_settings * data;
- struct file_list *fs;
- p = buf;
- q = buf;
-
- if (!check_file_changed(current_popupfile, popupfile, &fs))
- {
- /* No need to load */
- if (csp)
- {
- csp->plist = current_popupfile;
- }
- return(0);
- }
- if (!fs)
- {
- goto load_popupfile_error;
- }
-
- fs->f = data = (struct popup_settings *)zalloc(sizeof(*data));
- if (data == NULL)
- {
- goto load_popupfile_error;
- }
-
- if ((fp = fopen(popupfile, "r")) == NULL)
- {
- goto load_popupfile_error;
- }
-
- while (read_config_line(buf, sizeof(buf), fp, fs) != NULL)
- {
- entry = (struct popup_blocklist*)zalloc(sizeof(struct popup_blocklist));
- if (!entry)
- {
- fclose( fp );
- goto load_popupfile_error;
- }
-
- /* Handle allowed hosts. */
- if ( *buf == '~' )
- {
- /* Rememeber: skip the tilde */
- entry->host_name = strdup( buf + 1 );
- if (!entry->host_name)
- {
- fclose( fp );
- goto load_popupfile_error;
- }
-
- entry->next = data->allowed;
- data->allowed = entry;
- }
- else
- {
- /* Blocked host */
- entry->host_name = strdup( buf );
- if (!entry->host_name)
- {
- fclose( fp );
- goto load_popupfile_error;
- }
-
- entry->next = data->blocked;
- data->blocked = entry;
- }
- }
-
- 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 ( NULL != current_popupfile )
- {
- current_popupfile->unloader = unload_popupfile;
- }
-
- fs->next = files->next;
- files->next = fs;
- current_popupfile = fs;
-
- if (csp)
- {
- csp->plist = fs;
- }
-
- return( 0 );
-
-load_popupfile_error:
- log_error(LOG_LEVEL_ERROR, "can't load popupfile '%s': %E", popupfile);
- return(-1);
-
-}
-#endif /* def KILLPOPUPS */
-
-
-