Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-9.6.x'
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Mar 26, 2024
2 parents 167031f + d32d49b commit fd32c3a
Show file tree
Hide file tree
Showing 20 changed files with 604 additions and 46 deletions.
5 changes: 4 additions & 1 deletion common/dllserver/dllserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,10 @@ void initDllServer(const char * localRoot)
{
CriticalBlock b(dllServerCrit);
::Release(dllServer);
dllServer = new DllServer(localRoot);
if (isContainerized())
dllServer = new SharedVolumeDllServer(localRoot);
else
dllServer = new DllServer(localRoot);
}


Expand Down
23 changes: 14 additions & 9 deletions dali/base/dadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6271,22 +6271,27 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
virtual IDistributedFile &querySubFile(unsigned idx,bool sub) override
{
CriticalBlock block (sect);
if (sub) {
ForEachItemIn(i,subfiles) {
if (sub)
{
unsigned subfilen = idx;
ForEachItemIn(i,subfiles)
{
IDistributedFile &f=subfiles.item(i);
IDistributedSuperFile *super = f.querySuperFile();
if (super) {
if (super)
{
unsigned ns = super->numSubFiles(true);
if (ns>idx)
return super->querySubFile(idx,true);
idx -= ns;
if (ns>subfilen)
return super->querySubFile(subfilen,true);
subfilen -= ns;
}
else if (idx--==0)
else if (subfilen--==0)
return f;
}
// fall through to error
throw makeStringExceptionV(-1,"CDistributedSuperFile::querySubFile(%u) for superfile %s - subfile doesn't exist ", idx, logicalName.get());
}
return subfiles.item(idx);
else
return subfiles.item(idx);
}

virtual IDistributedFile *querySubFileNamed(const char *name, bool sub) override
Expand Down
80 changes: 45 additions & 35 deletions dali/server/daldap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ class CDaliLdapConnection: implements IDaliLdapConnection, public CInterface
{
if (!ldapsecurity||((getLDAPflags()&DLF_ENABLED)==0))
return SecAccess_Full;

bool filescope = key && stricmp(key,"Scope")==0;
bool wuscope = key && stricmp(key,"workunit")==0;

//
// Missing scopes get full access
if (!filescope && !wuscope)
return SecAccess_Full;


StringBuffer username;
StringBuffer password;
if (udesc)
Expand All @@ -114,57 +124,57 @@ class CDaliLdapConnection: implements IDaliLdapConnection, public CInterface
}
else
{
DBGLOG("NULL UserDescriptor in daldap.cpp getPermissions('%s')",key ? key : "NULL");
DBGLOG("NULL UserDescriptor in daldap.cpp getPermissions('%s')", key ? key : "NULL");
}

if (0 == username.length())
{
username.append(filesdefaultuser);
decrypt(password, filesdefaultpassword);
OWARNLOG("Missing credentials, injecting deprecated filesdefaultuser for request %s %s", nullText(key), nullText(obj));
OWARNLOG("Missing credentials, injecting deprecated filesdefaultuser for request %s %s", nullText(key),
nullText(obj));
logNullUser(nullptr);
}

Owned<ISecUser> user = ldapsecurity->createUser(username);
user->setAuthenticateStatus(AS_AUTHENTICATED);

bool filescope = key && stricmp(key,"Scope")==0;
bool wuscope = key && stricmp(key,"workunit")==0;

if (filescope || wuscope) {
SecAccessFlags perm = SecAccess_None;
unsigned start = msTick();
if (filescope)
perm=ldapsecurity->authorizeFileScope(*user, obj);
else if (wuscope)
perm=ldapsecurity->authorizeWorkunitScope(*user, obj);
if (perm == SecAccess_Unavailable)
{
OWARNLOG("LDAP: getPermissions(%s) Unable to get perms for scope=%s user=%s, setting 'SecAccess_None'", nullText(key), nullText(obj), username.str());
perm = SecAccess_None;
}
unsigned taken = msTick()-start;
SecAccessFlags perm = SecAccess_None;
unsigned start = msTick();
if (filescope)
perm = ldapsecurity->authorizeFileScope(*user, obj);
else if (wuscope)
perm = ldapsecurity->authorizeWorkunitScope(*user, obj);
if (perm == SecAccess_Unavailable)
{
OWARNLOG("LDAP: getPermissions(%s) Unable to get perms for scope=%s user=%s, setting 'SecAccess_None'",
nullText(key), nullText(obj), username.str());
perm = SecAccess_None;
}
unsigned taken = msTick() - start;
#ifndef _DEBUG
if (taken>100)
if (taken>100)
#endif
{
PROGLOG("LDAP: getPermissions(%s) scope=%s user=%s returns %d in %d ms", nullText(key), nullText(obj),
username.str(), perm, taken);
}
if (auditflags & DALI_LDAP_AUDIT_REPORT)
{
StringBuffer auditstr;
if ((auditflags & DALI_LDAP_READ_WANTED) && !HASREADPERMISSION(perm))
auditstr.append("Lookup Access Denied");
else if ((auditflags & DALI_LDAP_WRITE_WANTED) && !HASWRITEPERMISSION(perm))
auditstr.append("Create Access Denied");
if (auditstr.length())
{
PROGLOG("LDAP: getPermissions(%s) scope=%s user=%s returns %d in %d ms", nullText(key), nullText(obj),username.str(),perm,taken);
}
if (auditflags&DALI_LDAP_AUDIT_REPORT) {
StringBuffer auditstr;
if ((auditflags&DALI_LDAP_READ_WANTED)&&!HASREADPERMISSION(perm))
auditstr.append("Lookup Access Denied");
else if ((auditflags&DALI_LDAP_WRITE_WANTED)&&!HASWRITEPERMISSION(perm))
auditstr.append("Create Access Denied");
if (auditstr.length()) {
auditstr.append(":\n\tProcess:\tdaserver");
auditstr.appendf("\n\tUser:\t%s",username.str());
auditstr.appendf("\n\tScope:\t%s\n",obj?obj:"");
SYSLOG(AUDIT_TYPE_ACCESS_FAILURE,auditstr.str());
}
auditstr.append(":\n\tProcess:\tdaserver");
auditstr.appendf("\n\tUser:\t%s", username.str());
auditstr.appendf("\n\tScope:\t%s\n", obj ? obj : "");
SYSLOG(AUDIT_TYPE_ACCESS_FAILURE, auditstr.str());
}
return perm;
}
return SecAccess_Full;
return perm;
}
bool clearPermissionsCache(IUserDescriptor *udesc)
{
Expand Down
1 change: 1 addition & 0 deletions ecl/hqlcpp/hqlres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ bool ResourceManager::flush(StringBuffer &filename, const char *basename, bool f
}
fwrite(s.data.get(), 1, s.data.length(), bin);
fclose(bin);
fprintf(f, " .size %s,%u\n", label.str(), (unsigned)s.data.length());
}
fclose(f);
#endif
Expand Down
2 changes: 1 addition & 1 deletion system/jlib/jstats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2892,7 +2892,7 @@ void CRuntimeStatisticCollection::deserializeMerge(MemoryBuffer& in)
in.read(hasNested);
if (hasNested)
{
ensureNested().deserializeMerge(in);
ensureNested().deserialize(in);
}
}

Expand Down
20 changes: 20 additions & 0 deletions vcpkg_overlays/libxml2/disable-docs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f922d5ab..70466bc7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -599,15 +599,5 @@ if(LIBXML2_WITH_PYTHON)
endif()

-install(FILES doc/xml2-config.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation)
-install(FILES doc/xmlcatalog.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation)
-install(FILES doc/xmllint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation)
-install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT documentation
- PATTERN "Makefile.*" EXCLUDE
- PATTERN "*.1" EXCLUDE
- PATTERN "*.py" EXCLUDE
- PATTERN "*.res" EXCLUDE
- PATTERN "*.xml" EXCLUDE
- PATTERN "*.xsl" EXCLUDE)

configure_package_config_file(
libxml2-config.cmake.cmake.in libxml2-config.cmake
108 changes: 108 additions & 0 deletions vcpkg_overlays/libxml2/fix_cmakelist.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f922d5ab..685964b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -420,15 +420,15 @@ endif()
if(LIBXML2_WITH_ICU)
target_link_libraries(LibXml2 PRIVATE ICU::data ICU::i18n ICU::uc)
if(WIN32)
- set(ICU_LIBS "-licudt -licuin -licuuc")
+ set(ICU_LIBS "icu-i18n")
else()
- set(ICU_LIBS "-licudata -licui18n -licuuc")
+ set(ICU_LIBS "icu-i18n")
endif()
endif()

if(LIBXML2_WITH_LZMA)
target_link_libraries(LibXml2 PRIVATE LibLZMA::LibLZMA)
- set(LZMA_LIBS "-llzma")
+ set(LZMA_LIBS "liblzma")
endif()

if(LIBXML2_WITH_THREADS)
@@ -438,7 +438,7 @@ endif()

if(LIBXML2_WITH_ZLIB)
target_link_libraries(LibXml2 PRIVATE ZLIB::ZLIB)
- set(Z_LIBS "-lz")
+ set(Z_LIBS "zlib")
endif()

set_target_properties(
@@ -490,23 +490,9 @@ set_target_properties(
SOVERSION ${LIBXML_MAJOR_VERSION}
)

+set(XML_LIB_NAME xml2)
if(MSVC)
- if(BUILD_SHARED_LIBS)
- set_target_properties(
- LibXml2
- PROPERTIES
- DEBUG_POSTFIX d
- )
- else()
- set_target_properties(
- LibXml2
- PROPERTIES
- DEBUG_POSTFIX sd
- MINSIZEREL_POSTFIX s
- RELEASE_POSTFIX s
- RELWITHDEBINFO_POSTFIX s
- )
- endif()
+ set(XML_LIB_NAME libxml2)
endif()

install(FILES ${LIBXML2_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development)
@@ -654,30 +640,30 @@ install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/libxml2 COMPONEN

configure_package_config_file(
libxml2-config.cmake.cmake.in libxml2-config.cmake
- INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config.cmake
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
COMPONENT development
)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake
VERSION ${PROJECT_VERSION}
- COMPATIBILITY ExactVersion
+ COMPATIBILITY SameMinorVersion
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
COMPONENT development
)

install(
EXPORT LibXml2
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2
NAMESPACE LibXml2::
FILE libxml2-export.cmake
COMPONENT development
diff --git a/libxml-2.0.pc.in b/libxml-2.0.pc.in
index 2653a7c5..2eb2f362 100644
--- a/libxml-2.0.pc.in
+++ b/libxml-2.0.pc.in
@@ -8,6 +8,7 @@ Name: libXML
Version: @VERSION@
Description: libXML library version2.
Requires:
-Libs: -L${libdir} @XML_LIBS@
-Libs.private: @XML_PRIVATE_LIBS@ @LIBS@
+Requires.private: @ICU_LIBS@ @Z_LIBS@ @LZMA_LIBS@
+Libs: -L${libdir} -l@XML_LIB_NAME@
+Libs.private: @THREAD_LIBS@ @ICONV_LIBS@ @LIBM@ @WIN32_EXTRA_LIBADD@ @LIBS@
Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@
90 changes: 90 additions & 0 deletions vcpkg_overlays/libxml2/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.gnome.org/
OUT_SOURCE_PATH SOURCE_PATH
REPO GNOME/libxml2
REF f507d167f1755b7eaea09fb1a44d29aab828b6d1
SHA512 2ac3dcab31111f608a3fe33dde492c9653ad2bd49a792373acdd03d2787e1a4ef70eeb7a3d47cf67eefd43aee2ab75ec50b36cdcd124445ca206de924abb6021
HEAD_REF master
PATCHES
disable-docs.patch
fix_cmakelist.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"ftp" LIBXML2_WITH_FTP
"http" LIBXML2_WITH_HTTP
"iconv" LIBXML2_WITH_ICONV
"legacy" LIBXML2_WITH_LEGACY
"lzma" LIBXML2_WITH_LZMA
"zlib" LIBXML2_WITH_ZLIB
"tools" LIBXML2_WITH_PROGRAMS
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DLIBXML2_WITH_TESTS=OFF
-DLIBXML2_WITH_HTML=ON
-DLIBXML2_WITH_C14N=ON
-DLIBXML2_WITH_CATALOG=ON
-DLIBXML2_WITH_DEBUG=ON
-DLIBXML2_WITH_ISO8859X=ON
-DLIBXML2_WITH_ICU=OFF # Culprit of linkage issues? Solving this is probably another PR
-DLIBXML2_WITH_MEM_DEBUG=OFF
-DLIBXML2_WITH_MODULES=ON
-DLIBXML2_WITH_OUTPUT=ON
-DLIBXML2_WITH_PATTERN=ON
-DLIBXML2_WITH_PUSH=ON
-DLIBXML2_WITH_PYTHON=OFF
-DLIBXML2_WITH_READER=ON
-DLIBXML2_WITH_REGEXPS=ON
-DLIBXML2_WITH_RUN_DEBUG=OFF
-DLIBXML2_WITH_SAX1=ON
-DLIBXML2_WITH_SCHEMAS=ON
-DLIBXML2_WITH_SCHEMATRON=ON
-DLIBXML2_WITH_THREADS=ON
-DLIBXML2_WITH_THREAD_ALLOC=OFF
-DLIBXML2_WITH_TREE=ON
-DLIBXML2_WITH_VALID=ON
-DLIBXML2_WITH_WRITER=ON
-DLIBXML2_WITH_XINCLUDE=ON
-DLIBXML2_WITH_XPATH=ON
-DLIBXML2_WITH_XPTR=ON
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/libxml2")
vcpkg_fixup_pkgconfig()

vcpkg_copy_pdbs()

if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES xmllint xmlcatalog AUTO_CLEAN)
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(_file "${CURRENT_PACKAGES_DIR}/include/libxml2/libxml/xmlexports.h")
file(READ "${_file}" _contents)
string(REPLACE "#ifdef LIBXML_STATIC" "#undef LIBXML_STATIC\n#define LIBXML_STATIC\n#ifdef LIBXML_STATIC" _contents "${_contents}")
file(WRITE "${_file}" "${_contents}")
endif()

file(COPY "${CURRENT_PACKAGES_DIR}/include/libxml2/" DESTINATION "${CURRENT_PACKAGES_DIR}/include") # TODO: Fix usage in all dependent ports hardcoding the wrong include path.

# Cleanup
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/xml2Conf.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/xml2Conf.sh")

file(COPY
"${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake"
"${CMAKE_CURRENT_LIST_DIR}/usage"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
)
file(INSTALL "${SOURCE_PATH}/Copyright" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Loading

0 comments on commit fd32c3a

Please sign in to comment.