]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/external/kerberos_ldap_group/support_lserver.cc
2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
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.
10 * -----------------------------------------------------------------------------
12 * Author: Markus Moeller (markus_moeller at compuserve.com)
14 * Copyright (C) 2007 Markus Moeller. All rights reserved.
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.
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.
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.
30 * -----------------------------------------------------------------------------
39 struct lsstruct
*init_ls(void);
40 void free_ls(struct lsstruct
*lssp
);
44 struct lsstruct
*lssp
;
45 lssp
= (struct lsstruct
*) xmalloc(sizeof(struct lsstruct
));
53 free_ls(struct lsstruct
*lssp
)
56 struct lsstruct
*lsspn
= lssp
->next
;
65 create_ls(struct main_args
*margs
)
69 struct lsstruct
*lssp
= NULL
, *lsspn
= NULL
;
71 * netbios list format:
73 * nlist=Pattern1[:Pattern2]
75 * Pattern=ldap-server@Domain ldap server Name for a specific Kerberos domain
76 * lsstruct.domain=Domain, lsstruct.lserver=ldap server
82 debug((char *) "%s| %s: DEBUG: ldap server list %s\n", LogTime(), PROGRAM
, margs
->llist
? margs
->llist
: "NULL");
86 debug((char *) "%s| %s: DEBUG: No ldap servers defined.\n", LogTime(), PROGRAM
);
89 while (*p
) { /* loop over group list */
90 if (*p
== '\n' || *p
== '\r') { /* Ignore CR and LF if exist */
94 if (*p
== '@') { /* end of group name - start of domain name */
95 if (p
== np
) { /* empty group name not allowed */
96 debug((char *) "%s| %s: DEBUG: No ldap servers defined for domain %s\n", LogTime(), PROGRAM
, p
);
100 if (dp
) { /* end of domain name - twice */
101 debug((char *) "%s| %s: @ is not allowed in server name %s@%s\n",LogTime(), PROGRAM
,np
,dp
);
108 lssp
->lserver
= xstrdup(np
);
110 dp
= p
; /* after @ starts new domain name */
111 } else if (*p
== ':') { /* end of group name or end of domain name */
112 if (p
== np
) { /* empty group name not allowed */
113 debug((char *) "%s| %s: DEBUG: No ldap servers defined for domain %s\n", LogTime(), PROGRAM
, p
);
119 if (dp
) { /* end of domain name */
120 lssp
->domain
= xstrdup(dp
);
122 } else { /* end of group name and no domain name */
124 lssp
->lserver
= xstrdup(np
);
128 np
= p
; /* after : starts new group name */
129 debug((char *) "%s| %s: DEBUG: ldap server %s Domain %s\n", LogTime(), PROGRAM
, lssp
->lserver
, lssp
->domain
?lssp
->domain
:"NULL");
133 if (p
== np
) { /* empty group name not allowed */
134 debug((char *) "%s| %s: DEBUG: No ldap servers defined for domain %s\n", LogTime(), PROGRAM
, p
);
138 if (dp
) { /* end of domain name */
139 lssp
->domain
= xstrdup(dp
);
140 } else { /* end of group name and no domain name */
142 lssp
->lserver
= xstrdup(np
);
143 if (lsspn
) /* Have already an existing structure */
146 debug((char *) "%s| %s: DEBUG: ldap server %s Domain %s\n", LogTime(), PROGRAM
, lssp
->lserver
, lssp
->domain
?lssp
->domain
:"NULL");
148 margs
->lservs
= lssp
;