ext_edirectory_userip_acl.cc File Reference
#include "squid.h"
#include "helper/protocol_defines.h"
#include "rfc1738.h"
#include "util.h"
#include <cctype>
#include <cerrno>
#include <csignal>
#include <cstdarg>
#include <cstdlib>
#include <cstring>
#include <ctime>
Include dependency graph for ext_edirectory_userip_acl.cc:

Go to the source code of this file.

Classes

struct  edui_conf_t
 
struct  edui_ldap_t
 

Macros

#define EDUI_PROGRAM_NAME   "ext_edirectory_userip_acl"
 
#define EDUI_PROGRAM_VERSION   "2.1"
 
#define _GNU_SOURCE
 
#define __USE_GNU
 
#define LDAP_DEPRECATED   1 /* Set flag for enabling classic ldap functions */
 
#define EDUI_MAXLEN   4096 /* Modified to improve performance, unless HELPER_INPUT_BUFFER exists */
 
#define USE_LDAP_INIT
 
#define NETSCAPE_SSL
 
#define LDAP_AUTH_TLS   ((ber_tag_t) 0xb3U)
 
#define EDUI_MODE_INIT   0x01
 
#define EDUI_MODE_DEBUG   0x02 /* Replace with Squid's debug system */
 
#define EDUI_MODE_TLS   0x04
 
#define EDUI_MODE_IPV4   0x08
 
#define EDUI_MODE_IPV6   0x10
 
#define EDUI_MODE_GROUP   0x20 /* Group is REQUIRED */
 
#define EDUI_MODE_PERSIST   0x40 /* Persistent LDAP connections */
 
#define EDUI_MODE_KILL   0x80
 
#define LDAP_INIT_S   0x0001
 
#define LDAP_OPEN_S   0x0002
 
#define LDAP_BIND_S   0x0004
 
#define LDAP_SEARCH_S   0x0008 /* We got data */
 
#define LDAP_VAL_S   0x0010 /* Data has been copied to l->val */
 
#define LDAP_CLOSE_S   0x0020
 
#define LDAP_PERSIST_S   0x0040 /* Persistent connection */
 
#define LDAP_IDLE_S   0x0080 /* Connection is idle */
 
#define LDAP_SSL_S   0x0100
 
#define LDAP_TLS_S   0x0200
 
#define LDAP_IPV4_S   0x0400 /* Search IP is IPv4 */
 
#define LDAP_IPV6_S   0x0800 /* Search IP is IPv6 */
 
#define LDAP_ERR_NULL   -1 /* Null edui_ldap_t pointer */
 
#define LDAP_ERR_POINTER   -2 /* Null l->lp pointer */
 
#define LDAP_ERR_PARAM   -3 /* Null or Missing parameters */
 
#define LDAP_ERR_INIT   -4 /* Not initalized */
 
#define LDAP_ERR_OPEN   -5 /* Not open */
 
#define LDAP_ERR_CONNECT   -6 /* Unable to connect */
 
#define LDAP_ERR_BIND   -7 /* Not bound */
 
#define LDAP_ERR_SEARCHED   -8 /* Already Searched */
 
#define LDAP_ERR_NOT_SEARCHED   -9 /* Not searching */
 
#define LDAP_ERR_INVALID   -10 /* Invalid parameter */
 
#define LDAP_ERR_OOB   -11 /* Out of bounds value */
 
#define LDAP_ERR_PERSIST   -12 /* Persistent mode is not active */
 
#define LDAP_ERR_DATA   -13 /* Required data missing */
 
#define LDAP_ERR_NOTFOUND   -14 /* Item not found */
 
#define LDAP_ERR_OTHER   -15 /* Other Generic Error condition */
 
#define LDAP_ERR_FAILED   -16 /* Operation failed */
 
#define LDAP_ERR_SUCCESS   -17 /* Operation successful */
 

Functions

static void local_printfx (const char *,...)
 
static int StringSplit (char *, char, char *, size_t)
 
static int BinarySplit (void *, size_t, char, void *, size_t)
 
static void DisplayVersion ()
 
static void DisplayUsage ()
 
static void InitConf ()
 
static void DisplayConf ()
 
static void InitLDAP (edui_ldap_t *)
 
static int OpenLDAP (edui_ldap_t *, char *, unsigned int)
 
static int CloseLDAP (edui_ldap_t *)
 
static int SetVerLDAP (edui_ldap_t *, int)
 
static int BindLDAP (edui_ldap_t *, char *, char *, unsigned int)
 
static int ConvertIP (edui_ldap_t *, char *)
 
static int ResetLDAP (edui_ldap_t *)
 
static int SearchFilterLDAP (edui_ldap_t *, char *)
 
static int SearchLDAP (edui_ldap_t *, int, char *, char **)
 
static int SearchIPLDAP (edui_ldap_t *)
 
const char * ErrLDAP (int)
 
void SigTrap (int)
 
static int MainSafe (int argc, char **argv)
 
int main (int argc, char **argv)
 

Variables

const char * search_attrib [] = { "cn", "uid", "networkAddress", "groupMembership", NULL }
 
static edui_conf_t edui_conf
 
static edui_ldap_t edui_ldap
 
time_t edui_now
 
time_t edui_elap
 

Macro Definition Documentation

#define __USE_GNU

Definition at line 51 of file ext_edirectory_userip_acl.cc.

#define _GNU_SOURCE

Definition at line 48 of file ext_edirectory_userip_acl.cc.

#define EDUI_MAXLEN   4096 /* Modified to improve performance, unless HELPER_INPUT_BUFFER exists */
#define EDUI_MODE_DEBUG   0x02 /* Replace with Squid's debug system */

Definition at line 94 of file ext_edirectory_userip_acl.cc.

Referenced by DisplayConf(), InitConf(), and MainSafe().

#define EDUI_MODE_GROUP   0x20 /* Group is REQUIRED */

Definition at line 98 of file ext_edirectory_userip_acl.cc.

Referenced by DisplayConf(), InitConf(), and MainSafe().

#define EDUI_MODE_INIT   0x01

Definition at line 93 of file ext_edirectory_userip_acl.cc.

Referenced by InitConf().

#define EDUI_MODE_IPV4   0x08

Definition at line 96 of file ext_edirectory_userip_acl.cc.

Referenced by ConvertIP(), DisplayConf(), InitConf(), and MainSafe().

#define EDUI_MODE_IPV6   0x10

Definition at line 97 of file ext_edirectory_userip_acl.cc.

Referenced by ConvertIP(), DisplayConf(), InitConf(), and MainSafe().

#define EDUI_MODE_KILL   0x80

Definition at line 100 of file ext_edirectory_userip_acl.cc.

Referenced by MainSafe(), and SigTrap().

#define EDUI_MODE_PERSIST   0x40 /* Persistent LDAP connections */

Definition at line 99 of file ext_edirectory_userip_acl.cc.

Referenced by DisplayConf(), InitConf(), and MainSafe().

#define EDUI_MODE_TLS   0x04

Definition at line 95 of file ext_edirectory_userip_acl.cc.

Referenced by DisplayConf(), InitConf(), and MainSafe().

#define EDUI_PROGRAM_NAME   "ext_edirectory_userip_acl"

Definition at line 43 of file ext_edirectory_userip_acl.cc.

Referenced by local_printfx().

#define EDUI_PROGRAM_VERSION   "2.1"

Definition at line 44 of file ext_edirectory_userip_acl.cc.

Referenced by DisplayVersion().

#define LDAP_AUTH_TLS   ((ber_tag_t) 0xb3U)

Definition at line 88 of file ext_edirectory_userip_acl.cc.

Referenced by BindLDAP(), and MainSafe().

#define LDAP_BIND_S   0x0004
#define LDAP_CLOSE_S   0x0020

Definition at line 124 of file ext_edirectory_userip_acl.cc.

#define LDAP_DEPRECATED   1 /* Set flag for enabling classic ldap functions */

Definition at line 63 of file ext_edirectory_userip_acl.cc.

#define LDAP_ERR_BIND   -7 /* Not bound */
#define LDAP_ERR_CONNECT   -6 /* Unable to connect */

Definition at line 138 of file ext_edirectory_userip_acl.cc.

Referenced by ErrLDAP(), and OpenLDAP().

#define LDAP_ERR_DATA   -13 /* Required data missing */

Definition at line 145 of file ext_edirectory_userip_acl.cc.

Referenced by ErrLDAP(), SearchFilterLDAP(), SearchIPLDAP(), and SearchLDAP().

#define LDAP_ERR_FAILED   -16 /* Operation failed */

Definition at line 148 of file ext_edirectory_userip_acl.cc.

Referenced by BindLDAP(), CloseLDAP(), ErrLDAP(), SearchLDAP(), and SetVerLDAP().

#define LDAP_ERR_INIT   -4 /* Not initalized */
#define LDAP_ERR_INVALID   -10 /* Invalid parameter */

Definition at line 142 of file ext_edirectory_userip_acl.cc.

Referenced by ConvertIP(), and ErrLDAP().

#define LDAP_ERR_NOT_SEARCHED   -9 /* Not searching */

Definition at line 141 of file ext_edirectory_userip_acl.cc.

Referenced by ErrLDAP(), and SearchIPLDAP().

#define LDAP_ERR_NOTFOUND   -14 /* Item not found */

Definition at line 146 of file ext_edirectory_userip_acl.cc.

Referenced by ErrLDAP(), MainSafe(), and SearchIPLDAP().

#define LDAP_ERR_NULL   -1 /* Null edui_ldap_t pointer */
#define LDAP_ERR_OOB   -11 /* Out of bounds value */

Definition at line 143 of file ext_edirectory_userip_acl.cc.

Referenced by ConvertIP(), and ErrLDAP().

#define LDAP_ERR_OPEN   -5 /* Not open */
#define LDAP_ERR_OTHER   -15 /* Other Generic Error condition */

Definition at line 147 of file ext_edirectory_userip_acl.cc.

Referenced by ErrLDAP().

#define LDAP_ERR_PARAM   -3 /* Null or Missing parameters */

Definition at line 135 of file ext_edirectory_userip_acl.cc.

Referenced by ConvertIP(), ErrLDAP(), SearchLDAP(), and SetVerLDAP().

#define LDAP_ERR_PERSIST   -12 /* Persistent mode is not active */

Definition at line 144 of file ext_edirectory_userip_acl.cc.

Referenced by ErrLDAP(), and ResetLDAP().

#define LDAP_ERR_POINTER   -2 /* Null l->lp pointer */

Definition at line 134 of file ext_edirectory_userip_acl.cc.

Referenced by BindLDAP(), ErrLDAP(), SearchIPLDAP(), SearchLDAP(), and SetVerLDAP().

#define LDAP_ERR_SEARCHED   -8 /* Already Searched */

Definition at line 140 of file ext_edirectory_userip_acl.cc.

Referenced by ErrLDAP(), and SearchLDAP().

#define LDAP_ERR_SUCCESS   -17 /* Operation successful */
#define LDAP_IDLE_S   0x0080 /* Connection is idle */

Definition at line 126 of file ext_edirectory_userip_acl.cc.

Referenced by MainSafe(), and ResetLDAP().

#define LDAP_IPV4_S   0x0400 /* Search IP is IPv4 */

Definition at line 129 of file ext_edirectory_userip_acl.cc.

Referenced by ConvertIP(), ResetLDAP(), SearchFilterLDAP(), and SearchIPLDAP().

#define LDAP_IPV6_S   0x0800 /* Search IP is IPv6 */

Definition at line 130 of file ext_edirectory_userip_acl.cc.

Referenced by ConvertIP(), ResetLDAP(), SearchFilterLDAP(), and SearchIPLDAP().

#define LDAP_PERSIST_S   0x0040 /* Persistent connection */

Definition at line 125 of file ext_edirectory_userip_acl.cc.

Referenced by MainSafe(), and ResetLDAP().

#define LDAP_SEARCH_S   0x0008 /* We got data */

Definition at line 122 of file ext_edirectory_userip_acl.cc.

Referenced by ResetLDAP(), SearchIPLDAP(), and SearchLDAP().

#define LDAP_SSL_S   0x0100

Definition at line 127 of file ext_edirectory_userip_acl.cc.

Referenced by OpenLDAP().

#define LDAP_TLS_S   0x0200

Definition at line 128 of file ext_edirectory_userip_acl.cc.

Referenced by OpenLDAP().

#define LDAP_VAL_S   0x0010 /* Data has been copied to l->val */

Definition at line 123 of file ext_edirectory_userip_acl.cc.

Referenced by ResetLDAP(), and SearchIPLDAP().

#define NETSCAPE_SSL

Definition at line 80 of file ext_edirectory_userip_acl.cc.

#define USE_LDAP_INIT

Definition at line 78 of file ext_edirectory_userip_acl.cc.

Function Documentation

static int BinarySplit ( void *  In_Obj,
size_t  In_Sz,
char  chr,
void *  Out_Obj,
size_t  Out_Sz 
)
static

Definition at line 303 of file ext_edirectory_userip_acl.cc.

References i, NULL, and p.

Referenced by SearchIPLDAP().

static void DisplayUsage ( )
static

Definition at line 357 of file ext_edirectory_userip_acl.cc.

References DisplayVersion(), local_printfx(), and edui_conf_t::program.

Referenced by MainSafe().

static void DisplayVersion ( )
static

Definition at line 350 of file ext_edirectory_userip_acl.cc.

References EDUI_PROGRAM_VERSION, and local_printfx().

Referenced by DisplayConf(), DisplayUsage(), and MainSafe().

static void local_printfx ( const char *  msg,
  ... 
)
static
int main ( int  argc,
char **  argv 
)

Definition at line 1954 of file ext_edirectory_userip_acl.cc.

References MainSafe().

void SigTrap ( int  s)
static int StringSplit ( char *  In_Str,
char  chr,
char *  Out_Str,
size_t  Out_Sz 
)
static

Definition at line 252 of file ext_edirectory_userip_acl.cc.

References i, NULL, and p.

Referenced by ConvertIP(), and MainSafe().

Variable Documentation

edui_conf_t edui_conf
static

Definition at line 197 of file ext_edirectory_userip_acl.cc.

time_t edui_elap

Definition at line 200 of file ext_edirectory_userip_acl.cc.

Referenced by MainSafe().

edui_ldap_t edui_ldap
static

Definition at line 198 of file ext_edirectory_userip_acl.cc.

time_t edui_now

Definition at line 199 of file ext_edirectory_userip_acl.cc.

Referenced by MainSafe().

const char* search_attrib[] = { "cn", "uid", "networkAddress", "groupMembership", NULL }

Definition at line 196 of file ext_edirectory_userip_acl.cc.

Referenced by MainSafe().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors