1 /* MODULE: auth_ldap */
3 * Copyright (c) 2002-2002 Igor Brezac
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY IGOR BREZAC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IGOR BREZAC OR
19 * ITS EMPLOYEES OR AGENTS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
30 * Authenticate against LDAP.
34 #ident "$Id: auth_ldap.c,v 1.17 2004/12/08 12:12:27 mel Exp $"
37 /* PUBLIC DEPENDENCIES */
42 #include "mechanisms.h"
44 /* END PUBLIC DEPENDENCIES */
46 # define RETURN(x) {return strdup(x);}
48 /* FUNCTION: auth_ldap */
55 const char *SASLAUTHD_CONF_FILE = SASLAUTHD_CONF_FILE_DEFAULT;
57 char * /* R: allocated response string */
60 const char *login, /* I: plaintext authenticator */
61 const char *password, /* I: plaintext password */
67 static LAK *lak = NULL;
71 rc = lak_init(SASLAUTHD_CONF_FILE, &lak);
78 rc = lak_authenticate(lak, login, service, realm, password);
86 /* FUNCTION: auth_ldap_init */
89 * Validate the host and service names for the remote server.
95 void /* no parameters */
100 struct addrinfo hints;
102 char *c; /* scratch pointer */
105 if (mech_option != NULL) {
106 SASLAUTHD_CONF_FILE = mech_option;
112 #else /* !AUTH_LDAP */
116 const char *login __attribute__((unused)),
117 const char *password __attribute__((unused)),
118 const char *service __attribute__((unused)),
119 const char *realm __attribute__((unused))
125 #endif /* !AUTH_LDAP */
127 /* END FUNCTION: auth_ldap */
129 /* END MODULE: auth_ldap */