support.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/*
10 * -----------------------------------------------------------------------------
11 *
12 * Author: Markus Moeller (markus_moeller at compuserve.com)
13 *
14 * Copyright (C) 2007 Markus Moeller. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
29 *
30 * -----------------------------------------------------------------------------
31 */
32
33#define KERBEROS_LDAP_GROUP_VERSION "1.4.0sq"
34
35#include "compat/krb5.h"
36
37#include <cstring>
38#if HAVE_COM_ERR_H
39#include <com_err.h>
40#endif /* HAVE_COM_ERR_H */
41#define LDAP_DEPRECATED 1
42#if HAVE_LDAP_REBIND_FUNCTION
43#define LDAP_REFERRALS
44#endif
45#if HAVE_LBER_H
46#include <lber.h>
47#endif
48#if HAVE_LDAP_H
49#include <ldap.h>
50#endif
51#if HAVE_MOZLDAP_LDAP_H
52#include <mozldap/ldap.h>
53#endif
54
55struct gdstruct {
56 char *group;
57 char *domain;
58 struct gdstruct *next;
59};
60struct ndstruct {
61 char *netbios;
62 char *domain;
63 struct ndstruct *next;
64};
65struct lsstruct {
66 char *lserver;
67 char *domain;
68 struct lsstruct *next;
69};
70
71struct main_args {
72 char *glist;
73 char *ulist;
74 char *tlist;
75 char *nlist;
76 char *llist;
77 char *luser;
78 char *lpass;
79 char *lbind;
80 char *lurl;
81 char *ssl;
83 int AD;
84 int mdepth;
86 char *ddomain;
88 struct ndstruct *ndoms;
90 char *principal;
91};
92
94
95/* the macro overload style is really a gcc-ism */
96#ifdef __GNUC__
97
98#define log(X...) \
99 if (log_enabled) { \
100 fprintf(stderr, "%s(%d): pid=%ld :", __FILE__, __LINE__, (long)getpid() ); \
101 fprintf(stderr,X); \
102 } else (void)0
103
104#define error(X...) \
105 fprintf(stderr, "%s(%d): pid=%ld :", __FILE__, __LINE__, (long)getpid() ); \
106 fprintf(stderr,X); \
107
108#define warn(X...) \
109 fprintf(stderr, "%s(%d): pid=%ld :", __FILE__, __LINE__, (long)getpid() ); \
110 fprintf(stderr,X); \
111
112#else /* __GNUC__ */
113
114/* non-GCC compilers can't do the above macro define yet. */
115void log(char *format,...);
116void error(char *format,...);
117void warn(char *format,...);
118#endif
119
120struct hstruct {
121 char *host;
122 int port;
125};
126
128 char *dn;
129 char *pw;
130};
131
132void init_args(struct main_args *margs);
133void clean_args(struct main_args *margs);
134const char *LogTime(void);
135
136int check_memberof(struct main_args *margs, char *user, char *domain);
137int get_memberof(struct main_args *margs, char *user, char *domain, char *group);
138
139char *get_netbios_name(struct main_args *margs, char *netbios);
140
141int create_gd(struct main_args *margs);
142int create_nd(struct main_args *margs);
143int create_ls(struct main_args *margs);
144
145size_t get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, size_t nhosts, char *domain);
146size_t get_hostname_list(struct hstruct **hlist, size_t nhosts, char *name);
147size_t free_hostname_list(struct hstruct **hlist, size_t nhosts);
148
149#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
150int tool_sasl_bind(LDAP * ld, char *binddn, char *ssl);
151#endif
152
153#if HAVE_KRB5
154#define MAX_DOMAINS 16
155#define MAX_SKEW 300
156struct kstruct {
157 krb5_context context;
158 krb5_ccache cc[MAX_DOMAINS];
159 char* mem_ccache[MAX_DOMAINS];
160 int ncache;
161};
162int krb5_create_cache(char *domain, char* princ);
163void krb5_cleanup(void);
164#endif
165
166#define PROGRAM "kerberos_ldap_group"
167
int create_gd(struct main_args *margs)
void log(char *format,...)
void error(char *format,...)
size_t get_hostname_list(struct hstruct **hlist, size_t nhosts, char *name)
void warn(char *format,...)
int get_memberof(struct main_args *margs, char *user, char *domain, char *group)
int create_nd(struct main_args *margs)
const char * LogTime(void)
void clean_args(struct main_args *margs)
size_t free_hostname_list(struct hstruct **hlist, size_t nhosts)
SQUIDCEXTERN int log_enabled
Definition: support.h:93
int create_ls(struct main_args *margs)
size_t get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, size_t nhosts, char *domain)
char * get_netbios_name(struct main_args *margs, char *netbios)
int check_memberof(struct main_args *margs, char *user, char *domain)
void init_args(struct main_args *margs)
static LDAP * ld
Definition: ldap_backend.cc:57
static const char * binddn
#define SQUIDCEXTERN
Definition: squid.h:21
struct gdstruct * next
Definition: support.h:58
char * group
Definition: support.h:56
char * domain
Definition: support.h:57
int port
Definition: support.h:122
char * host
Definition: support.h:121
int priority
Definition: support.h:123
int weight
Definition: support.h:124
char * dn
Definition: support.h:128
char * pw
Definition: support.h:129
struct lsstruct * next
Definition: support.h:68
char * domain
Definition: support.h:67
char * lserver
Definition: support.h:66
char * ulist
Definition: support.h:73
struct lsstruct * lservs
Definition: support.h:89
struct ndstruct * ndoms
Definition: support.h:88
char * ddomain
Definition: support.h:86
char * ssl
Definition: support.h:81
char * nlist
Definition: support.h:75
char * glist
Definition: support.h:72
int AD
Definition: support.h:83
int mdepth
Definition: support.h:84
char * llist
Definition: support.h:76
int rc_allow
Definition: support.h:82
char * luser
Definition: support.h:77
char * lpass
Definition: support.h:78
char * principal
Definition: support.h:90
char * lurl
Definition: support.h:80
char * tlist
Definition: support.h:74
struct gdstruct * groups
Definition: support.h:87
char * lbind
Definition: support.h:79
int nokerberos
Definition: support.h:85
char * domain
Definition: support.h:62
char * netbios
Definition: support.h:61
struct ndstruct * next
Definition: support.h:63

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors