void auth_cyrus_sasl_version_report(FILE *f) { const char *implementation, *version; sasl_version_info(&implementation, &version, NULL, NULL, NULL, NULL); fprintf(f, "Library version: Cyrus SASL: Compile: %d.%d.%d\n" " Runtime: %s [%s]\n", SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP, version, implementation); }
int main() { sasl_version_info(0, 0, 0, 0, 0, 0); return 0; }
XSASL_CLIENT_IMPL *xsasl_cyrus_client_init(const char *unused_client_type, const char *unused_path_info) { XSASL_CLIENT_IMPL *xp; int sasl_status; /* * Global callbacks. These have no per-session context. */ static sasl_callback_t callbacks[] = { {SASL_CB_LOG, (XSASL_CYRUS_CB) &xsasl_cyrus_log, 0}, {SASL_CB_LIST_END, 0, 0} }; #if SASL_VERSION_MAJOR >= 2 && (SASL_VERSION_MINOR >= 2 \ || (SASL_VERSION_MINOR == 1 && SASL_VERSION_STEP >= 19)) int sasl_major; int sasl_minor; int sasl_step; /* * DLL hell guard. */ sasl_version_info((const char **) 0, (const char **) 0, &sasl_major, &sasl_minor, &sasl_step, (int *) 0); if (sasl_major != SASL_VERSION_MAJOR #if 0 || sasl_minor != SASL_VERSION_MINOR || sasl_step != SASL_VERSION_STEP #endif ) { msg_warn("incorrect SASL library version. " "Postfix was built with include files from version %d.%d.%d, " "but the run-time library version is %d.%d.%d", SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP, sasl_major, sasl_minor, sasl_step); return (0); } #endif if (*var_cyrus_conf_path) { #ifdef SASL_PATH_TYPE_CONFIG /* Cyrus SASL 2.1.22 */ if (sasl_set_path(SASL_PATH_TYPE_CONFIG, var_cyrus_conf_path) != SASL_OK) msg_warn("failed to set Cyrus SASL configuration path: \"%s\"", var_cyrus_conf_path); #else msg_warn("%s is not empty, but setting the Cyrus SASL configuration " "path is not supported with SASL library version %d.%d.%d", VAR_CYRUS_CONF_PATH, SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP); #endif } /* * Initialize the SASL library. */ if ((sasl_status = sasl_client_init(callbacks)) != SASL_OK) { msg_warn("SASL library initialization error: %s", xsasl_cyrus_strerror(sasl_status)); return (0); } /* * Return a generic XSASL_CLIENT_IMPL object. We don't need to extend it * with our own methods or data. */ xp = (XSASL_CLIENT_IMPL *) mymalloc(sizeof(*xp)); xp->create = xsasl_cyrus_client_create; xp->done = xsasl_cyrus_client_done; return (xp); }
XSASL_SERVER_IMPL *xsasl_cyrus_server_init(const char *unused_server_type, const char *path_info) { const char *myname = "xsasl_cyrus_server_init"; XSASL_SERVER_IMPL *xp; int sasl_status; #if SASL_VERSION_MAJOR >= 2 && (SASL_VERSION_MINOR >= 2 \ || (SASL_VERSION_MINOR == 1 && SASL_VERSION_STEP >= 19)) int sasl_major; int sasl_minor; int sasl_step; /* * DLL hell guard. */ sasl_version_info((const char **) 0, (const char **) 0, &sasl_major, &sasl_minor, &sasl_step, (int *) 0); if (sasl_major != SASL_VERSION_MAJOR #if 0 || sasl_minor != SASL_VERSION_MINOR || sasl_step != SASL_VERSION_STEP #endif ) { msg_warn("incorrect SASL library version. " "Postfix was built with include files from version %d.%d.%d, " "but the run-time library version is %d.%d.%d", SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP, sasl_major, sasl_minor, sasl_step); return (0); } #endif if (*var_cyrus_conf_path) { #ifdef SASL_PATH_TYPE_CONFIG /* Cyrus SASL 2.1.22 */ if (sasl_set_path(SASL_PATH_TYPE_CONFIG, var_cyrus_conf_path) != SASL_OK) msg_warn("failed to set Cyrus SASL configuration path: \"%s\"", var_cyrus_conf_path); #else msg_warn("%s is not empty, but setting the Cyrus SASL configuration " "path is not supported with SASL library version %d.%d.%d", VAR_CYRUS_CONF_PATH, SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP); #endif } /* * Initialize the library: load SASL plug-in routines, etc. */ if (msg_verbose) msg_info("%s: SASL config file is %s.conf", myname, path_info); if ((sasl_status = sasl_server_init(callbacks, path_info)) != SASL_OK) { msg_warn("SASL per-process initialization failed: %s", xsasl_cyrus_strerror(sasl_status)); return (0); } /* * Return a generic XSASL_SERVER_IMPL object. We don't need to extend it * with our own methods or data. */ xp = (XSASL_SERVER_IMPL *) mymalloc(sizeof(*xp)); xp->create = xsasl_cyrus_server_create; xp->done = xsasl_cyrus_server_done; return (xp); }