basic_ldap_auth.cc File Reference
#include "squid.h"
#include "helper/protocol_defines.h"
#include "rfc1738.h"
#include "util.h"
#include <cctype>
#include <cstring>
#include <lber.h>
#include <ldap.h>
Include dependency graph for basic_ldap_auth.cc:

Go to the source code of this file.

Macros

#define LDAP_DEPRECATED   1
 
#define LDAP_SECURITY_ERROR(err)   (0x2f <= (err) && (err) <= 0x32)
 
#define PROGRAM_NAME   "basic_ldap_auth"
 
#define LDAP_NO_ATTRS   "1.1"
 

Functions

static int checkLDAP (LDAP *ld, const char *userid, const char *password, const char *server, int port)
 
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)
 
static LDAP * open_ldap_connection (const char *ldapServer, int port)
 
static int validUsername (const char *user)
 
int main (int argc, char **argv)
 
static int ldap_escape_value (char *escaped, int size, const char *src)
 

Variables

static const char * basedn
 
static const char * searchfilter = nullptr
 
static const char * binddn = nullptr
 
static const char * bindpasswd = nullptr
 
static const char * userattr = "uid"
 
static const char * passwdattr = nullptr
 
static int searchscope = LDAP_SCOPE_SUBTREE
 
static int persistent = 0
 
static int bind_once = 0
 
static int noreferrals = 0
 
static int aliasderef = LDAP_DEREF_NEVER
 
static int connect_timeout = 0
 
static int timelimit = LDAP_NO_LIMIT
 
static int use_tls = 0
 
static int version = -1
 

Macro Definition Documentation

◆ LDAP_DEPRECATED

#define LDAP_DEPRECATED   1

Definition at line 98 of file basic_ldap_auth.cc.

◆ LDAP_NO_ATTRS

#define LDAP_NO_ATTRS   "1.1"

Definition at line 174 of file basic_ldap_auth.cc.

◆ LDAP_SECURITY_ERROR

#define LDAP_SECURITY_ERROR (   err)    (0x2f <= (err) && (err) <= 0x32)

Definition at line 138 of file basic_ldap_auth.cc.

◆ PROGRAM_NAME

#define PROGRAM_NAME   "basic_ldap_auth"

Definition at line 143 of file basic_ldap_auth.cc.

Function Documentation

◆ checkLDAP()

static int checkLDAP ( LDAP *  ld,
const char *  userid,
const char *  password,
const char *  server,
int  port 
)
static

◆ ldap_escape_value()

static int ldap_escape_value ( char *  escaped,
int  size,
const char *  src 
)
static

Definition at line 631 of file basic_ldap_auth.cc.

References size.

Referenced by checkLDAP().

◆ main()

◆ open_ldap_connection()

static LDAP * open_ldap_connection ( const char *  ldapServer,
int  port 
)
static

◆ readSecret()

int readSecret ( const char *  filename)
static

Definition at line 776 of file basic_ldap_auth.cc.

References bindpasswd, BUFSIZ, and PROGRAM_NAME.

Referenced by main().

◆ squid_ldap_errno()

static int squid_ldap_errno ( LDAP *  ld)
static

Definition at line 222 of file basic_ldap_auth.cc.

References ld.

Referenced by main().

◆ squid_ldap_memfree()

static void squid_ldap_memfree ( char *  p)
static

Definition at line 250 of file basic_ldap_auth.cc.

Referenced by checkLDAP().

◆ squid_ldap_set_aliasderef()

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

Definition at line 227 of file basic_ldap_auth.cc.

References ld.

Referenced by open_ldap_connection().

◆ squid_ldap_set_connect_timeout()

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

Definition at line 245 of file basic_ldap_auth.cc.

Referenced by open_ldap_connection().

◆ squid_ldap_set_referrals()

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

Definition at line 232 of file basic_ldap_auth.cc.

References ld.

Referenced by open_ldap_connection().

◆ squid_ldap_set_timelimit()

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

Definition at line 240 of file basic_ldap_auth.cc.

References ld, and timelimit.

Referenced by open_ldap_connection().

◆ validUsername()

static int validUsername ( const char *  user)
static

Definition at line 332 of file basic_ldap_auth.cc.

References xisspace.

Referenced by main().

Variable Documentation

◆ aliasderef

int aliasderef = LDAP_DEREF_NEVER
static

Definition at line 156 of file basic_ldap_auth.cc.

Referenced by main(), and open_ldap_connection().

◆ basedn

const char* basedn
static

Definition at line 146 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), and main().

◆ bind_once

int bind_once = 0
static

Definition at line 154 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), and main().

◆ binddn

const char* binddn = nullptr
static

Definition at line 148 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), and main().

◆ bindpasswd

const char* bindpasswd = nullptr
static

Definition at line 149 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), main(), and readSecret().

◆ connect_timeout

int connect_timeout = 0
static

Definition at line 161 of file basic_ldap_auth.cc.

Referenced by main(), and open_ldap_connection().

◆ noreferrals

int noreferrals = 0
static

Definition at line 155 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), main(), and open_ldap_connection().

◆ passwdattr

const char* passwdattr = nullptr
static

Definition at line 151 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), and main().

◆ persistent

int persistent = 0
static

Definition at line 153 of file basic_ldap_auth.cc.

Referenced by main().

◆ searchfilter

const char* searchfilter = nullptr
static

Definition at line 147 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), and main().

◆ searchscope

int searchscope = LDAP_SCOPE_SUBTREE
static

Definition at line 152 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), and main().

◆ timelimit

int timelimit = LDAP_NO_LIMIT
static

Definition at line 162 of file basic_ldap_auth.cc.

Referenced by main(), open_ldap_connection(), and squid_ldap_set_timelimit().

◆ use_tls

int use_tls = 0
static

Definition at line 165 of file basic_ldap_auth.cc.

Referenced by LDAPArguments(), ldapconnect(), main(), and open_ldap_connection().

◆ userattr

const char* userattr = "uid"
static

Definition at line 150 of file basic_ldap_auth.cc.

Referenced by checkLDAP(), and main().

◆ version

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors