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 = nullptr
 
static const char * searchfilter = nullptr
 
static const char * userbasedn = nullptr
 
static const char * userdnattr = nullptr
 
static const char * usersearchfilter = nullptr
 
static const char * binddn = nullptr
 
static const char * bindpasswd = nullptr
 
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

◆ LDAP_DEPRECATED

#define LDAP_DEPRECATED   1

Definition at line 45 of file ext_ldap_group_acl.cc.

◆ LDAP_NO_ATTRS

#define LDAP_NO_ATTRS   "1.1"

Definition at line 129 of file ext_ldap_group_acl.cc.

◆ PROGRAM_NAME

#define PROGRAM_NAME   "ext_ldap_group_acl"

Definition at line 93 of file ext_ldap_group_acl.cc.

◆ PROGRAM_VERSION

#define PROGRAM_VERSION   "2.18"

Definition at line 94 of file ext_ldap_group_acl.cc.

Typedef Documentation

◆ LdapResult

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

Definition at line 720 of file ext_ldap_group_acl.cc.

Function Documentation

◆ build_filter()

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().

◆ build_searchbase()

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().

◆ formatWithString()

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().

◆ ldap_escape_value()

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().

◆ ldap_search_ok()

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().

◆ main()

◆ readSecret()

int readSecret ( const char *  filename)
static

Definition at line 800 of file ext_ldap_group_acl.cc.

References bindpasswd, BUFSIZ, PROGRAM_NAME, and xstrdup.

Referenced by main().

◆ searchLDAP()

static int searchLDAP ( LDAP *  ld,
char *  group,
char *  user,
char *  extension_dn 
)
static

◆ searchLDAPGroup()

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

◆ squid_ldap_errno()

static int squid_ldap_errno ( LDAP *  ld)
static

Definition at line 177 of file ext_ldap_group_acl.cc.

References ld.

Referenced by main().

◆ squid_ldap_memfree()

static void squid_ldap_memfree ( char *  p)
static

Definition at line 205 of file ext_ldap_group_acl.cc.

Referenced by searchLDAP().

◆ squid_ldap_set_aliasderef()

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

Definition at line 182 of file ext_ldap_group_acl.cc.

References ld.

Referenced by main().

◆ squid_ldap_set_connect_timeout()

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().

◆ squid_ldap_set_referrals()

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

Definition at line 187 of file ext_ldap_group_acl.cc.

References ld.

Referenced by main().

◆ squid_ldap_set_timelimit()

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

Definition at line 195 of file ext_ldap_group_acl.cc.

References ld, and timelimit.

Referenced by main().

Variable Documentation

◆ aliasderef

int aliasderef = LDAP_DEREF_NEVER
static

Definition at line 108 of file ext_ldap_group_acl.cc.

Referenced by main().

◆ basedn

const char* basedn = nullptr
static

Definition at line 98 of file ext_ldap_group_acl.cc.

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

◆ binddn

const char* binddn = nullptr
static

Definition at line 103 of file ext_ldap_group_acl.cc.

Referenced by main().

◆ bindpasswd

const char* bindpasswd = nullptr
static

Definition at line 104 of file ext_ldap_group_acl.cc.

Referenced by main(), and readSecret().

◆ connect_timeout

int connect_timeout = 0
static

Definition at line 113 of file ext_ldap_group_acl.cc.

Referenced by main().

◆ noreferrals

int noreferrals = 0
static

Definition at line 107 of file ext_ldap_group_acl.cc.

Referenced by ldap_search_ok(), and main().

◆ persistent

int persistent = 0
static

Definition at line 106 of file ext_ldap_group_acl.cc.

Referenced by main().

◆ searchfilter

const char* searchfilter = nullptr
static

Definition at line 99 of file ext_ldap_group_acl.cc.

Referenced by main(), and searchLDAPGroup().

◆ searchscope

int searchscope = LDAP_SCOPE_SUBTREE
static

Definition at line 105 of file ext_ldap_group_acl.cc.

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

◆ timelimit

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().

◆ userbasedn

const char* userbasedn = nullptr
static

Definition at line 100 of file ext_ldap_group_acl.cc.

Referenced by main(), and searchLDAP().

◆ userdnattr

const char* userdnattr = nullptr
static

Definition at line 101 of file ext_ldap_group_acl.cc.

Referenced by main(), and searchLDAP().

◆ usersearchfilter

const char* usersearchfilter = nullptr
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