Merge branch 'master' of ssh://moonshot-v4/srv/git/cyrus-sasl
[cyrus-sasl.git] / mac / mac_lib / mac_monolithic_dlopen.c
1 /* 
2  * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer. 
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in
13  *    the documentation and/or other materials provided with the
14  *    distribution.
15  *
16  * 3. The name "Carnegie Mellon University" must not be used to
17  *    endorse or promote products derived from this software without
18  *    prior written permission. For permission or any other legal
19  *    details, please contact  
20  *      Office of Technology Transfer
21  *      Carnegie Mellon University
22  *      5000 Forbes Avenue
23  *      Pittsburgh, PA  15213-3890
24  *      (412) 268-4387, fax: (412) 268-7395
25  *      tech-transfer@andrew.cmu.edu
26  *
27  * 4. Redistributions of any form whatsoever must retain the following
28  *    acknowledgment:
29  *    "This product includes software developed by Computing Services
30  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
31  *
32  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
33  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
34  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
35  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
36  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
37  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
38  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
39  */
40 /* $Id: mac_monolithic_dlopen.c,v 1.3 2003/02/13 19:55:59 rjs3 Exp $ */
41
42 #include <config.h>
43 #include <stdlib.h>
44 #include <string.h>
45 #include <sasl.h>
46 #include "saslint.h"
47
48 #include <sasl_plain_plugin_decl.h>
49 #undef sasl_server_plug_init
50 #undef sasl_client_plug_init
51
52 #include <sasl_anonymous_plugin_decl.h>
53 #undef sasl_server_plug_init
54 #undef sasl_client_plug_init
55
56 #include <sasl_cram_plugin_decl.h>
57 #undef sasl_server_plug_init
58 #undef sasl_client_plug_init
59
60 #include <sasl_md5_plugin_decl.h>
61 #undef sasl_server_plug_init
62 #undef sasl_client_plug_init
63
64 #include <sasl_scram_plugin_decl.h>
65 #undef sasl_server_plug_init
66 #undef sasl_client_plug_init
67
68 #include <sasl_kerberos4_plugin_decl.h>
69 #undef sasl_server_plug_init
70 #undef sasl_client_plug_init
71
72 #include <stdio.h>
73
74 /* gets the list of mechanisms */
75 int _sasl_get_mech_list(const char *entryname,
76                         const sasl_callback_t *getpath_cb,
77                         const sasl_callback_t *verifyfile_cb,
78                         int (*add_plugin)(void *,void *))
79 {
80         if(strcmp(entryname,"sasl_client_plug_init")==0) {
81                 (*add_plugin)(kerberos4_sasl_client_plug_init,(void*)1);
82                 (*add_plugin)(anonymous_sasl_client_plug_init,(void*)1);
83                 (*add_plugin)(cram_sasl_client_plug_init,(void*)1);
84                 (*add_plugin)(scram_sasl_client_plug_init,(void*)1);
85                 (*add_plugin)(md5_sasl_client_plug_init,(void*)1);
86                 (*add_plugin)(plain_sasl_client_plug_init,(void*)1);
87         } else if(strcmp(entryname,"sasl_server_plug_init")==0) {
88                 (*add_plugin)(kerberos4_sasl_server_plug_init,(void*)1);
89                 (*add_plugin)(anonymous_sasl_server_plug_init,(void*)1);
90                 (*add_plugin)(cram_sasl_server_plug_init,(void*)1);
91                 (*add_plugin)(scram_sasl_server_plug_init,(void*)1);
92                 (*add_plugin)(md5_sasl_server_plug_init,(void*)1);
93                 (*add_plugin)(plain_sasl_server_plug_init,(void*)1);
94         } else
95                 return SASL_BADPARAM;
96         
97         return SASL_OK;
98 }
99
100 int _sasl_done_with_plugin(void *plugin)
101 {
102   if (! plugin)
103     return SASL_BADPARAM;
104
105   return SASL_OK;
106 }