#include <config.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/param.h>
#include <sasl.h>
#include "saslint.h"
#include "staticopen.h"
const int _is_sasl_server_static = 1;
int _sasl_load_plugins(const add_plugin_list_t *entrypoints,
const sasl_callback_t *getpath_callback __attribute__((unused)),
const sasl_callback_t *verifyfile_callback __attribute__((unused)))
{
int result = SASL_OK;
const add_plugin_list_t *cur_ep;
int (*add_plugin)(const char *, void *);
enum {
UNKNOWN = 0, SERVER = 1, CLIENT = 2, AUXPROP = 3, CANONUSER = 4
} type;
for(cur_ep = entrypoints; cur_ep->entryname; cur_ep++) {
if(!strcmp(cur_ep->entryname, "sasl_server_plug_init")) {
type = SERVER;
add_plugin = (void *)sasl_server_add_plugin;
} else if (!strcmp(cur_ep->entryname, "sasl_client_plug_init")) {
type = CLIENT;
add_plugin = (void *)sasl_client_add_plugin;
} else if (!strcmp(cur_ep->entryname, "sasl_auxprop_plug_init")) {
type = AUXPROP;
add_plugin = (void *)sasl_auxprop_add_plugin;
} else if (!strcmp(cur_ep->entryname, "sasl_canonuser_init")) {
type = CANONUSER;
add_plugin = (void *)sasl_canonuser_add_plugin;
} else {
return SASL_FAIL;
}
#ifdef STATIC_ANONYMOUS
if(type == SERVER) {
result = (*add_plugin)("ANONYMOUS",
SPECIFIC_SERVER_PLUG_INIT( anonymous ));
} else if (type == CLIENT) {
result = (*add_plugin)("ANONYMOUS",
SPECIFIC_CLIENT_PLUG_INIT( anonymous ));
}
#endif
#ifdef STATIC_CRAMMD5
if(type == SERVER) {
result = (*add_plugin)("CRAM-MD5",
SPECIFIC_SERVER_PLUG_INIT( crammd5 ));
} else if (type == CLIENT) {
result = (*add_plugin)("CRAM-MD5",
SPECIFIC_CLIENT_PLUG_INIT( crammd5 ));
}
#endif
#ifdef STATIC_DIGESTMD5
if(type == SERVER) {
result = (*add_plugin)("DIGEST-MD5",
SPECIFIC_SERVER_PLUG_INIT( digestmd5 ));
} else if (type == CLIENT) {
result = (*add_plugin)("DIGEST-MD5",
SPECIFIC_CLIENT_PLUG_INIT( digestmd5 ));
}
#endif
#ifdef STATIC_GSSAPIV2
if(type == SERVER) {
result = (*add_plugin)("GSSAPI",
SPECIFIC_SERVER_PLUG_INIT( gssapiv2 ));
} else if (type == CLIENT) {
result = (*add_plugin)("GSSAPI",
SPECIFIC_CLIENT_PLUG_INIT( gssapiv2 ));
}
#endif
#ifdef STATIC_KERBEROS4
if(type == SERVER) {
result = (*add_plugin)("KERBEROS_V4",
SPECIFIC_SERVER_PLUG_INIT( kerberos4 ));
} else if (type == CLIENT) {
result = (*add_plugin)("KERBEROS_V4",
SPECIFIC_CLIENT_PLUG_INIT( kerberos4 ));
}
#endif
#ifdef STATIC_LOGIN
if(type == SERVER) {
result = (*add_plugin)("LOGIN",
SPECIFIC_SERVER_PLUG_INIT( login ));
} else if (type == CLIENT) {
result = (*add_plugin)("LOGIN",
SPECIFIC_CLIENT_PLUG_INIT( login ));
}
#endif
#ifdef STATIC_OTP
if(type == SERVER) {
result = (*add_plugin)("OTP",
SPECIFIC_SERVER_PLUG_INIT( otp ));
} else if (type == CLIENT) {
result = (*add_plugin)("OTP",
SPECIFIC_CLIENT_PLUG_INIT( otp ));
}
#endif
#ifdef STATIC_PLAIN
if(type == SERVER) {
result = (*add_plugin)("PLAIN",
SPECIFIC_SERVER_PLUG_INIT( plain ));
} else if (type == CLIENT) {
result = (*add_plugin)("PLAIN",
SPECIFIC_CLIENT_PLUG_INIT( plain ));
}
#endif
#ifdef STATIC_SRP
if(type == SERVER) {
result = (*add_plugin)("SRP", SPECIFIC_SERVER_PLUG_INIT( srp ));
} else if (type == CLIENT) {
result = (*add_plugin)("SRP", SPECIFIC_CLIENT_PLUG_INIT( srp ));
}
#endif
#ifdef STATIC_SASLDB
if(type == AUXPROP) {
result = (*add_plugin)("SASLDB",
SPECIFIC_AUXPROP_PLUG_INIT( sasldb ));
}
#endif
}
return SASL_OK;
}
int _sasl_get_plugin(const char *file __attribute__((unused)),
const sasl_callback_t *verifyfile_cb __attribute__((unused)),
void **libraryptr __attribute__((unused)))
{
return SASL_FAIL;
}
int _sasl_locate_entry(void *library __attribute__((unused)),
const char *entryname __attribute__((unused)),
void **entry_point __attribute__((unused)))
{
return SASL_FAIL;
}
int
_sasl_done_with_plugins()
{
return SASL_OK;
}