Skip to content

Commit 570d3ec

Browse files
committed
Support building with SSPI support under Windows
1 parent adfedd2 commit 570d3ec

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

config.w32

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function MONGODB_ADD_SOURCES(dir, file_list)
7070
}
7171

7272
ARG_ENABLE("mongodb", "MongoDB support", "no");
73-
ARG_WITH("mongodb-sasl", "MongoDB: Build against Cyrus-SASL", "yes");
73+
ARG_WITH("mongodb-sasl", "MongoDB: Build with SASL (cyrus, sspi)", "yes");
7474
ARG_WITH("mongodb-client-side-encryption", "MongoDB: Enable client-side encryption", "yes");
7575

7676
if (PHP_MONGODB != "no") {
@@ -232,15 +232,21 @@ if (PHP_MONGODB != "no") {
232232
WARNING("mongodb libopenssl support not enabled, libs not found");
233233
}
234234

235-
// TODO: Support building with native GSSAPI (SSPI) on Windows
236235
if (PHP_MONGODB_SASL != "no" &&
237236
CHECK_LIB("libsasl.lib", "mongodb", PHP_MONGODB) &&
238237
CHECK_HEADER_ADD_INCLUDE("sasl/sasl.h", "CFLAGS_MONGODB")) {
239238
mongoc_opts.MONGOC_ENABLE_SASL = 1;
240-
mongoc_opts.MONGOC_ENABLE_SASL_CYRUS = 1;
241239

242-
// Referenced by _mongoc_cyrus_verifyfile_cb in mongoc-cyrus.c on Windows
243-
ADD_FLAG("CFLAGS_MONGODB", "/D MONGOC_CYRUS_PLUGIN_PATH_PREFIX=NULL");
240+
if (PHP_MONGODB_SASL == "yes" || PHP_MONGODB_SASL == "cyrus") {
241+
mongoc_opts.MONGOC_ENABLE_SASL_CYRUS = 1;
242+
243+
// Referenced by _mongoc_cyrus_verifyfile_cb in mongoc-cyrus.c on Windows
244+
ADD_FLAG("CFLAGS_MONGODB", "/D MONGOC_CYRUS_PLUGIN_PATH_PREFIX=NULL");
245+
} else if (PHP_MONGODB_SASL == "sspi") {
246+
mongoc_opts.MONGOC_ENABLE_SASL_SSPI = 1;
247+
} else {
248+
WARNING("mongodb sasl support not enabled, unknown value for PHP_MONGODB_SASL: " + PHP_MONGODB_SASL);
249+
}
244250

245251
if (CHECK_FUNC_IN_HEADER("sasl/sasl.h", "sasl_client_done")) {
246252
mongoc_opts.MONGOC_HAVE_SASL_CLIENT_DONE = 1;

0 commit comments

Comments
 (0)