cachemgr.cc File Reference
#include "squid.h"
#include "base64.h"
#include "getfullhostname.h"
#include "html_quote.h"
#include "ip/Address.h"
#include "MemBuf.h"
#include "rfc1123.h"
#include "rfc1738.h"
#include "util.h"
#include <cctype>
#include <cerrno>
#include <csignal>
#include <cstring>
#include <ctime>
Include dependency graph for cachemgr.cc:

Go to the source code of this file.

Classes

struct  cachemgr_request
 

Macros

#define DEFAULT_CACHEMGR_CONFIG   "/etc/squid/cachemgr.conf"
 

Functions

static const char * safe_str (const char *str)
 
static const char * xstrtok (char **str, char del)
 
static void print_trailer (void)
 
static void auth_html (const char *host, int port, const char *user_name)
 
static void error_html (const char *msg)
 
static char * menu_url (cachemgr_request *req, const char *action)
 
static int parse_status_line (const char *sline, const char **statusStr)
 
static cachemgr_requestread_request (void)
 
static char * read_get_request (void)
 
static char * read_post_request (void)
 
static void make_pub_auth (cachemgr_request *req)
 
static void decode_pub_auth (cachemgr_request *req)
 
static void reset_auth (cachemgr_request *req)
 
static const char * make_auth_header (const cachemgr_request *req)
 
static int check_target_acl (const char *hostname, int port)
 
static int is_number (const char *str)
 
static void munge_menu_line (MemBuf &out, const char *buf, cachemgr_request *req)
 
static void munge_other_line (MemBuf &out, const char *buf, cachemgr_request *)
 
static const char * munge_action_line (const char *_buf, cachemgr_request *req)
 
static int read_reply (int s, cachemgr_request *req)
 
static int process_request (cachemgr_request *req)
 
int main (int argc, char *argv[])
 

Variables

static const time_t passwd_ttl = 60 * 60 * 3
 
static const char * script_name = "/cgi-bin/cachemgr.cgi"
 
static const char * progname = NULL
 
static time_t now
 

Macro Definition Documentation

#define DEFAULT_CACHEMGR_CONFIG   "/etc/squid/cachemgr.conf"

Definition at line 87 of file cachemgr.cc.

Referenced by auth_html(), and check_target_acl().

Function Documentation

static void auth_html ( const char *  host,
int  port,
const char *  user_name 
)
static

Definition at line 229 of file cachemgr.cc.

References BUFSIZ, DEFAULT_CACHEMGR_CONFIG, fp, NULL, print_trailer(), script_name, and server.

Referenced by process_request().

static int check_target_acl ( const char *  hostname,
int  port 
)
static

Definition at line 1213 of file cachemgr.cc.

References BUFSIZ, CACHE_HTTP_PORT, CACHEMGR_HOSTNAME, DEFAULT_CACHEMGR_CONFIG, fp, getfullhostname(), i, and NULL.

Referenced by process_request().

static void error_html ( const char *  msg)
static

Definition at line 381 of file cachemgr.cc.

References html_quote(), and print_trailer().

Referenced by process_request().

static int is_number ( const char *  str)
static

Definition at line 185 of file cachemgr.cc.

Referenced by munge_other_line().

int main ( int  argc,
char *  argv[] 
)
static const char * make_auth_header ( const cachemgr_request req)
static
static char * menu_url ( cachemgr_request req,
const char *  action 
)
static
static const char* munge_action_line ( const char *  _buf,
cachemgr_request req 
)
static

Definition at line 546 of file cachemgr.cc.

References action(), buf, menu_url(), p, xfree, xstrdup, and xstrtok().

Referenced by read_reply().

static void munge_menu_line ( MemBuf out,
const char *  buf,
cachemgr_request req 
)
static
static void munge_other_line ( MemBuf out,
const char *  buf,
cachemgr_request  
)
static

Definition at line 482 of file cachemgr.cc.

References MemBuf::append(), Packable::appendf(), html_quote(), is_number(), p, xfree, xstrdup, and xstrtok().

Referenced by read_reply().

static int parse_status_line ( const char *  sline,
const char **  statusStr 
)
static

Definition at line 394 of file cachemgr.cc.

References NULL, xisdigit, and xisspace.

Referenced by read_reply().

static void print_trailer ( void  )
static

Definition at line 219 of file cachemgr.cc.

References getfullhostname(), mkrfc1123(), now, progname, and VERSION.

Referenced by auth_html(), error_html(), and read_reply().

static char * read_get_request ( void  )
static

Definition at line 967 of file cachemgr.cc.

References NULL, and xstrdup.

Referenced by read_request().

static char * read_post_request ( void  )
static

Definition at line 921 of file cachemgr.cc.

References buf, len, NULL, strtoll(), xfree, and xmalloc.

Referenced by read_request().

static void reset_auth ( cachemgr_request req)
static

Definition at line 1172 of file cachemgr.cc.

References cachemgr_request::passwd, cachemgr_request::pub_auth, and safe_free.

Referenced by read_reply().

static const char * safe_str ( const char *  str)
static

Definition at line 178 of file cachemgr.cc.

Referenced by decode_pub_auth(), menu_url(), and read_request().

static const char * xstrtok ( char **  str,
char  del 
)
static

Definition at line 191 of file cachemgr.cc.

References len, NULL, p, and xisspace.

Referenced by munge_action_line(), munge_menu_line(), and munge_other_line().

Variable Documentation

time_t now
static

Definition at line 108 of file cachemgr.cc.

Referenced by decode_pub_auth(), main(), make_pub_auth(), and print_trailer().

const time_t passwd_ttl = 60 * 60 * 3
static

Definition at line 105 of file cachemgr.cc.

Referenced by decode_pub_auth().

const char* progname = NULL
static

Definition at line 107 of file cachemgr.cc.

const char* script_name = "/cgi-bin/cachemgr.cgi"
static

Definition at line 106 of file cachemgr.cc.

Referenced by auth_html(), main(), menu_url(), and read_reply().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors