2 Copyright (C) 2008 g10 Code GmbH
4 This file is part of DirMngr.
6 DirMngr is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DirMngr is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <https://www.gnu.org/licenses/>. */
24 /* Release the list of SERVERS. As usual it is okay to call this
25 function with SERVERS passed as NULL. */
26 void ldapserver_list_free (ldap_server_t servers);
29 /* Parse a single LDAP server configuration line. Returns the server
30 or NULL in case of errors. The configuration line is assumed to be
31 colon separated with these fields:
39 FILENAME and LINENO are used for diagnostic purposes only.
41 ldap_server_t ldapserver_parse_one (char *line,
42 const char *filename, unsigned int lineno);
45 /* Iterate over all servers. */
47 struct ldapserver_iter
50 enum { LDAPSERVER_SESSION, LDAPSERVER_OPT } group;
56 ldapserver_iter_next (struct ldapserver_iter *iter)
59 iter->server = iter->server->next;
63 if (iter->group == LDAPSERVER_SESSION)
65 iter->group = LDAPSERVER_OPT;
66 iter->server = opt.ldapservers;
73 ldapserver_iter_end_p (struct ldapserver_iter *iter)
75 return (iter->group == LDAPSERVER_OPT && iter->server == NULL);
80 ldapserver_iter_begin (struct ldapserver_iter *iter, ctrl_t ctrl)
83 iter->group = LDAPSERVER_SESSION;
84 iter->server = get_ldapservers_from_ctrl (ctrl);
86 while (iter->server == NULL && ! ldapserver_iter_end_p (iter))
87 ldapserver_iter_next (iter);
90 #endif /* LDAPSERVER_H */