ext_ldap_group_acl.cc File Reference
#include "squid.h"
#include "helper/protocol_defines.h"
#include "rfc1738.h"
#include "util.h"
#include <algorithm>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <memory>
#include <sstream>
Include dependency graph for ext_ldap_group_acl.cc:

Go to the source code of this file.

Macros

#define LDAP_DEPRECATED   1
 
#define PROGRAM_NAME   "ext_ldap_group_acl"
 
#define PROGRAM_VERSION   "2.18"
 
#define LDAP_NO_ATTRS   "1.1"
 

Typedefs

typedef const std::unique_ptr
< LDAPMessage, decltype(&ldap_msgfree)> 
LdapResult
 

Functions

static int searchLDAP (LDAP *ld, char *group, char *user, char *extension_dn)
 
static int readSecret (const char *filename)
 
static int squid_ldap_errno (LDAP *ld)
 
static void squid_ldap_set_aliasderef (LDAP *ld, int deref)
 
static void squid_ldap_set_referrals (LDAP *ld, int referrals)
 
static void squid_ldap_set_timelimit (LDAP *ld, int timelimit)
 
static void squid_ldap_set_connect_timeout (LDAP *ld, int timelimit)
 
static void squid_ldap_memfree (char *p)
 
int main (int argc, char **argv)
 
static std::string ldap_escape_value (const std::string &src)
 
static bool build_filter (std::string &filter, const char *templ, const char *user, const char *group)
 
static std::string build_searchbase (const char *extension_dn, const char *base_dn)
 
static bool ldap_search_ok (const int result)
 
static int searchLDAPGroup (LDAP *ld, const char *group, const char *member, const char *extension_dn)
 
static void formatWithString (std::string &formatted, const std::string &value)
 

Variables

static const char * basedn = NULL
 
static const char * searchfilter = NULL
 
static const char * userbasedn = NULL
 
static const char * userdnattr = NULL
 
static const char * usersearchfilter = NULL
 
static const char * binddn = NULL
 
static const char * bindpasswd = NULL
 
static int searchscope = LDAP_SCOPE_SUBTREE
 
static int persistent = 0
 
static int noreferrals = 0
 
static int aliasderef = LDAP_DEREF_NEVER
 
static int connect_timeout = 0
 
static int timelimit = LDAP_NO_LIMIT
 

Macro Definition Documentation

#define LDAP_DEPRECATED   1

Definition at line 45 of file ext_ldap_group_acl.cc.

#define LDAP_NO_ATTRS   "1.1"

Definition at line 129 of file ext_ldap_group_acl.cc.

Referenced by searchLDAP(), and searchLDAPGroup().

#define PROGRAM_NAME   "ext_ldap_group_acl"

Definition at line 93 of file ext_ldap_group_acl.cc.

Referenced by ldap_search_ok(), main(), readSecret(), searchLDAP(), and searchLDAPGroup().

#define PROGRAM_VERSION   "2.18"

Definition at line 94 of file ext_ldap_group_acl.cc.

Referenced by main().

Typedef Documentation

typedef const std::unique_ptr<LDAPMessage, decltype(&ldap_msgfree)> LdapResult

Definition at line 720 of file ext_ldap_group_acl.cc.

Function Documentation

static bool build_filter ( std::string &  filter,
const char *  templ,
const char *  user,
const char *  group 
)
static

Definition at line 647 of file ext_ldap_group_acl.cc.

References ldap_escape_value().

Referenced by searchLDAPGroup().

static std::string build_searchbase ( const char *  extension_dn,
const char *  base_dn 
)
static

Definition at line 689 of file ext_ldap_group_acl.cc.

Referenced by searchLDAP(), and searchLDAPGroup().

static void formatWithString ( std::string &  formatted,
const std::string &  value 
)
static

Definition at line 747 of file ext_ldap_group_acl.cc.

Referenced by searchLDAP().

static std::string ldap_escape_value ( const std::string &  src)
static

Definition at line 628 of file ext_ldap_group_acl.cc.

Referenced by build_filter(), and searchLDAP().

static bool ldap_search_ok ( const int  result)
static

Definition at line 698 of file ext_ldap_group_acl.cc.

References noreferrals, and PROGRAM_NAME.

Referenced by searchLDAP(), and searchLDAPGroup().

int readSecret ( const char *  filename)
static

Definition at line 800 of file ext_ldap_group_acl.cc.

References bindpasswd, buf, BUFSIZ, PROGRAM_NAME, and xstrdup.

Referenced by main().

static int searchLDAP ( LDAP *  ld,
char *  group,
char *  user,
char *  extension_dn 
)
static
static int searchLDAPGroup ( LDAP *  ld,
const char *  group,
const char *  member,
const char *  extension_dn 
)
static
static int squid_ldap_errno ( LDAP *  ld)
static

Definition at line 177 of file ext_ldap_group_acl.cc.

Referenced by main().

static void squid_ldap_memfree ( char *  p)
static

Definition at line 205 of file ext_ldap_group_acl.cc.

References free.

Referenced by searchLDAP().

static void squid_ldap_set_aliasderef ( LDAP *  ld,
int  deref 
)
static

Definition at line 182 of file ext_ldap_group_acl.cc.

Referenced by main().

static void squid_ldap_set_connect_timeout ( LDAP *  ld,
int  timelimit 
)
static

Definition at line 200 of file ext_ldap_group_acl.cc.

Referenced by main().

static void squid_ldap_set_referrals ( LDAP *  ld,
int  referrals 
)
static

Definition at line 187 of file ext_ldap_group_acl.cc.

Referenced by main().

static void squid_ldap_set_timelimit ( LDAP *  ld,
int  timelimit 
)
static

Definition at line 195 of file ext_ldap_group_acl.cc.

References timelimit.

Referenced by main().

Variable Documentation

int aliasderef = LDAP_DEREF_NEVER
static

Definition at line 108 of file ext_ldap_group_acl.cc.

Referenced by main().

const char* basedn = NULL
static

Definition at line 98 of file ext_ldap_group_acl.cc.

Referenced by main(), searchLDAP(), and searchLDAPGroup().

const char* binddn = NULL
static

Definition at line 103 of file ext_ldap_group_acl.cc.

Referenced by main().

const char* bindpasswd = NULL
static

Definition at line 104 of file ext_ldap_group_acl.cc.

Referenced by main(), and readSecret().

int connect_timeout = 0
static

Definition at line 113 of file ext_ldap_group_acl.cc.

Referenced by main().

int noreferrals = 0
static

Definition at line 107 of file ext_ldap_group_acl.cc.

Referenced by ldap_search_ok(), and main().

int persistent = 0
static

Definition at line 106 of file ext_ldap_group_acl.cc.

Referenced by main().

const char* searchfilter = NULL
static

Definition at line 99 of file ext_ldap_group_acl.cc.

Referenced by main(), and searchLDAPGroup().

int searchscope = LDAP_SCOPE_SUBTREE
static

Definition at line 105 of file ext_ldap_group_acl.cc.

Referenced by main(), searchLDAP(), and searchLDAPGroup().

int timelimit = LDAP_NO_LIMIT
static

Definition at line 114 of file ext_ldap_group_acl.cc.

Referenced by main(), and squid_ldap_set_timelimit().

const char* userbasedn = NULL
static

Definition at line 100 of file ext_ldap_group_acl.cc.

Referenced by main(), and searchLDAP().

const char* userdnattr = NULL
static

Definition at line 101 of file ext_ldap_group_acl.cc.

Referenced by main(), and searchLDAP().

const char* usersearchfilter = NULL
static

Definition at line 102 of file ext_ldap_group_acl.cc.

Referenced by main(), and searchLDAP().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors