]>
git.ipfire.org Git - thirdparty/squid.git/blob - helpers/external_acl/kerberos_ldap_group/support_lserver.cc
0c08275404381dc32a9759b0390b2742ff5136e2
2 * -----------------------------------------------------------------------------
4 * Author: Markus Moeller (markus_moeller at compuserve.com)
6 * Copyright (C) 2007 Markus Moeller. All rights reserved.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22 * -----------------------------------------------------------------------------
31 struct lsstruct
*init_ls(void);
35 struct lsstruct
*lssp
;
36 lssp
= (struct lsstruct
*) xmalloc(sizeof(struct lsstruct
));
44 create_ls(struct main_args
*margs
)
48 struct lsstruct
*lssp
= NULL
, *lsspn
= NULL
;
50 * netbios list format:
52 * nlist=Pattern1[:Pattern2]
54 * Pattern=ldap-server@Domain ldap server Name for a specific Kerberos domain
55 * lsstruct.domain=Domain, lsstruct.lserver=ldap server
61 debug((char *) "%s| %s: DEBUG: ldap server list %s\n", LogTime(), PROGRAM
, margs
->llist
? margs
->llist
: "NULL");
65 debug((char *) "%s| %s: DEBUG: No ldap servers defined.\n", LogTime(), PROGRAM
);
68 while (*p
) { /* loop over group list */
69 if (*p
== '\n' || *p
== '\r') { /* Ignore CR and LF if exist */
73 if (*p
== '@') { /* end of group name - start of domain name */
74 if (p
== np
) { /* empty group name not allowed */
75 debug((char *) "%s| %s: DEBUG: No ldap servers defined for domain %s\n", LogTime(), PROGRAM
, p
);
81 lssp
->lserver
= xstrdup(np
);
82 if (lsspn
) /* Have already an existing structure */
84 dp
= p
; /* after @ starts new domain name */
85 } else if (*p
== ':') { /* end of group name or end of domain name */
86 if (p
== np
) { /* empty group name not allowed */
87 debug((char *) "%s| %s: DEBUG: No ldap servers defined for domain %s\n", LogTime(), PROGRAM
, p
);
92 if (dp
) { /* end of domain name */
93 lssp
->domain
= xstrdup(dp
);
95 } else { /* end of group name and no domain name */
97 lssp
->lserver
= xstrdup(np
);
98 if (lsspn
) /* Have already an existing structure */
102 np
= p
; /* after : starts new group name */
103 debug((char *) "%s| %s: DEBUG: ldap server %s Domain %s\n", LogTime(), PROGRAM
, lssp
->lserver
, lssp
->domain
?lssp
->domain
:"NULL");
107 if (p
== np
) { /* empty group name not allowed */
108 debug((char *) "%s| %s: DEBUG: No ldap servers defined for domain %s\n", LogTime(), PROGRAM
, p
);
111 if (dp
) { /* end of domain name */
112 lssp
->domain
= xstrdup(dp
);
113 } else { /* end of group name and no domain name */
115 lssp
->lserver
= xstrdup(np
);
116 if (lsspn
) /* Have already an existing structure */
119 debug((char *) "%s| %s: DEBUG: ldap server %s Domain %s\n", LogTime(), PROGRAM
, lssp
->lserver
, lssp
->domain
?lssp
->domain
:"NULL");
121 margs
->lservs
= lssp
;