@zerodensity/smb-cpp 0.0.0-bootstrap.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -3
- package/darwin_arm64/libsmb2.1.dylib +0 -0
- package/darwin_arm64/libsmb2.6.1.0.dylib +0 -0
- package/darwin_arm64/libsmb2.dylib +0 -0
- package/darwin_arm64/smb_server_cpp_darwin_arm64 +0 -0
- package/darwin_arm64/third-party/libsmb2/COPYING +24 -0
- package/darwin_arm64/third-party/libsmb2/LICENCE-LGPL-2.1.txt +502 -0
- package/darwin_arm64/third-party/libsmb2/NOTICE.txt +13 -0
- package/darwin_arm64/third-party/libsmb2/README +413 -0
- package/darwin_arm64/third-party/libsmb2/source/CMakeLists.txt +205 -0
- package/darwin_arm64/third-party/libsmb2/source/COPYING +24 -0
- package/darwin_arm64/third-party/libsmb2/source/LICENCE-LGPL-2.1.txt +502 -0
- package/darwin_arm64/third-party/libsmb2/source/Makefile.am +15 -0
- package/darwin_arm64/third-party/libsmb2/source/Makefile.platform +112 -0
- package/darwin_arm64/third-party/libsmb2/source/README +413 -0
- package/darwin_arm64/third-party/libsmb2/source/Xbox/libsmb2.sln +25 -0
- package/darwin_arm64/third-party/libsmb2/source/Xbox/libsmb2.vcxproj +248 -0
- package/darwin_arm64/third-party/libsmb2/source/Xbox/libsmb2.vcxproj.filters +304 -0
- package/darwin_arm64/third-party/libsmb2/source/Xbox 360/libsmb2.sln +32 -0
- package/darwin_arm64/third-party/libsmb2/source/Xbox 360/libsmb2.vcxproj +327 -0
- package/darwin_arm64/third-party/libsmb2/source/Xbox 360/libsmb2.vcxproj.filters +268 -0
- package/darwin_arm64/third-party/libsmb2/source/bootstrap +2 -0
- package/darwin_arm64/third-party/libsmb2/source/cmake/ConfigureChecks.cmake +63 -0
- package/darwin_arm64/third-party/libsmb2/source/cmake/FindSMB2.cmake +37 -0
- package/darwin_arm64/third-party/libsmb2/source/cmake/Modules/FindGSSAPI.cmake +30 -0
- package/darwin_arm64/third-party/libsmb2/source/cmake/Modules/FindLibKrb5.cmake +44 -0
- package/darwin_arm64/third-party/libsmb2/source/cmake/config.h.cmake +126 -0
- package/darwin_arm64/third-party/libsmb2/source/cmake/libsmb2.pc.cmake +14 -0
- package/darwin_arm64/third-party/libsmb2/source/component.mk +5 -0
- package/darwin_arm64/third-party/libsmb2/source/configure.ac +184 -0
- package/darwin_arm64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareAdd.yaml +9 -0
- package/darwin_arm64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareCheck.yaml +4 -0
- package/darwin_arm64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareDel.yaml +5 -0
- package/darwin_arm64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareDelSticky.yaml +5 -0
- package/darwin_arm64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareEnum.yaml +7 -0
- package/darwin_arm64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareGetInfo.yaml +6 -0
- package/darwin_arm64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareSetInfo.yaml +11 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/CMakeLists.txt +28 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/Makefile.am +54 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/dcerpc.c +254 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/picow/CMakeLists.txt +72 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/picow/README.md +2 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/picow/main.cpp +119 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/picow/smb-ls-sync.c +0 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-CMD-FIND.c +335 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-cat-async.c +183 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-cat-sync.c +105 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-ftruncate-sync.c +87 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-ls-async.c +185 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-ls-epoll.c +234 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-lsa-lookupsids.c +292 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-lseek-sync.c +101 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-notify.c +183 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-put-async.c +175 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-put-sync.c +100 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-raw-fsstat-async.c +353 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-raw-getsd-async.c +401 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-raw-stat-async.c +448 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-readlink.c +80 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-rename-sync.c +80 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-server-sync.c +497 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-share-enum-sync.c +146 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-share-enum.c +208 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-share-info.c +255 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-stat-sync.c +103 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-statvfs-sync.c +85 -0
- package/darwin_arm64/third-party/libsmb2/source/examples/smb2-truncate-sync.c +78 -0
- package/darwin_arm64/third-party/libsmb2/source/idf_component.yml +5 -0
- package/darwin_arm64/third-party/libsmb2/source/include/Makefile.am +15 -0
- package/darwin_arm64/third-party/libsmb2/source/include/amiga_os/config.h +139 -0
- package/darwin_arm64/third-party/libsmb2/source/include/apple/config.h +139 -0
- package/darwin_arm64/third-party/libsmb2/source/include/asprintf.h +65 -0
- package/darwin_arm64/third-party/libsmb2/source/include/esp/config.h +139 -0
- package/darwin_arm64/third-party/libsmb2/source/include/libsmb2-private.h +670 -0
- package/darwin_arm64/third-party/libsmb2/source/include/module.modulemap +21 -0
- package/darwin_arm64/third-party/libsmb2/source/include/picow/FreeRTOSConfig.h +143 -0
- package/darwin_arm64/third-party/libsmb2/source/include/picow/README.md +2 -0
- package/darwin_arm64/third-party/libsmb2/source/include/picow/config.h +139 -0
- package/darwin_arm64/third-party/libsmb2/source/include/picow/lwipopts.h +27 -0
- package/darwin_arm64/third-party/libsmb2/source/include/picow/lwipopts_examples_common.h +90 -0
- package/darwin_arm64/third-party/libsmb2/source/include/portable-endian.h +377 -0
- package/darwin_arm64/third-party/libsmb2/source/include/ps3/config.h +139 -0
- package/darwin_arm64/third-party/libsmb2/source/include/slist.h +63 -0
- package/darwin_arm64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/darwin_arm64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc-srvsvc.h +276 -0
- package/darwin_arm64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc.h +203 -0
- package/darwin_arm64/third-party/libsmb2/source/include/smb2/libsmb2-raw.h +497 -0
- package/darwin_arm64/third-party/libsmb2/source/include/smb2/libsmb2.h +1409 -0
- package/darwin_arm64/third-party/libsmb2/source/include/smb2/smb2-errors.h +549 -0
- package/darwin_arm64/third-party/libsmb2/source/include/smb2/smb2-ioctl.h +83 -0
- package/darwin_arm64/third-party/libsmb2/source/include/smb2/smb2.h +1251 -0
- package/darwin_arm64/third-party/libsmb2/source/include/xbox/config.h +139 -0
- package/darwin_arm64/third-party/libsmb2/source/include/xbox 360/config.h +139 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/CMakeLists.txt +260 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/Makefile.AMIGA +46 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/Makefile.AMIGA_AROS +59 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/Makefile.AMIGA_OS3 +59 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/Makefile.PS3_PPU +100 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/Makefile.am +85 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/aes.c +33 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/aes.h +29 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/aes128ccm.c +185 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/aes128ccm.h +28 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/aes_apple.c +70 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/aes_apple.h +34 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/aes_reference.c +560 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/aes_reference.h +49 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/alloc.c +154 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/asn1-ber.c +1078 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/asn1-ber.h +161 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/compat.c +599 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/compat.h +829 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/dcerpc-lsa.c +641 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/dcerpc-srvsvc.c +885 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/dcerpc.c +2513 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/dreamcast/vfs.c +328 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/dreamcast/vfs.h +15 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/errors.c +1192 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/hmac-md5.c +84 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/hmac-md5.h +42 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/hmac.c +245 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/init.c +778 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/krb5-wrapper.c +1072 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/krb5-wrapper.h +134 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/libsmb2.c +4292 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/libsmb2.syms +168 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/md4.h +43 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/md4c.c +289 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/md5.c +249 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/md5.h +76 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ntlmssp.c +1380 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ntlmssp.h +84 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/pdu.c +1159 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ps2/TODO +6 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ps2/imports.lst +84 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ps2/irx_imports.h +28 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ps2/ps2smb2.h +35 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ps2/smb2_fio.c +816 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ps2/smb2_fio.h +15 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/ps2/smb2man.c +69 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/sha-private.h +28 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/sha.h +334 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/sha1.c +450 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/sha224-256.c +611 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/sha384-512.c +1059 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-close.c +240 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-create.c +508 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-echo.c +202 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-error.c +157 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-flush.c +207 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-ioctl.c +445 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-lock.c +312 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-logoff.c +190 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-negotiate.c +646 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-notify-change.c +278 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-oplock-break.c +543 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-query-directory.c +580 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-query-info.c +753 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-read.c +391 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-session-setup.c +331 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-set-info.c +361 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-tree-connect.c +278 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-tree-disconnect.c +171 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-cmd-write.c +319 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-data-file-info.c +537 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-data-filesystem-info.c +384 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-data-reparse-point.c +117 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-data-security-descriptor.c +361 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-share-enum.c +181 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-signing.c +279 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb2-signing.h +51 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb3-seal.c +165 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/smb3-seal.h +43 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/socket.c +1502 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/spnego-wrapper.c +634 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/spnego-wrapper.h +74 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/sync.c +988 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/timestamps.c +70 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/unicode.c +307 -0
- package/darwin_arm64/third-party/libsmb2/source/lib/usha.c +345 -0
- package/darwin_arm64/third-party/libsmb2/source/libsmb2.pc.in +14 -0
- package/darwin_arm64/third-party/libsmb2/source/packaging/RPM/libsmb2.spec.in +135 -0
- package/darwin_arm64/third-party/libsmb2/source/packaging/RPM/makerpms.sh +114 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/Makefile.am +34 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/README +28 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/aes128ccm-test.c +119 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/functions.sh +11 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/ld_sockerr.c +58 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/metastat-0202-censored.c +136 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/ntlmssp_generate_blob.c +123 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/prog_cat.c +188 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/prog_cat_cancel.c +203 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/prog_ls.c +189 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/prog_mkdir.c +85 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/prog_rmdir.c +84 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/smb2-dcerpc-coder-test.c +635 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0100_ls_basic.sh +22 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0101_ls_basic_valgrind.sh +23 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0102_ls_basic_socket_error.sh +16 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0103_ls_basic_valgrind_malloc_error.sh +25 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0200_mkdir.sh +15 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0201_mkdir_valgrind.sh +15 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0210_cp_basic.sh +25 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0211_cp_valgrind.sh +26 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0212_cp_valgrind_socket_error.sh +29 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0300_cat_basic.sh +13 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0301_cat_valgrind.sh +13 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0302_cat_valgrind_socket_error.sh +18 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0310_cancel_pdu.sh +13 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_0400_overdrawn_0202.sh +25 -0
- package/darwin_arm64/third-party/libsmb2/source/tests/test_900_dcerpc.sh +10 -0
- package/darwin_arm64/third-party/libsmb2/source/utils/Makefile.am +11 -0
- package/darwin_arm64/third-party/libsmb2/source/utils/smb2-cp.c +265 -0
- package/darwin_arm64/third-party/libsmb2/source/utils/smb2-ls.c +135 -0
- package/linux_x64/libsmb2.so +0 -0
- package/linux_x64/libsmb2.so.1 +0 -0
- package/linux_x64/libsmb2.so.6.1.0 +0 -0
- package/linux_x64/smb_server_cpp_linux_x64 +0 -0
- package/linux_x64/third-party/libsmb2/COPYING +24 -0
- package/linux_x64/third-party/libsmb2/LICENCE-LGPL-2.1.txt +502 -0
- package/linux_x64/third-party/libsmb2/NOTICE.txt +13 -0
- package/linux_x64/third-party/libsmb2/README +413 -0
- package/linux_x64/third-party/libsmb2/source/CMakeLists.txt +205 -0
- package/linux_x64/third-party/libsmb2/source/COPYING +24 -0
- package/linux_x64/third-party/libsmb2/source/LICENCE-LGPL-2.1.txt +502 -0
- package/linux_x64/third-party/libsmb2/source/Makefile.am +15 -0
- package/linux_x64/third-party/libsmb2/source/Makefile.platform +112 -0
- package/linux_x64/third-party/libsmb2/source/README +413 -0
- package/linux_x64/third-party/libsmb2/source/Xbox/libsmb2.sln +25 -0
- package/linux_x64/third-party/libsmb2/source/Xbox/libsmb2.vcxproj +248 -0
- package/linux_x64/third-party/libsmb2/source/Xbox/libsmb2.vcxproj.filters +304 -0
- package/linux_x64/third-party/libsmb2/source/Xbox 360/libsmb2.sln +32 -0
- package/linux_x64/third-party/libsmb2/source/Xbox 360/libsmb2.vcxproj +327 -0
- package/linux_x64/third-party/libsmb2/source/Xbox 360/libsmb2.vcxproj.filters +268 -0
- package/linux_x64/third-party/libsmb2/source/bootstrap +2 -0
- package/linux_x64/third-party/libsmb2/source/cmake/ConfigureChecks.cmake +63 -0
- package/linux_x64/third-party/libsmb2/source/cmake/FindSMB2.cmake +37 -0
- package/linux_x64/third-party/libsmb2/source/cmake/Modules/FindGSSAPI.cmake +30 -0
- package/linux_x64/third-party/libsmb2/source/cmake/Modules/FindLibKrb5.cmake +44 -0
- package/linux_x64/third-party/libsmb2/source/cmake/config.h.cmake +126 -0
- package/linux_x64/third-party/libsmb2/source/cmake/libsmb2.pc.cmake +14 -0
- package/linux_x64/third-party/libsmb2/source/component.mk +5 -0
- package/linux_x64/third-party/libsmb2/source/configure.ac +184 -0
- package/linux_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareAdd.yaml +9 -0
- package/linux_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareCheck.yaml +4 -0
- package/linux_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareDel.yaml +5 -0
- package/linux_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareDelSticky.yaml +5 -0
- package/linux_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareEnum.yaml +7 -0
- package/linux_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareGetInfo.yaml +6 -0
- package/linux_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareSetInfo.yaml +11 -0
- package/linux_x64/third-party/libsmb2/source/examples/CMakeLists.txt +28 -0
- package/linux_x64/third-party/libsmb2/source/examples/Makefile.am +54 -0
- package/linux_x64/third-party/libsmb2/source/examples/dcerpc.c +254 -0
- package/linux_x64/third-party/libsmb2/source/examples/picow/CMakeLists.txt +72 -0
- package/linux_x64/third-party/libsmb2/source/examples/picow/README.md +2 -0
- package/linux_x64/third-party/libsmb2/source/examples/picow/main.cpp +119 -0
- package/linux_x64/third-party/libsmb2/source/examples/picow/smb-ls-sync.c +0 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-CMD-FIND.c +335 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-cat-async.c +183 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-cat-sync.c +105 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-ftruncate-sync.c +87 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-ls-async.c +185 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-ls-epoll.c +234 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-lsa-lookupsids.c +292 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-lseek-sync.c +101 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-notify.c +183 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-put-async.c +175 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-put-sync.c +100 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-raw-fsstat-async.c +353 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-raw-getsd-async.c +401 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-raw-stat-async.c +448 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-readlink.c +80 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-rename-sync.c +80 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-server-sync.c +497 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-share-enum-sync.c +146 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-share-enum.c +208 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-share-info.c +255 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-stat-sync.c +103 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-statvfs-sync.c +85 -0
- package/linux_x64/third-party/libsmb2/source/examples/smb2-truncate-sync.c +78 -0
- package/linux_x64/third-party/libsmb2/source/idf_component.yml +5 -0
- package/linux_x64/third-party/libsmb2/source/include/Makefile.am +15 -0
- package/linux_x64/third-party/libsmb2/source/include/amiga_os/config.h +139 -0
- package/linux_x64/third-party/libsmb2/source/include/apple/config.h +139 -0
- package/linux_x64/third-party/libsmb2/source/include/asprintf.h +65 -0
- package/linux_x64/third-party/libsmb2/source/include/esp/config.h +139 -0
- package/linux_x64/third-party/libsmb2/source/include/libsmb2-private.h +670 -0
- package/linux_x64/third-party/libsmb2/source/include/module.modulemap +21 -0
- package/linux_x64/third-party/libsmb2/source/include/picow/FreeRTOSConfig.h +143 -0
- package/linux_x64/third-party/libsmb2/source/include/picow/README.md +2 -0
- package/linux_x64/third-party/libsmb2/source/include/picow/config.h +139 -0
- package/linux_x64/third-party/libsmb2/source/include/picow/lwipopts.h +27 -0
- package/linux_x64/third-party/libsmb2/source/include/picow/lwipopts_examples_common.h +90 -0
- package/linux_x64/third-party/libsmb2/source/include/portable-endian.h +377 -0
- package/linux_x64/third-party/libsmb2/source/include/ps3/config.h +139 -0
- package/linux_x64/third-party/libsmb2/source/include/slist.h +63 -0
- package/linux_x64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/linux_x64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc-srvsvc.h +276 -0
- package/linux_x64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc.h +203 -0
- package/linux_x64/third-party/libsmb2/source/include/smb2/libsmb2-raw.h +497 -0
- package/linux_x64/third-party/libsmb2/source/include/smb2/libsmb2.h +1409 -0
- package/linux_x64/third-party/libsmb2/source/include/smb2/smb2-errors.h +549 -0
- package/linux_x64/third-party/libsmb2/source/include/smb2/smb2-ioctl.h +83 -0
- package/linux_x64/third-party/libsmb2/source/include/smb2/smb2.h +1251 -0
- package/linux_x64/third-party/libsmb2/source/include/xbox/config.h +139 -0
- package/linux_x64/third-party/libsmb2/source/include/xbox 360/config.h +139 -0
- package/linux_x64/third-party/libsmb2/source/lib/CMakeLists.txt +260 -0
- package/linux_x64/third-party/libsmb2/source/lib/Makefile.AMIGA +46 -0
- package/linux_x64/third-party/libsmb2/source/lib/Makefile.AMIGA_AROS +59 -0
- package/linux_x64/third-party/libsmb2/source/lib/Makefile.AMIGA_OS3 +59 -0
- package/linux_x64/third-party/libsmb2/source/lib/Makefile.PS3_PPU +100 -0
- package/linux_x64/third-party/libsmb2/source/lib/Makefile.am +85 -0
- package/linux_x64/third-party/libsmb2/source/lib/aes.c +33 -0
- package/linux_x64/third-party/libsmb2/source/lib/aes.h +29 -0
- package/linux_x64/third-party/libsmb2/source/lib/aes128ccm.c +185 -0
- package/linux_x64/third-party/libsmb2/source/lib/aes128ccm.h +28 -0
- package/linux_x64/third-party/libsmb2/source/lib/aes_apple.c +70 -0
- package/linux_x64/third-party/libsmb2/source/lib/aes_apple.h +34 -0
- package/linux_x64/third-party/libsmb2/source/lib/aes_reference.c +560 -0
- package/linux_x64/third-party/libsmb2/source/lib/aes_reference.h +49 -0
- package/linux_x64/third-party/libsmb2/source/lib/alloc.c +154 -0
- package/linux_x64/third-party/libsmb2/source/lib/asn1-ber.c +1078 -0
- package/linux_x64/third-party/libsmb2/source/lib/asn1-ber.h +161 -0
- package/linux_x64/third-party/libsmb2/source/lib/compat.c +599 -0
- package/linux_x64/third-party/libsmb2/source/lib/compat.h +829 -0
- package/linux_x64/third-party/libsmb2/source/lib/dcerpc-lsa.c +641 -0
- package/linux_x64/third-party/libsmb2/source/lib/dcerpc-srvsvc.c +885 -0
- package/linux_x64/third-party/libsmb2/source/lib/dcerpc.c +2513 -0
- package/linux_x64/third-party/libsmb2/source/lib/dreamcast/vfs.c +328 -0
- package/linux_x64/third-party/libsmb2/source/lib/dreamcast/vfs.h +15 -0
- package/linux_x64/third-party/libsmb2/source/lib/errors.c +1192 -0
- package/linux_x64/third-party/libsmb2/source/lib/hmac-md5.c +84 -0
- package/linux_x64/third-party/libsmb2/source/lib/hmac-md5.h +42 -0
- package/linux_x64/third-party/libsmb2/source/lib/hmac.c +245 -0
- package/linux_x64/third-party/libsmb2/source/lib/init.c +778 -0
- package/linux_x64/third-party/libsmb2/source/lib/krb5-wrapper.c +1072 -0
- package/linux_x64/third-party/libsmb2/source/lib/krb5-wrapper.h +134 -0
- package/linux_x64/third-party/libsmb2/source/lib/libsmb2.c +4292 -0
- package/linux_x64/third-party/libsmb2/source/lib/libsmb2.syms +168 -0
- package/linux_x64/third-party/libsmb2/source/lib/md4.h +43 -0
- package/linux_x64/third-party/libsmb2/source/lib/md4c.c +289 -0
- package/linux_x64/third-party/libsmb2/source/lib/md5.c +249 -0
- package/linux_x64/third-party/libsmb2/source/lib/md5.h +76 -0
- package/linux_x64/third-party/libsmb2/source/lib/ntlmssp.c +1380 -0
- package/linux_x64/third-party/libsmb2/source/lib/ntlmssp.h +84 -0
- package/linux_x64/third-party/libsmb2/source/lib/pdu.c +1159 -0
- package/linux_x64/third-party/libsmb2/source/lib/ps2/TODO +6 -0
- package/linux_x64/third-party/libsmb2/source/lib/ps2/imports.lst +84 -0
- package/linux_x64/third-party/libsmb2/source/lib/ps2/irx_imports.h +28 -0
- package/linux_x64/third-party/libsmb2/source/lib/ps2/ps2smb2.h +35 -0
- package/linux_x64/third-party/libsmb2/source/lib/ps2/smb2_fio.c +816 -0
- package/linux_x64/third-party/libsmb2/source/lib/ps2/smb2_fio.h +15 -0
- package/linux_x64/third-party/libsmb2/source/lib/ps2/smb2man.c +69 -0
- package/linux_x64/third-party/libsmb2/source/lib/sha-private.h +28 -0
- package/linux_x64/third-party/libsmb2/source/lib/sha.h +334 -0
- package/linux_x64/third-party/libsmb2/source/lib/sha1.c +450 -0
- package/linux_x64/third-party/libsmb2/source/lib/sha224-256.c +611 -0
- package/linux_x64/third-party/libsmb2/source/lib/sha384-512.c +1059 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-close.c +240 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-create.c +508 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-echo.c +202 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-error.c +157 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-flush.c +207 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-ioctl.c +445 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-lock.c +312 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-logoff.c +190 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-negotiate.c +646 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-notify-change.c +278 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-oplock-break.c +543 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-query-directory.c +580 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-query-info.c +753 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-read.c +391 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-session-setup.c +331 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-set-info.c +361 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-tree-connect.c +278 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-tree-disconnect.c +171 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-cmd-write.c +319 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-data-file-info.c +537 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-data-filesystem-info.c +384 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-data-reparse-point.c +117 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-data-security-descriptor.c +361 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-share-enum.c +181 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-signing.c +279 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb2-signing.h +51 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb3-seal.c +165 -0
- package/linux_x64/third-party/libsmb2/source/lib/smb3-seal.h +43 -0
- package/linux_x64/third-party/libsmb2/source/lib/socket.c +1502 -0
- package/linux_x64/third-party/libsmb2/source/lib/spnego-wrapper.c +634 -0
- package/linux_x64/third-party/libsmb2/source/lib/spnego-wrapper.h +74 -0
- package/linux_x64/third-party/libsmb2/source/lib/sync.c +988 -0
- package/linux_x64/third-party/libsmb2/source/lib/timestamps.c +70 -0
- package/linux_x64/third-party/libsmb2/source/lib/unicode.c +307 -0
- package/linux_x64/third-party/libsmb2/source/lib/usha.c +345 -0
- package/linux_x64/third-party/libsmb2/source/libsmb2.pc.in +14 -0
- package/linux_x64/third-party/libsmb2/source/packaging/RPM/libsmb2.spec.in +135 -0
- package/linux_x64/third-party/libsmb2/source/packaging/RPM/makerpms.sh +114 -0
- package/linux_x64/third-party/libsmb2/source/tests/Makefile.am +34 -0
- package/linux_x64/third-party/libsmb2/source/tests/README +28 -0
- package/linux_x64/third-party/libsmb2/source/tests/aes128ccm-test.c +119 -0
- package/linux_x64/third-party/libsmb2/source/tests/functions.sh +11 -0
- package/linux_x64/third-party/libsmb2/source/tests/ld_sockerr.c +58 -0
- package/linux_x64/third-party/libsmb2/source/tests/metastat-0202-censored.c +136 -0
- package/linux_x64/third-party/libsmb2/source/tests/ntlmssp_generate_blob.c +123 -0
- package/linux_x64/third-party/libsmb2/source/tests/prog_cat.c +188 -0
- package/linux_x64/third-party/libsmb2/source/tests/prog_cat_cancel.c +203 -0
- package/linux_x64/third-party/libsmb2/source/tests/prog_ls.c +189 -0
- package/linux_x64/third-party/libsmb2/source/tests/prog_mkdir.c +85 -0
- package/linux_x64/third-party/libsmb2/source/tests/prog_rmdir.c +84 -0
- package/linux_x64/third-party/libsmb2/source/tests/smb2-dcerpc-coder-test.c +635 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0100_ls_basic.sh +22 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0101_ls_basic_valgrind.sh +23 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0102_ls_basic_socket_error.sh +16 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0103_ls_basic_valgrind_malloc_error.sh +25 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0200_mkdir.sh +15 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0201_mkdir_valgrind.sh +15 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0210_cp_basic.sh +25 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0211_cp_valgrind.sh +26 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0212_cp_valgrind_socket_error.sh +29 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0300_cat_basic.sh +13 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0301_cat_valgrind.sh +13 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0302_cat_valgrind_socket_error.sh +18 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0310_cancel_pdu.sh +13 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_0400_overdrawn_0202.sh +25 -0
- package/linux_x64/third-party/libsmb2/source/tests/test_900_dcerpc.sh +10 -0
- package/linux_x64/third-party/libsmb2/source/utils/Makefile.am +11 -0
- package/linux_x64/third-party/libsmb2/source/utils/smb2-cp.c +265 -0
- package/linux_x64/third-party/libsmb2/source/utils/smb2-ls.c +135 -0
- package/package.json +10 -4
- package/smb2.proto +164 -0
- package/win32_x64/smb2.dll +0 -0
- package/win32_x64/smb_server_cpp_win32_x64.exe +0 -0
- package/win32_x64/third-party/libsmb2/COPYING +24 -0
- package/win32_x64/third-party/libsmb2/LICENCE-LGPL-2.1.txt +502 -0
- package/win32_x64/third-party/libsmb2/NOTICE.txt +13 -0
- package/win32_x64/third-party/libsmb2/README +413 -0
- package/win32_x64/third-party/libsmb2/source/CMakeLists.txt +205 -0
- package/win32_x64/third-party/libsmb2/source/COPYING +24 -0
- package/win32_x64/third-party/libsmb2/source/LICENCE-LGPL-2.1.txt +502 -0
- package/win32_x64/third-party/libsmb2/source/Makefile.am +15 -0
- package/win32_x64/third-party/libsmb2/source/Makefile.platform +112 -0
- package/win32_x64/third-party/libsmb2/source/README +413 -0
- package/win32_x64/third-party/libsmb2/source/Xbox/libsmb2.sln +25 -0
- package/win32_x64/third-party/libsmb2/source/Xbox/libsmb2.vcxproj +248 -0
- package/win32_x64/third-party/libsmb2/source/Xbox/libsmb2.vcxproj.filters +304 -0
- package/win32_x64/third-party/libsmb2/source/Xbox 360/libsmb2.sln +32 -0
- package/win32_x64/third-party/libsmb2/source/Xbox 360/libsmb2.vcxproj +327 -0
- package/win32_x64/third-party/libsmb2/source/Xbox 360/libsmb2.vcxproj.filters +268 -0
- package/win32_x64/third-party/libsmb2/source/bootstrap +2 -0
- package/win32_x64/third-party/libsmb2/source/cmake/ConfigureChecks.cmake +63 -0
- package/win32_x64/third-party/libsmb2/source/cmake/FindSMB2.cmake +37 -0
- package/win32_x64/third-party/libsmb2/source/cmake/Modules/FindGSSAPI.cmake +30 -0
- package/win32_x64/third-party/libsmb2/source/cmake/Modules/FindLibKrb5.cmake +44 -0
- package/win32_x64/third-party/libsmb2/source/cmake/config.h.cmake +126 -0
- package/win32_x64/third-party/libsmb2/source/cmake/libsmb2.pc.cmake +14 -0
- package/win32_x64/third-party/libsmb2/source/component.mk +5 -0
- package/win32_x64/third-party/libsmb2/source/configure.ac +184 -0
- package/win32_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareAdd.yaml +9 -0
- package/win32_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareCheck.yaml +4 -0
- package/win32_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareDel.yaml +5 -0
- package/win32_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareDelSticky.yaml +5 -0
- package/win32_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareEnum.yaml +7 -0
- package/win32_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareGetInfo.yaml +6 -0
- package/win32_x64/third-party/libsmb2/source/dcerpc-examples/srvsvc-NetrShareSetInfo.yaml +11 -0
- package/win32_x64/third-party/libsmb2/source/examples/CMakeLists.txt +28 -0
- package/win32_x64/third-party/libsmb2/source/examples/Makefile.am +54 -0
- package/win32_x64/third-party/libsmb2/source/examples/dcerpc.c +254 -0
- package/win32_x64/third-party/libsmb2/source/examples/picow/CMakeLists.txt +72 -0
- package/win32_x64/third-party/libsmb2/source/examples/picow/README.md +2 -0
- package/win32_x64/third-party/libsmb2/source/examples/picow/main.cpp +119 -0
- package/win32_x64/third-party/libsmb2/source/examples/picow/smb-ls-sync.c +0 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-CMD-FIND.c +335 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-cat-async.c +183 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-cat-sync.c +105 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-ftruncate-sync.c +87 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-ls-async.c +185 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-ls-epoll.c +234 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-lsa-lookupsids.c +292 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-lseek-sync.c +101 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-notify.c +183 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-put-async.c +175 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-put-sync.c +100 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-raw-fsstat-async.c +353 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-raw-getsd-async.c +401 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-raw-stat-async.c +448 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-readlink.c +80 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-rename-sync.c +80 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-server-sync.c +497 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-share-enum-sync.c +146 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-share-enum.c +208 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-share-info.c +255 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-stat-sync.c +103 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-statvfs-sync.c +85 -0
- package/win32_x64/third-party/libsmb2/source/examples/smb2-truncate-sync.c +78 -0
- package/win32_x64/third-party/libsmb2/source/idf_component.yml +5 -0
- package/win32_x64/third-party/libsmb2/source/include/Makefile.am +15 -0
- package/win32_x64/third-party/libsmb2/source/include/amiga_os/config.h +139 -0
- package/win32_x64/third-party/libsmb2/source/include/apple/config.h +139 -0
- package/win32_x64/third-party/libsmb2/source/include/asprintf.h +65 -0
- package/win32_x64/third-party/libsmb2/source/include/esp/config.h +139 -0
- package/win32_x64/third-party/libsmb2/source/include/libsmb2-private.h +670 -0
- package/win32_x64/third-party/libsmb2/source/include/module.modulemap +21 -0
- package/win32_x64/third-party/libsmb2/source/include/picow/FreeRTOSConfig.h +143 -0
- package/win32_x64/third-party/libsmb2/source/include/picow/README.md +2 -0
- package/win32_x64/third-party/libsmb2/source/include/picow/config.h +139 -0
- package/win32_x64/third-party/libsmb2/source/include/picow/lwipopts.h +27 -0
- package/win32_x64/third-party/libsmb2/source/include/picow/lwipopts_examples_common.h +90 -0
- package/win32_x64/third-party/libsmb2/source/include/portable-endian.h +377 -0
- package/win32_x64/third-party/libsmb2/source/include/ps3/config.h +139 -0
- package/win32_x64/third-party/libsmb2/source/include/slist.h +63 -0
- package/win32_x64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/win32_x64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc-srvsvc.h +276 -0
- package/win32_x64/third-party/libsmb2/source/include/smb2/libsmb2-dcerpc.h +203 -0
- package/win32_x64/third-party/libsmb2/source/include/smb2/libsmb2-raw.h +497 -0
- package/win32_x64/third-party/libsmb2/source/include/smb2/libsmb2.h +1409 -0
- package/win32_x64/third-party/libsmb2/source/include/smb2/smb2-errors.h +549 -0
- package/win32_x64/third-party/libsmb2/source/include/smb2/smb2-ioctl.h +83 -0
- package/win32_x64/third-party/libsmb2/source/include/smb2/smb2.h +1251 -0
- package/win32_x64/third-party/libsmb2/source/include/xbox/config.h +139 -0
- package/win32_x64/third-party/libsmb2/source/include/xbox 360/config.h +139 -0
- package/win32_x64/third-party/libsmb2/source/lib/CMakeLists.txt +260 -0
- package/win32_x64/third-party/libsmb2/source/lib/Makefile.AMIGA +46 -0
- package/win32_x64/third-party/libsmb2/source/lib/Makefile.AMIGA_AROS +59 -0
- package/win32_x64/third-party/libsmb2/source/lib/Makefile.AMIGA_OS3 +59 -0
- package/win32_x64/third-party/libsmb2/source/lib/Makefile.PS3_PPU +100 -0
- package/win32_x64/third-party/libsmb2/source/lib/Makefile.am +85 -0
- package/win32_x64/third-party/libsmb2/source/lib/aes.c +33 -0
- package/win32_x64/third-party/libsmb2/source/lib/aes.h +29 -0
- package/win32_x64/third-party/libsmb2/source/lib/aes128ccm.c +185 -0
- package/win32_x64/third-party/libsmb2/source/lib/aes128ccm.h +28 -0
- package/win32_x64/third-party/libsmb2/source/lib/aes_apple.c +70 -0
- package/win32_x64/third-party/libsmb2/source/lib/aes_apple.h +34 -0
- package/win32_x64/third-party/libsmb2/source/lib/aes_reference.c +560 -0
- package/win32_x64/third-party/libsmb2/source/lib/aes_reference.h +49 -0
- package/win32_x64/third-party/libsmb2/source/lib/alloc.c +154 -0
- package/win32_x64/third-party/libsmb2/source/lib/asn1-ber.c +1078 -0
- package/win32_x64/third-party/libsmb2/source/lib/asn1-ber.h +161 -0
- package/win32_x64/third-party/libsmb2/source/lib/compat.c +599 -0
- package/win32_x64/third-party/libsmb2/source/lib/compat.h +829 -0
- package/win32_x64/third-party/libsmb2/source/lib/dcerpc-lsa.c +641 -0
- package/win32_x64/third-party/libsmb2/source/lib/dcerpc-srvsvc.c +885 -0
- package/win32_x64/third-party/libsmb2/source/lib/dcerpc.c +2513 -0
- package/win32_x64/third-party/libsmb2/source/lib/dreamcast/vfs.c +328 -0
- package/win32_x64/third-party/libsmb2/source/lib/dreamcast/vfs.h +15 -0
- package/win32_x64/third-party/libsmb2/source/lib/errors.c +1192 -0
- package/win32_x64/third-party/libsmb2/source/lib/hmac-md5.c +84 -0
- package/win32_x64/third-party/libsmb2/source/lib/hmac-md5.h +42 -0
- package/win32_x64/third-party/libsmb2/source/lib/hmac.c +245 -0
- package/win32_x64/third-party/libsmb2/source/lib/init.c +778 -0
- package/win32_x64/third-party/libsmb2/source/lib/krb5-wrapper.c +1072 -0
- package/win32_x64/third-party/libsmb2/source/lib/krb5-wrapper.h +134 -0
- package/win32_x64/third-party/libsmb2/source/lib/libsmb2.c +4292 -0
- package/win32_x64/third-party/libsmb2/source/lib/libsmb2.syms +168 -0
- package/win32_x64/third-party/libsmb2/source/lib/md4.h +43 -0
- package/win32_x64/third-party/libsmb2/source/lib/md4c.c +289 -0
- package/win32_x64/third-party/libsmb2/source/lib/md5.c +249 -0
- package/win32_x64/third-party/libsmb2/source/lib/md5.h +76 -0
- package/win32_x64/third-party/libsmb2/source/lib/ntlmssp.c +1380 -0
- package/win32_x64/third-party/libsmb2/source/lib/ntlmssp.h +84 -0
- package/win32_x64/third-party/libsmb2/source/lib/pdu.c +1159 -0
- package/win32_x64/third-party/libsmb2/source/lib/ps2/TODO +6 -0
- package/win32_x64/third-party/libsmb2/source/lib/ps2/imports.lst +84 -0
- package/win32_x64/third-party/libsmb2/source/lib/ps2/irx_imports.h +28 -0
- package/win32_x64/third-party/libsmb2/source/lib/ps2/ps2smb2.h +35 -0
- package/win32_x64/third-party/libsmb2/source/lib/ps2/smb2_fio.c +816 -0
- package/win32_x64/third-party/libsmb2/source/lib/ps2/smb2_fio.h +15 -0
- package/win32_x64/third-party/libsmb2/source/lib/ps2/smb2man.c +69 -0
- package/win32_x64/third-party/libsmb2/source/lib/sha-private.h +28 -0
- package/win32_x64/third-party/libsmb2/source/lib/sha.h +334 -0
- package/win32_x64/third-party/libsmb2/source/lib/sha1.c +450 -0
- package/win32_x64/third-party/libsmb2/source/lib/sha224-256.c +611 -0
- package/win32_x64/third-party/libsmb2/source/lib/sha384-512.c +1059 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-close.c +240 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-create.c +508 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-echo.c +202 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-error.c +157 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-flush.c +207 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-ioctl.c +445 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-lock.c +312 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-logoff.c +190 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-negotiate.c +646 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-notify-change.c +278 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-oplock-break.c +543 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-query-directory.c +580 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-query-info.c +753 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-read.c +391 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-session-setup.c +331 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-set-info.c +361 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-tree-connect.c +278 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-tree-disconnect.c +171 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-cmd-write.c +319 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-data-file-info.c +537 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-data-filesystem-info.c +384 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-data-reparse-point.c +117 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-data-security-descriptor.c +361 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-share-enum.c +181 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-signing.c +279 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb2-signing.h +51 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb3-seal.c +165 -0
- package/win32_x64/third-party/libsmb2/source/lib/smb3-seal.h +43 -0
- package/win32_x64/third-party/libsmb2/source/lib/socket.c +1502 -0
- package/win32_x64/third-party/libsmb2/source/lib/spnego-wrapper.c +634 -0
- package/win32_x64/third-party/libsmb2/source/lib/spnego-wrapper.h +74 -0
- package/win32_x64/third-party/libsmb2/source/lib/sync.c +988 -0
- package/win32_x64/third-party/libsmb2/source/lib/timestamps.c +70 -0
- package/win32_x64/third-party/libsmb2/source/lib/unicode.c +307 -0
- package/win32_x64/third-party/libsmb2/source/lib/usha.c +345 -0
- package/win32_x64/third-party/libsmb2/source/libsmb2.pc.in +14 -0
- package/win32_x64/third-party/libsmb2/source/packaging/RPM/libsmb2.spec.in +135 -0
- package/win32_x64/third-party/libsmb2/source/packaging/RPM/makerpms.sh +114 -0
- package/win32_x64/third-party/libsmb2/source/tests/Makefile.am +34 -0
- package/win32_x64/third-party/libsmb2/source/tests/README +28 -0
- package/win32_x64/third-party/libsmb2/source/tests/aes128ccm-test.c +119 -0
- package/win32_x64/third-party/libsmb2/source/tests/functions.sh +11 -0
- package/win32_x64/third-party/libsmb2/source/tests/ld_sockerr.c +58 -0
- package/win32_x64/third-party/libsmb2/source/tests/metastat-0202-censored.c +136 -0
- package/win32_x64/third-party/libsmb2/source/tests/ntlmssp_generate_blob.c +123 -0
- package/win32_x64/third-party/libsmb2/source/tests/prog_cat.c +188 -0
- package/win32_x64/third-party/libsmb2/source/tests/prog_cat_cancel.c +203 -0
- package/win32_x64/third-party/libsmb2/source/tests/prog_ls.c +189 -0
- package/win32_x64/third-party/libsmb2/source/tests/prog_mkdir.c +85 -0
- package/win32_x64/third-party/libsmb2/source/tests/prog_rmdir.c +84 -0
- package/win32_x64/third-party/libsmb2/source/tests/smb2-dcerpc-coder-test.c +635 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0100_ls_basic.sh +22 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0101_ls_basic_valgrind.sh +23 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0102_ls_basic_socket_error.sh +16 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0103_ls_basic_valgrind_malloc_error.sh +25 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0200_mkdir.sh +15 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0201_mkdir_valgrind.sh +15 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0210_cp_basic.sh +25 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0211_cp_valgrind.sh +26 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0212_cp_valgrind_socket_error.sh +29 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0300_cat_basic.sh +13 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0301_cat_valgrind.sh +13 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0302_cat_valgrind_socket_error.sh +18 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0310_cancel_pdu.sh +13 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_0400_overdrawn_0202.sh +25 -0
- package/win32_x64/third-party/libsmb2/source/tests/test_900_dcerpc.sh +10 -0
- package/win32_x64/third-party/libsmb2/source/utils/Makefile.am +11 -0
- package/win32_x64/third-party/libsmb2/source/utils/smb2-cp.c +265 -0
- package/win32_x64/third-party/libsmb2/source/utils/smb2-ls.c +135 -0
|
@@ -0,0 +1,1380 @@
|
|
|
1
|
+
/* -*- mode:c; tab-width:8; c-basic-offset:8; indent-tabs-mode:nil; -*- */
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2018 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
|
4
|
+
|
|
5
|
+
This program is free software; you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
the Free Software Foundation; either version 2.1 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Lesser General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
#ifdef HAVE_CONFIG_H
|
|
19
|
+
#include "config.h"
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
#ifndef _GNU_SOURCE
|
|
23
|
+
#define _GNU_SOURCE
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
#ifdef HAVE_STDINT_H
|
|
27
|
+
#include <stdint.h>
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
#ifdef HAVE_STDLIB_H
|
|
31
|
+
#include <stdlib.h>
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#ifdef HAVE_STRING_H
|
|
35
|
+
#include <string.h>
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#ifdef STDC_HEADERS
|
|
39
|
+
#include <stddef.h>
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
#ifdef HAVE_SYS_TYPES_H
|
|
43
|
+
#include <sys/types.h>
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
#ifdef HAVE_SYS_STAT_H
|
|
47
|
+
#include <sys/stat.h>
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#ifdef HAVE_UNISTD_H
|
|
51
|
+
#include <unistd.h>
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
#ifdef HAVE_SYS_UNISTD_H
|
|
55
|
+
#include <sys/unistd.h>
|
|
56
|
+
#endif
|
|
57
|
+
|
|
58
|
+
#include <ctype.h>
|
|
59
|
+
#include "portable-endian.h"
|
|
60
|
+
#include <stdio.h>
|
|
61
|
+
|
|
62
|
+
#ifdef HAVE_TIME_H
|
|
63
|
+
#include <time.h>
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
#ifdef HAVE_SYS_TIME_H
|
|
67
|
+
#include <sys/time.h>
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
#include "compat.h"
|
|
71
|
+
|
|
72
|
+
#include "slist.h"
|
|
73
|
+
#include "smb2.h"
|
|
74
|
+
#include "libsmb2.h"
|
|
75
|
+
#include "libsmb2-raw.h"
|
|
76
|
+
#include "libsmb2-private.h"
|
|
77
|
+
#include "spnego-wrapper.h"
|
|
78
|
+
|
|
79
|
+
#include "md4.h"
|
|
80
|
+
#include "md5.h"
|
|
81
|
+
#include "hmac-md5.h"
|
|
82
|
+
#include "ntlmssp.h"
|
|
83
|
+
|
|
84
|
+
struct auth_data {
|
|
85
|
+
unsigned char *buf;
|
|
86
|
+
size_t len;
|
|
87
|
+
size_t allocated;
|
|
88
|
+
|
|
89
|
+
int neg_result;
|
|
90
|
+
unsigned char *ntlm_buf;
|
|
91
|
+
size_t ntlm_len;
|
|
92
|
+
|
|
93
|
+
char *user;
|
|
94
|
+
char *domain;
|
|
95
|
+
char *password;
|
|
96
|
+
char *workstation;
|
|
97
|
+
char *target_name;
|
|
98
|
+
uint8_t *client_challenge;
|
|
99
|
+
uint8_t server_challenge[8];
|
|
100
|
+
uint8_t *target_info;
|
|
101
|
+
int target_info_len;
|
|
102
|
+
|
|
103
|
+
int spnego_wrap;
|
|
104
|
+
int is_authenticated;
|
|
105
|
+
uint64_t wintime;
|
|
106
|
+
uint8_t exported_session_key[SMB2_KEY_SIZE];
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
#define NTLMSSP_NEGOTIATE_56 0x80000000
|
|
110
|
+
#define NTLMSSP_NEGOTIATE_KEY_EXCH 0x40000000
|
|
111
|
+
#define NTLMSSP_NEGOTIATE_128 0x20000000
|
|
112
|
+
#define NTLMSSP_NEGOTIATE_VERSION 0x02000000
|
|
113
|
+
#define NTLMSSP_NEGOTIATE_TARGET_INFO 0x00800000
|
|
114
|
+
#define NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY 0x00080000
|
|
115
|
+
#define NTLMSSP_TARGET_TYPE_SERVER 0x00020000
|
|
116
|
+
#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x00008000
|
|
117
|
+
#define NTLMSSP_NEGOTIATE_ANONYMOUS 0x00000800
|
|
118
|
+
#define NTLMSSP_NEGOTIATE_NTLM 0x00000200
|
|
119
|
+
#define NTLMSSP_NEGOTIATE_SEAL 0x00000020
|
|
120
|
+
#define NTLMSSP_NEGOTIATE_SIGN 0x00000010
|
|
121
|
+
#define NTLMSSP_REQUEST_TARGET 0x00000004
|
|
122
|
+
#define NTLMSSP_NEGOTIATE_OEM 0x00000002
|
|
123
|
+
#define NTLMSSP_NEGOTIATE_UNICODE 0x00000001
|
|
124
|
+
|
|
125
|
+
void
|
|
126
|
+
ntlmssp_destroy_context(struct auth_data *auth)
|
|
127
|
+
{
|
|
128
|
+
free(auth->ntlm_buf);
|
|
129
|
+
free(auth->buf);
|
|
130
|
+
free(auth->user);
|
|
131
|
+
free(auth->password);
|
|
132
|
+
free(auth->domain);
|
|
133
|
+
free(auth->workstation);
|
|
134
|
+
free(auth->target_name);
|
|
135
|
+
free(auth->client_challenge);
|
|
136
|
+
free(auth->target_info);
|
|
137
|
+
free(auth);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
static int
|
|
141
|
+
auth_data_set_password(struct auth_data *auth_data, const char *password)
|
|
142
|
+
{
|
|
143
|
+
free(auth_data->password);
|
|
144
|
+
auth_data->password = NULL;
|
|
145
|
+
|
|
146
|
+
if (password == NULL) {
|
|
147
|
+
return 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
auth_data->password = strdup(password);
|
|
151
|
+
if (auth_data->password == NULL) {
|
|
152
|
+
return -ENOMEM;
|
|
153
|
+
}
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static int
|
|
158
|
+
auth_data_set_domain(struct auth_data *auth_data, const char *domain)
|
|
159
|
+
{
|
|
160
|
+
free(auth_data->domain);
|
|
161
|
+
auth_data->domain = NULL;
|
|
162
|
+
|
|
163
|
+
if (domain == NULL) {
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
auth_data->domain = strdup(domain);
|
|
168
|
+
if (auth_data->domain == NULL) {
|
|
169
|
+
return -ENOMEM;
|
|
170
|
+
}
|
|
171
|
+
return 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
struct auth_data *
|
|
175
|
+
ntlmssp_init_context(const char *user,
|
|
176
|
+
const char *password,
|
|
177
|
+
const char *domain,
|
|
178
|
+
const char *workstation,
|
|
179
|
+
const char *client_challenge)
|
|
180
|
+
{
|
|
181
|
+
struct auth_data *auth_data = NULL;
|
|
182
|
+
struct smb2_timeval tv;
|
|
183
|
+
|
|
184
|
+
auth_data = calloc(1, sizeof(struct auth_data));
|
|
185
|
+
if (auth_data == NULL) {
|
|
186
|
+
return NULL;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (user) {
|
|
190
|
+
auth_data->user = strdup(user);
|
|
191
|
+
if (auth_data->user == NULL) {
|
|
192
|
+
goto failed;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (auth_data_set_password(auth_data, password) < 0) {
|
|
196
|
+
goto failed;
|
|
197
|
+
}
|
|
198
|
+
if (auth_data_set_domain(auth_data, domain) < 0) {
|
|
199
|
+
goto failed;
|
|
200
|
+
}
|
|
201
|
+
if (workstation) {
|
|
202
|
+
auth_data->workstation = strdup(workstation);
|
|
203
|
+
if (auth_data->workstation == NULL) {
|
|
204
|
+
goto failed;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
auth_data->client_challenge = malloc(8);
|
|
208
|
+
if (auth_data->client_challenge == NULL) {
|
|
209
|
+
goto failed;
|
|
210
|
+
}
|
|
211
|
+
memcpy(auth_data->client_challenge, client_challenge, 8);
|
|
212
|
+
auth_data->is_authenticated = 0;
|
|
213
|
+
memset(auth_data->exported_session_key, 0, SMB2_KEY_SIZE);
|
|
214
|
+
tv.tv_sec = time(NULL);
|
|
215
|
+
tv.tv_usec = 0;
|
|
216
|
+
auth_data->wintime = smb2_timeval_to_win(&tv);
|
|
217
|
+
|
|
218
|
+
return auth_data;
|
|
219
|
+
failed:
|
|
220
|
+
free(auth_data->user);
|
|
221
|
+
free(auth_data->password);
|
|
222
|
+
free(auth_data->domain);
|
|
223
|
+
free(auth_data->workstation);
|
|
224
|
+
free(auth_data->client_challenge);
|
|
225
|
+
return NULL;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
void
|
|
229
|
+
ntlmssp_set_spnego_wrapping(struct auth_data *auth, int wrap)
|
|
230
|
+
{
|
|
231
|
+
auth->spnego_wrap = wrap;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
int
|
|
235
|
+
ntlmssp_get_spnego_wrapping(struct auth_data *auth)
|
|
236
|
+
{
|
|
237
|
+
return auth->spnego_wrap;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
int
|
|
241
|
+
ntlmssp_get_authenticated(struct auth_data *auth)
|
|
242
|
+
{
|
|
243
|
+
return auth ? auth->is_authenticated : 0;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
static int
|
|
247
|
+
encoder(const void *buffer, size_t size, void *ptr)
|
|
248
|
+
{
|
|
249
|
+
struct auth_data *auth_data = ptr;
|
|
250
|
+
|
|
251
|
+
if (size + auth_data->len > auth_data->allocated) {
|
|
252
|
+
unsigned char *tmp = auth_data->buf;
|
|
253
|
+
|
|
254
|
+
auth_data->allocated = 2 * ((size + auth_data->allocated + 256) & ~0xff);
|
|
255
|
+
auth_data->buf = malloc(auth_data->allocated);
|
|
256
|
+
if (auth_data->buf == NULL) {
|
|
257
|
+
free(tmp);
|
|
258
|
+
return -1;
|
|
259
|
+
}
|
|
260
|
+
memcpy(auth_data->buf, tmp, auth_data->len);
|
|
261
|
+
free(tmp);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (auth_data->buf == NULL) {
|
|
265
|
+
return -1;
|
|
266
|
+
}
|
|
267
|
+
memcpy(auth_data->buf + auth_data->len, buffer, size);
|
|
268
|
+
auth_data->len += size;
|
|
269
|
+
|
|
270
|
+
return 0;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
static int
|
|
274
|
+
encode_ntlm_negotiate_message(struct smb2_context *smb2, struct auth_data *auth_data)
|
|
275
|
+
{
|
|
276
|
+
unsigned char ntlm[40];
|
|
277
|
+
uint32_t flags;
|
|
278
|
+
uint32_t u32;
|
|
279
|
+
int ntlm_len = 32;
|
|
280
|
+
|
|
281
|
+
memset(ntlm, 0, sizeof(ntlm));
|
|
282
|
+
memcpy(ntlm, "NTLMSSP", 8);
|
|
283
|
+
|
|
284
|
+
u32 = htole32(NEGOTIATE_MESSAGE);
|
|
285
|
+
memcpy(&ntlm[8], &u32, 4);
|
|
286
|
+
|
|
287
|
+
flags = NTLMSSP_NEGOTIATE_128|
|
|
288
|
+
NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY|
|
|
289
|
+
/* NTLMSSP_NEGOTIATE_KEY_EXCH| */
|
|
290
|
+
/* NTLMSSP_NEGOTIATE_VERSION| */
|
|
291
|
+
/* NTLMSSP_NEGOTIATE_TARGET_INFO| */
|
|
292
|
+
/* NTLMSSP_NEGOTIATE_ALWAYS_SIGN| */
|
|
293
|
+
NTLMSSP_NEGOTIATE_NTLM| /* Azure netapp server needs this */
|
|
294
|
+
NTLMSSP_NEGOTIATE_SEAL|
|
|
295
|
+
/* NTLMSSP_NEGOTIATE_SIGN| */
|
|
296
|
+
NTLMSSP_REQUEST_TARGET|
|
|
297
|
+
NTLMSSP_NEGOTIATE_OEM|
|
|
298
|
+
NTLMSSP_NEGOTIATE_UNICODE;
|
|
299
|
+
|
|
300
|
+
u32 = htole32(flags);
|
|
301
|
+
memcpy(&ntlm[12], &u32, 4);
|
|
302
|
+
|
|
303
|
+
if (flags & NTLMSSP_NEGOTIATE_VERSION) {
|
|
304
|
+
u32 = 0x1db00106;
|
|
305
|
+
u32 = htole32(u32);
|
|
306
|
+
memcpy(&ntlm[32], &u32, 4);
|
|
307
|
+
u32 = 0x0f000000;
|
|
308
|
+
u32 = htole32(u32);
|
|
309
|
+
memcpy(&ntlm[36], &u32, 4);
|
|
310
|
+
ntlm_len = 40;
|
|
311
|
+
}
|
|
312
|
+
if (encoder(&ntlm[0], ntlm_len, auth_data) < 0) {
|
|
313
|
+
return -1;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return 0;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
static int
|
|
320
|
+
ntlm_decode_challenge_message(struct smb2_context *smb2, struct auth_data *auth_data,
|
|
321
|
+
unsigned char *buf, size_t len)
|
|
322
|
+
{
|
|
323
|
+
if (buf && len > 0) {
|
|
324
|
+
int alloc_len;
|
|
325
|
+
uint32_t inoff;
|
|
326
|
+
uint16_t inlen;
|
|
327
|
+
uint32_t outoff;
|
|
328
|
+
uint16_t u16;
|
|
329
|
+
uint32_t u32;
|
|
330
|
+
uint16_t infolen;
|
|
331
|
+
uint16_t attr_len;
|
|
332
|
+
uint16_t attr_code;
|
|
333
|
+
struct smb2_utf16 *utf16_spn = NULL;
|
|
334
|
+
const uint32_t challenge_header_len = 56;
|
|
335
|
+
|
|
336
|
+
/* form destination SPN in case server is checking */
|
|
337
|
+
free(auth_data->target_info);
|
|
338
|
+
alloc_len = 32 + strlen(smb2->server);
|
|
339
|
+
auth_data->target_info = malloc(alloc_len);
|
|
340
|
+
if (!auth_data->target_info) {
|
|
341
|
+
return -1;
|
|
342
|
+
}
|
|
343
|
+
auth_data->target_info_len = snprintf((char*)auth_data->target_info,
|
|
344
|
+
alloc_len, "cifs/%s", smb2->server);
|
|
345
|
+
|
|
346
|
+
free(auth_data->ntlm_buf);
|
|
347
|
+
auth_data->ntlm_len = len;
|
|
348
|
+
/* alloc enough to add a target-name attribute */
|
|
349
|
+
alloc_len = auth_data->ntlm_len + 400;
|
|
350
|
+
auth_data->ntlm_buf = malloc(alloc_len);
|
|
351
|
+
if (auth_data->ntlm_buf == NULL) {
|
|
352
|
+
return -1;
|
|
353
|
+
}
|
|
354
|
+
/* copy challenge message verbatim except payload */
|
|
355
|
+
memcpy(auth_data->ntlm_buf, buf, challenge_header_len);
|
|
356
|
+
|
|
357
|
+
/* payload pointer */
|
|
358
|
+
outoff = challenge_header_len;
|
|
359
|
+
|
|
360
|
+
/* copy target-name-fields payload from source to dest */
|
|
361
|
+
memcpy(&u16, &buf[12], 2);
|
|
362
|
+
inlen = htole16(u16);
|
|
363
|
+
memcpy(&u32, &buf[16], 4);
|
|
364
|
+
inoff = htole32(u32);
|
|
365
|
+
|
|
366
|
+
/* and update offset to where we put it (probably the same offset) */
|
|
367
|
+
u32 = htole32(outoff);
|
|
368
|
+
memcpy(&auth_data->ntlm_buf[16], &u32, 4);
|
|
369
|
+
|
|
370
|
+
if (inlen > 0 && inlen < len && (outoff + inlen) < alloc_len) {
|
|
371
|
+
auth_data->target_name = discard_const(smb2_utf16_to_utf8((const uint16_t *)(void *)&buf[inoff], inlen / 2));
|
|
372
|
+
memcpy(&auth_data->ntlm_buf[outoff], &buf[inoff], inlen);
|
|
373
|
+
outoff += inlen;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
memcpy(&u16, &buf[40], 2);
|
|
377
|
+
inlen = htole16(u16);
|
|
378
|
+
memcpy(&u32, &buf[44], 4);
|
|
379
|
+
inoff = htole32(u32);
|
|
380
|
+
|
|
381
|
+
infolen = 0;
|
|
382
|
+
|
|
383
|
+
if (inlen > 0 && inlen < len && (outoff + inlen) < alloc_len) {
|
|
384
|
+
/* back annotate target info field offset */
|
|
385
|
+
u32 = htole32(outoff);
|
|
386
|
+
memcpy(&auth_data->ntlm_buf[44], &u32, 4);
|
|
387
|
+
|
|
388
|
+
/* transcode target info fields, appending our target-name */
|
|
389
|
+
while (inlen > 0) {
|
|
390
|
+
memcpy(&u16, &buf[inoff], 2);
|
|
391
|
+
attr_code = htole16(u16);
|
|
392
|
+
memcpy(&u16, &buf[inoff + 2], 2);
|
|
393
|
+
attr_len = htole16(u16);
|
|
394
|
+
if (attr_len > inlen || (outoff + attr_len) > alloc_len) {
|
|
395
|
+
/* invalid, must be out of parse? */
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (attr_code == 0) { /* end of list */
|
|
400
|
+
/* insert target-name */
|
|
401
|
+
if (auth_data->target_info && auth_data->target_info_len) {
|
|
402
|
+
utf16_spn = smb2_utf8_to_utf16((char*)auth_data->target_info);
|
|
403
|
+
if (utf16_spn != NULL) {
|
|
404
|
+
attr_code = 0x9; /* target-name code */
|
|
405
|
+
attr_len = utf16_spn->len * 2;
|
|
406
|
+
u16 = htole16(attr_code);
|
|
407
|
+
memcpy(&auth_data->ntlm_buf[outoff], &u16, 2);
|
|
408
|
+
u16 = htole16(attr_len);
|
|
409
|
+
memcpy(&auth_data->ntlm_buf[outoff + 2], &u16, 2);
|
|
410
|
+
outoff += 4;
|
|
411
|
+
memcpy(&auth_data->ntlm_buf[outoff],
|
|
412
|
+
(uint8_t*)utf16_spn->val, attr_len);
|
|
413
|
+
outoff += attr_len;
|
|
414
|
+
infolen += 4 + attr_len;
|
|
415
|
+
free(utf16_spn);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
/* insert original end of list attr */
|
|
419
|
+
u16 = 0;
|
|
420
|
+
memcpy(&auth_data->ntlm_buf[outoff], &u16, 2);
|
|
421
|
+
memcpy(&auth_data->ntlm_buf[outoff + 2], &u16, 2);
|
|
422
|
+
outoff += 4;
|
|
423
|
+
attr_code = 0;
|
|
424
|
+
attr_len = 0;
|
|
425
|
+
} else {
|
|
426
|
+
u16 = htole16(attr_code);
|
|
427
|
+
memcpy(&auth_data->ntlm_buf[outoff], &u16, 2);
|
|
428
|
+
u16 = htole16(attr_len);
|
|
429
|
+
memcpy(&auth_data->ntlm_buf[outoff + 2], &u16, 2);
|
|
430
|
+
outoff += 4;
|
|
431
|
+
memcpy(&auth_data->ntlm_buf[outoff], &buf[inoff + 4], attr_len);
|
|
432
|
+
outoff += attr_len;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
inoff += 4 + attr_len;
|
|
436
|
+
inlen -= 4 + attr_len;
|
|
437
|
+
infolen += 4 + attr_len;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* back annotate target info field len */
|
|
441
|
+
u16 = htole16(infolen);
|
|
442
|
+
memcpy(&auth_data->ntlm_buf[40], &u16, 2);
|
|
443
|
+
memcpy(&auth_data->ntlm_buf[42], &u16, 2);
|
|
444
|
+
|
|
445
|
+
/* set the actual length of total message */
|
|
446
|
+
auth_data->ntlm_len = outoff;
|
|
447
|
+
}
|
|
448
|
+
return 0;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return -1;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
static int
|
|
455
|
+
ntlm_convert_password_hash(const char *password, unsigned char password_hash[16])
|
|
456
|
+
{
|
|
457
|
+
int i, hn, ln;
|
|
458
|
+
struct smb2_utf16 *utf16_password = NULL;
|
|
459
|
+
|
|
460
|
+
utf16_password = smb2_utf8_to_utf16(password);
|
|
461
|
+
if (utf16_password == NULL) {
|
|
462
|
+
return -1;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
for (i = 0; i < 32; i++) {
|
|
466
|
+
utf16_password->val[i] = le16toh(utf16_password->val[i]);
|
|
467
|
+
if (islower((unsigned int) utf16_password->val[i])) {
|
|
468
|
+
utf16_password->val[i] = toupper((unsigned int) utf16_password->val[i]);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/* FreeRDP: winpr/libwinpr/sspi/NTLM/ntlm_compute.c */
|
|
473
|
+
for (i = 0; i < 32; i += 2)
|
|
474
|
+
{
|
|
475
|
+
hn = utf16_password->val[i] > '9' ? utf16_password->val[i] - 'A' + 10 : utf16_password->val[i] - '0';
|
|
476
|
+
ln = utf16_password->val[i + 1] > '9' ? utf16_password->val[i + 1] - 'A' + 10 : utf16_password->val[i + 1] - '0';
|
|
477
|
+
password_hash[i / 2] = (hn << 4) | ln;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
return 0;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
static int
|
|
484
|
+
NTOWFv1(const char *password, unsigned char password_hash[16])
|
|
485
|
+
{
|
|
486
|
+
MD4_CTX ctx;
|
|
487
|
+
struct smb2_utf16 *utf16_password = NULL;
|
|
488
|
+
|
|
489
|
+
utf16_password = smb2_utf8_to_utf16(password);
|
|
490
|
+
if (utf16_password == NULL) {
|
|
491
|
+
return -1;
|
|
492
|
+
}
|
|
493
|
+
MD4Init(&ctx);
|
|
494
|
+
MD4Update(&ctx, (unsigned char *)utf16_password->val, utf16_password->len * 2);
|
|
495
|
+
MD4Final(password_hash, &ctx);
|
|
496
|
+
free(utf16_password);
|
|
497
|
+
|
|
498
|
+
return 0;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
static int
|
|
502
|
+
NTOWFv2(const char *user, const char *password, const char *domain,
|
|
503
|
+
unsigned char ntlmv2_hash[16])
|
|
504
|
+
{
|
|
505
|
+
int64_t i;
|
|
506
|
+
size_t len;
|
|
507
|
+
char *userdomain;
|
|
508
|
+
struct smb2_utf16 *utf16_userdomain = NULL;
|
|
509
|
+
unsigned char ntlm_hash[16];
|
|
510
|
+
|
|
511
|
+
if (user == NULL || password == NULL) {
|
|
512
|
+
return -1;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/* ntlm:F638EDF864C4805DC65D9BF2BB77E4C0 */
|
|
516
|
+
if ((strlen(password) == 37) && (strncmp(password, "ntlm:", 5) == 0)) {
|
|
517
|
+
if (ntlm_convert_password_hash(password + 5, ntlm_hash) < 0) {
|
|
518
|
+
return -1;
|
|
519
|
+
}
|
|
520
|
+
} else {
|
|
521
|
+
if (NTOWFv1(password, ntlm_hash) < 0) {
|
|
522
|
+
return -1;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
len = strlen(user) + 1;
|
|
527
|
+
if (domain) {
|
|
528
|
+
len += strlen(domain);
|
|
529
|
+
}
|
|
530
|
+
userdomain = malloc(len);
|
|
531
|
+
if (userdomain == NULL) {
|
|
532
|
+
return -1;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
strcpy(userdomain, user);
|
|
536
|
+
for (i = strlen(userdomain) - 1; i >= 0; i--) {
|
|
537
|
+
if (islower((unsigned int) userdomain[i])) {
|
|
538
|
+
userdomain[i] = toupper((unsigned int) userdomain[i]);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (domain) {
|
|
542
|
+
strcat(userdomain, domain);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
utf16_userdomain = smb2_utf8_to_utf16(userdomain);
|
|
546
|
+
if (utf16_userdomain == NULL) {
|
|
547
|
+
free(userdomain);
|
|
548
|
+
return -1;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
smb2_hmac_md5((unsigned char *)utf16_userdomain->val,
|
|
552
|
+
utf16_userdomain->len * 2,
|
|
553
|
+
ntlm_hash, 16, ntlmv2_hash);
|
|
554
|
+
free(userdomain);
|
|
555
|
+
free(utf16_userdomain);
|
|
556
|
+
|
|
557
|
+
return 0;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/* This is not the same temp as in MS-NLMP. This temp has an additional
|
|
561
|
+
* 16 bytes at the start of the buffer.
|
|
562
|
+
* Use &auth_data->val[16] if you want the temp from MS-NLMP
|
|
563
|
+
*/
|
|
564
|
+
static int
|
|
565
|
+
encode_temp(struct auth_data *auth_data, uint64_t t,
|
|
566
|
+
uint8_t *client_challenge, size_t client_challenge_len,
|
|
567
|
+
uint8_t *server_challenge,
|
|
568
|
+
uint8_t *server_name, size_t server_name_len)
|
|
569
|
+
{
|
|
570
|
+
unsigned char sign[8] = {0x01, 0x01, 0x00, 0x00,
|
|
571
|
+
0x00, 0x00, 0x00, 0x00};
|
|
572
|
+
unsigned char zero[8] = {0x00, 0x00, 0x00, 0x00,
|
|
573
|
+
0x00, 0x00, 0x00, 0x00};
|
|
574
|
+
uint64_t u64;
|
|
575
|
+
|
|
576
|
+
if (encoder(&zero, 8, auth_data) < 0) {
|
|
577
|
+
return -1;
|
|
578
|
+
}
|
|
579
|
+
if (encoder(server_challenge, 8, auth_data) < 0) {
|
|
580
|
+
return -1;
|
|
581
|
+
}
|
|
582
|
+
if (encoder(sign, 8, auth_data) < 0) {
|
|
583
|
+
return -1;
|
|
584
|
+
}
|
|
585
|
+
u64 = htole64(t);
|
|
586
|
+
if (encoder(&u64, 8, auth_data) < 0) {
|
|
587
|
+
return -1;
|
|
588
|
+
}
|
|
589
|
+
if (encoder(client_challenge, client_challenge_len, auth_data) < 0) {
|
|
590
|
+
return -1;
|
|
591
|
+
}
|
|
592
|
+
if (encoder(&zero, 4, auth_data) < 0) {
|
|
593
|
+
return -1;
|
|
594
|
+
}
|
|
595
|
+
if (encoder(server_name, server_name_len, auth_data) < 0) {
|
|
596
|
+
return -1;
|
|
597
|
+
}
|
|
598
|
+
if (encoder(&zero, 4, auth_data) < 0) {
|
|
599
|
+
return -1;
|
|
600
|
+
}
|
|
601
|
+
return 0;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
static int
|
|
605
|
+
encode_ntlm_auth(struct smb2_context *smb2, time_t ti,
|
|
606
|
+
struct auth_data *auth_data, char *server_challenge)
|
|
607
|
+
{
|
|
608
|
+
int ret = -1;
|
|
609
|
+
unsigned char lm_buf[16] _U_;
|
|
610
|
+
unsigned char *NTChallengeResponse_buf = NULL;
|
|
611
|
+
unsigned char ResponseKeyNT[16];
|
|
612
|
+
struct smb2_utf16 *utf16_domain = NULL;
|
|
613
|
+
struct smb2_utf16 *utf16_user = NULL;
|
|
614
|
+
struct smb2_utf16 *utf16_workstation = NULL;
|
|
615
|
+
unsigned int NTChallengeResponse_len = 0;
|
|
616
|
+
unsigned char NTProofStr[16];
|
|
617
|
+
uint64_t t;
|
|
618
|
+
struct smb2_timeval tv _U_;
|
|
619
|
+
char *server_name_buf;
|
|
620
|
+
uint32_t server_name_len;
|
|
621
|
+
uint32_t u32;
|
|
622
|
+
uint32_t server_neg_flags;
|
|
623
|
+
unsigned char key_exch[SMB2_KEY_SIZE];
|
|
624
|
+
uint8_t anonymous = 0;
|
|
625
|
+
|
|
626
|
+
tv.tv_sec = ti;
|
|
627
|
+
tv.tv_usec = 0;
|
|
628
|
+
t = smb2_timeval_to_win(&tv);
|
|
629
|
+
|
|
630
|
+
/*
|
|
631
|
+
* If we discovered the domain (and a new associated password in NTLM_USER_FILE)
|
|
632
|
+
* on receiving the challenge message we need to update auth_data with the
|
|
633
|
+
* new domain/password.
|
|
634
|
+
*/
|
|
635
|
+
if (auth_data_set_password(auth_data, smb2->password) < 0) {
|
|
636
|
+
goto finished;
|
|
637
|
+
}
|
|
638
|
+
if (auth_data_set_domain(auth_data, smb2->domain) < 0) {
|
|
639
|
+
goto finished;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
if (auth_data->password == NULL) {
|
|
643
|
+
anonymous = 1;
|
|
644
|
+
goto encode;
|
|
645
|
+
}
|
|
646
|
+
/*
|
|
647
|
+
* Generate Concatenation of(NTProofStr, temp)
|
|
648
|
+
*/
|
|
649
|
+
if (NTOWFv2(auth_data->user, auth_data->password,
|
|
650
|
+
auth_data->domain, ResponseKeyNT) < 0) {
|
|
651
|
+
goto finished;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/* Must have at least enough bytes for server name offset */
|
|
655
|
+
if (auth_data->ntlm_len < 47) {
|
|
656
|
+
goto finished;
|
|
657
|
+
}
|
|
658
|
+
/* get the server neg flags */
|
|
659
|
+
memcpy(&server_neg_flags, &auth_data->ntlm_buf[20], 4);
|
|
660
|
+
server_neg_flags = le32toh(server_neg_flags);
|
|
661
|
+
|
|
662
|
+
memcpy(&u32, &auth_data->ntlm_buf[40], 4);
|
|
663
|
+
u32 = le32toh(u32);
|
|
664
|
+
server_name_len = u32 >> 16;
|
|
665
|
+
|
|
666
|
+
memcpy(&u32, &auth_data->ntlm_buf[44], 4);
|
|
667
|
+
u32 = le32toh(u32);
|
|
668
|
+
/* Server name must fit in the buffer */
|
|
669
|
+
if (u32 >= auth_data->ntlm_len ||
|
|
670
|
+
(u32 + server_name_len) > auth_data->ntlm_len) {
|
|
671
|
+
goto finished;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/* note - this is the target-info sent in the challenge perhaps
|
|
675
|
+
* modified to add a target-name attribute
|
|
676
|
+
*/
|
|
677
|
+
server_name_buf = (char *)&auth_data->ntlm_buf[u32];
|
|
678
|
+
|
|
679
|
+
if (encode_temp(auth_data, t,
|
|
680
|
+
auth_data->client_challenge, 8,
|
|
681
|
+
(uint8_t*)server_challenge,
|
|
682
|
+
(uint8_t*)server_name_buf, server_name_len) < 0) {
|
|
683
|
+
return -1;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
smb2_hmac_md5(&auth_data->buf[8], (unsigned int)auth_data->len-8,
|
|
687
|
+
ResponseKeyNT, 16, NTProofStr);
|
|
688
|
+
memcpy(auth_data->buf, NTProofStr, 16);
|
|
689
|
+
|
|
690
|
+
NTChallengeResponse_buf = auth_data->buf;
|
|
691
|
+
NTChallengeResponse_len = (unsigned int)auth_data->len;
|
|
692
|
+
|
|
693
|
+
auth_data->buf = NULL;
|
|
694
|
+
auth_data->len = 0;
|
|
695
|
+
auth_data->allocated = 0;
|
|
696
|
+
|
|
697
|
+
/* get the NTLMv2 Key-Exchange Key
|
|
698
|
+
For NTLMv2 - Key Exchange Key is the Session Base Key
|
|
699
|
+
*/
|
|
700
|
+
smb2_hmac_md5(NTProofStr, 16, ResponseKeyNT, 16, key_exch);
|
|
701
|
+
memcpy(auth_data->exported_session_key, key_exch, 16);
|
|
702
|
+
|
|
703
|
+
encode:
|
|
704
|
+
/*
|
|
705
|
+
* Generate AUTHENTICATE_MESSAGE
|
|
706
|
+
*/
|
|
707
|
+
encoder("NTLMSSP", 8, auth_data);
|
|
708
|
+
|
|
709
|
+
/* message type */
|
|
710
|
+
u32 = htole32(AUTHENTICATION_MESSAGE);
|
|
711
|
+
encoder(&u32, 4, auth_data);
|
|
712
|
+
|
|
713
|
+
/* lm challenge response fields */
|
|
714
|
+
u32 = 0;
|
|
715
|
+
encoder(&u32, 4, auth_data);
|
|
716
|
+
encoder(&u32, 4, auth_data);
|
|
717
|
+
|
|
718
|
+
/* nt challenge response fields */
|
|
719
|
+
u32 = htole32((NTChallengeResponse_len<<16)|
|
|
720
|
+
NTChallengeResponse_len);
|
|
721
|
+
encoder(&u32, 4, auth_data);
|
|
722
|
+
u32 = 0;
|
|
723
|
+
encoder(&u32, 4, auth_data);
|
|
724
|
+
|
|
725
|
+
/* domain name fields */
|
|
726
|
+
if (!anonymous && auth_data->domain) {
|
|
727
|
+
utf16_domain = smb2_utf8_to_utf16(auth_data->domain);
|
|
728
|
+
if (utf16_domain == NULL) {
|
|
729
|
+
goto finished;
|
|
730
|
+
}
|
|
731
|
+
u32 = utf16_domain->len * 2;
|
|
732
|
+
u32 = htole32((u32 << 16) | u32);
|
|
733
|
+
encoder(&u32, 4, auth_data);
|
|
734
|
+
u32 = 0;
|
|
735
|
+
encoder(&u32, 4, auth_data);
|
|
736
|
+
} else {
|
|
737
|
+
u32 = 0;
|
|
738
|
+
encoder(&u32, 4, auth_data);
|
|
739
|
+
encoder(&u32, 4, auth_data);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/* user name fields */
|
|
743
|
+
if (!anonymous) {
|
|
744
|
+
utf16_user = smb2_utf8_to_utf16(auth_data->user);
|
|
745
|
+
if (utf16_user == NULL) {
|
|
746
|
+
goto finished;
|
|
747
|
+
}
|
|
748
|
+
u32 = utf16_user->len * 2;
|
|
749
|
+
u32 = htole32((u32 << 16) | u32);
|
|
750
|
+
encoder(&u32, 4, auth_data);
|
|
751
|
+
u32 = 0;
|
|
752
|
+
encoder(&u32, 4, auth_data);
|
|
753
|
+
} else {
|
|
754
|
+
u32 = 0;
|
|
755
|
+
encoder(&u32, 4, auth_data);
|
|
756
|
+
encoder(&u32, 4, auth_data);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/* workstation name fields */
|
|
760
|
+
if (!anonymous && auth_data->workstation) {
|
|
761
|
+
utf16_workstation = smb2_utf8_to_utf16(auth_data->workstation);
|
|
762
|
+
if (utf16_workstation == NULL) {
|
|
763
|
+
goto finished;
|
|
764
|
+
}
|
|
765
|
+
u32 = utf16_workstation->len * 2;
|
|
766
|
+
u32 = htole32((u32 << 16) | u32);
|
|
767
|
+
encoder(&u32, 4, auth_data);
|
|
768
|
+
u32 = 0;
|
|
769
|
+
encoder(&u32, 4, auth_data);
|
|
770
|
+
} else {
|
|
771
|
+
u32 = 0;
|
|
772
|
+
encoder(&u32, 4, auth_data);
|
|
773
|
+
encoder(&u32, 4, auth_data);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/* encrypted random session key */
|
|
777
|
+
u32 = 0;
|
|
778
|
+
encoder(&u32, 4, auth_data);
|
|
779
|
+
encoder(&u32, 4, auth_data);
|
|
780
|
+
|
|
781
|
+
/* negotiate flags */
|
|
782
|
+
u32 = NTLMSSP_NEGOTIATE_128|
|
|
783
|
+
NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY|
|
|
784
|
+
NTLMSSP_NEGOTIATE_ALWAYS_SIGN|
|
|
785
|
+
NTLMSSP_NEGOTIATE_SIGN|
|
|
786
|
+
NTLMSSP_REQUEST_TARGET|NTLMSSP_NEGOTIATE_OEM|
|
|
787
|
+
NTLMSSP_NEGOTIATE_UNICODE;
|
|
788
|
+
if (anonymous)
|
|
789
|
+
u32 |= NTLMSSP_NEGOTIATE_ANONYMOUS;
|
|
790
|
+
else
|
|
791
|
+
u32 |= NTLMSSP_NEGOTIATE_SEAL;
|
|
792
|
+
|
|
793
|
+
u32 = htole32(u32);
|
|
794
|
+
encoder(&u32, 4, auth_data);
|
|
795
|
+
|
|
796
|
+
/* version - 8 bytes of 0 */
|
|
797
|
+
u32 = 0;
|
|
798
|
+
encoder(&u32, 4, auth_data);
|
|
799
|
+
encoder(&u32, 4, auth_data);
|
|
800
|
+
|
|
801
|
+
/* MIC - 16 byte message integrity code (after windows 2003) */
|
|
802
|
+
|
|
803
|
+
if (!anonymous) {
|
|
804
|
+
/* append domain */
|
|
805
|
+
u32 = htole32((uint32_t)auth_data->len);
|
|
806
|
+
memcpy(&auth_data->buf[32], &u32, 4);
|
|
807
|
+
if (utf16_domain) {
|
|
808
|
+
encoder(utf16_domain->val, utf16_domain->len * 2,
|
|
809
|
+
auth_data);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/* append user */
|
|
813
|
+
u32 = htole32((uint32_t)auth_data->len);
|
|
814
|
+
memcpy(&auth_data->buf[40], &u32, 4);
|
|
815
|
+
encoder(utf16_user->val, utf16_user->len * 2, auth_data);
|
|
816
|
+
|
|
817
|
+
/* append workstation */
|
|
818
|
+
u32 = htole32((uint32_t)auth_data->len);
|
|
819
|
+
memcpy(&auth_data->buf[48], &u32, 4);
|
|
820
|
+
if (utf16_workstation) {
|
|
821
|
+
encoder(utf16_workstation->val,
|
|
822
|
+
utf16_workstation->len * 2, auth_data);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/* append NTChallengeResponse */
|
|
826
|
+
u32 = htole32((uint32_t)auth_data->len);
|
|
827
|
+
memcpy(&auth_data->buf[24], &u32, 4);
|
|
828
|
+
encoder(NTChallengeResponse_buf, NTChallengeResponse_len,
|
|
829
|
+
auth_data);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
ret = 0;
|
|
833
|
+
finished:
|
|
834
|
+
free(utf16_domain);
|
|
835
|
+
free(utf16_user);
|
|
836
|
+
free(utf16_workstation);
|
|
837
|
+
free(NTChallengeResponse_buf);
|
|
838
|
+
|
|
839
|
+
return ret;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
static int
|
|
843
|
+
encode_ntlm_challenge(struct smb2_context *smb2, struct auth_data *auth_data)
|
|
844
|
+
{
|
|
845
|
+
int ret = -1;
|
|
846
|
+
struct smb2_utf16 *utf16_workstation = NULL;
|
|
847
|
+
struct smb2_utf16 *utf16_workstation_upper = NULL;
|
|
848
|
+
uint16_t u16;
|
|
849
|
+
uint32_t u32;
|
|
850
|
+
uint64_t u64;
|
|
851
|
+
uint8_t anonymous = 0;
|
|
852
|
+
int target_info_pos;
|
|
853
|
+
int namelen;
|
|
854
|
+
int cc;
|
|
855
|
+
char *upper = NULL;
|
|
856
|
+
|
|
857
|
+
/* Generate CHALLENGE_MESSAGE */
|
|
858
|
+
encoder("NTLMSSP", 8, auth_data);
|
|
859
|
+
|
|
860
|
+
/* message type */
|
|
861
|
+
u32 = htole32(CHALLENGE_MESSAGE);
|
|
862
|
+
encoder(&u32, 4, auth_data);
|
|
863
|
+
|
|
864
|
+
/* target name fields */
|
|
865
|
+
u32 = 0;
|
|
866
|
+
encoder(&u32, 4, auth_data);
|
|
867
|
+
encoder(&u32, 4, auth_data);
|
|
868
|
+
|
|
869
|
+
/* negotiate flags */
|
|
870
|
+
u32 = NTLMSSP_NEGOTIATE_128|
|
|
871
|
+
NTLMSSP_NEGOTIATE_TARGET_INFO|
|
|
872
|
+
NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY|
|
|
873
|
+
NTLMSSP_NEGOTIATE_ALWAYS_SIGN|
|
|
874
|
+
NTLMSSP_NEGOTIATE_SIGN|
|
|
875
|
+
/* NTLMSSP_NEGOTIATE_KEY_EXCH| */
|
|
876
|
+
NTLMSSP_REQUEST_TARGET|NTLMSSP_NEGOTIATE_OEM|
|
|
877
|
+
NTLMSSP_NEGOTIATE_VERSION|
|
|
878
|
+
NTLMSSP_NEGOTIATE_UNICODE;
|
|
879
|
+
if (anonymous)
|
|
880
|
+
u32 |= NTLMSSP_NEGOTIATE_ANONYMOUS;
|
|
881
|
+
else
|
|
882
|
+
u32 |= NTLMSSP_NEGOTIATE_SEAL;
|
|
883
|
+
|
|
884
|
+
u32 = htole32(u32);
|
|
885
|
+
encoder(&u32, 4, auth_data);
|
|
886
|
+
|
|
887
|
+
/* server challenge */
|
|
888
|
+
for (cc = 0; cc < 8; cc++) {
|
|
889
|
+
auth_data->server_challenge[cc] = cc + 1;
|
|
890
|
+
}
|
|
891
|
+
encoder(auth_data->server_challenge, 8, auth_data);
|
|
892
|
+
|
|
893
|
+
/* reserved */
|
|
894
|
+
u32 = 0;
|
|
895
|
+
encoder(&u32, 4, auth_data);
|
|
896
|
+
encoder(&u32, 4, auth_data);
|
|
897
|
+
|
|
898
|
+
/* target into fields */
|
|
899
|
+
encoder(&u32, 4, auth_data);
|
|
900
|
+
encoder(&u32, 4, auth_data);
|
|
901
|
+
|
|
902
|
+
/* version (if we set negotiate version flag */
|
|
903
|
+
u32 = htole32(0x00000106);
|
|
904
|
+
encoder(&u32, 4, auth_data);
|
|
905
|
+
u32 = htole32(0x0F000000);
|
|
906
|
+
encoder(&u32, 4, auth_data);
|
|
907
|
+
|
|
908
|
+
/* target name */
|
|
909
|
+
if (auth_data->workstation) {
|
|
910
|
+
int i;
|
|
911
|
+
namelen = strlen(auth_data->workstation);
|
|
912
|
+
upper = malloc(namelen + 1);
|
|
913
|
+
if (!upper) {
|
|
914
|
+
return -1;
|
|
915
|
+
}
|
|
916
|
+
for (i = 0; i < namelen; i++) {
|
|
917
|
+
upper[i] = toupper(auth_data->workstation[i]);
|
|
918
|
+
}
|
|
919
|
+
upper[namelen] = 0;
|
|
920
|
+
utf16_workstation = smb2_utf8_to_utf16(auth_data->workstation);
|
|
921
|
+
if (utf16_workstation == NULL) {
|
|
922
|
+
goto finished;
|
|
923
|
+
}
|
|
924
|
+
utf16_workstation_upper = smb2_utf8_to_utf16(upper);
|
|
925
|
+
if (utf16_workstation_upper == NULL) {
|
|
926
|
+
goto finished;
|
|
927
|
+
}
|
|
928
|
+
u32 = htole32(auth_data->len);
|
|
929
|
+
memcpy(&auth_data->buf[16], &u32, 4);
|
|
930
|
+
u32 = utf16_workstation->len * 2;
|
|
931
|
+
u32 = htole32((u32 << 16) | u32);
|
|
932
|
+
memcpy(&auth_data->buf[12], &u32, 4);
|
|
933
|
+
encoder(utf16_workstation_upper->val,
|
|
934
|
+
utf16_workstation_upper->len * 2, auth_data);
|
|
935
|
+
}
|
|
936
|
+
/* target info fields */
|
|
937
|
+
target_info_pos = auth_data->len;
|
|
938
|
+
if (utf16_workstation) {
|
|
939
|
+
u16 = 0x0002; /* netbios domain */
|
|
940
|
+
encoder(&u16, 2, auth_data);
|
|
941
|
+
u16 = utf16_workstation_upper->len * 2;
|
|
942
|
+
encoder(&u16, 2, auth_data);
|
|
943
|
+
encoder(utf16_workstation_upper->val,
|
|
944
|
+
utf16_workstation_upper->len * 2, auth_data);
|
|
945
|
+
u16 = 0x0001; /* netbios computer name */
|
|
946
|
+
encoder(&u16, 2, auth_data);
|
|
947
|
+
u16 = utf16_workstation->len * 2;
|
|
948
|
+
encoder(&u16, 2, auth_data);
|
|
949
|
+
encoder(utf16_workstation_upper->val,
|
|
950
|
+
utf16_workstation_upper->len * 2, auth_data);
|
|
951
|
+
u16 = 0x0004; /* dns domain name */
|
|
952
|
+
encoder(&u16, 2, auth_data);
|
|
953
|
+
u16 = 0;
|
|
954
|
+
encoder(&u16, 2, auth_data);
|
|
955
|
+
u16 = 0x0003; /* dns computer name */
|
|
956
|
+
encoder(&u16, 2, auth_data);
|
|
957
|
+
u16 = utf16_workstation->len * 2;
|
|
958
|
+
encoder(&u16, 2, auth_data);
|
|
959
|
+
encoder(utf16_workstation->val,
|
|
960
|
+
utf16_workstation->len * 2, auth_data);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/* target info timestamp */
|
|
964
|
+
u16 = 0x0007;
|
|
965
|
+
encoder(&u16, 2, auth_data);
|
|
966
|
+
u16 = 8;
|
|
967
|
+
encoder(&u16, 2, auth_data);
|
|
968
|
+
u64 = auth_data->wintime;
|
|
969
|
+
encoder(&u64, 8, auth_data);
|
|
970
|
+
|
|
971
|
+
/* end of info */
|
|
972
|
+
u32 = 0;
|
|
973
|
+
encoder(&u32, 4, auth_data);
|
|
974
|
+
|
|
975
|
+
/* save the target info in auth-data for later */
|
|
976
|
+
auth_data->target_info_len = auth_data->len - target_info_pos;
|
|
977
|
+
auth_data->target_info = malloc(auth_data->target_info_len);
|
|
978
|
+
memcpy(auth_data->target_info,
|
|
979
|
+
auth_data->buf + target_info_pos,
|
|
980
|
+
auth_data->target_info_len);
|
|
981
|
+
|
|
982
|
+
/* back annotate length of target info */
|
|
983
|
+
u16 = htole16(auth_data->len - target_info_pos);
|
|
984
|
+
memcpy(&auth_data->buf[40], &u16, 2);
|
|
985
|
+
memcpy(&auth_data->buf[42], &u16, 2);
|
|
986
|
+
u16 = htole16(target_info_pos);
|
|
987
|
+
memcpy(&auth_data->buf[44], &u16, 2);
|
|
988
|
+
|
|
989
|
+
ret = 0;
|
|
990
|
+
finished:
|
|
991
|
+
if (upper) {
|
|
992
|
+
free(upper);
|
|
993
|
+
}
|
|
994
|
+
if (utf16_workstation) {
|
|
995
|
+
free(utf16_workstation);
|
|
996
|
+
}
|
|
997
|
+
if (utf16_workstation_upper) {
|
|
998
|
+
free(utf16_workstation_upper);
|
|
999
|
+
}
|
|
1000
|
+
return ret;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
int
|
|
1004
|
+
ntlmssp_generate_blob(struct smb2_server *server, struct smb2_context *smb2, time_t t,
|
|
1005
|
+
struct auth_data *auth_data,
|
|
1006
|
+
unsigned char *input_buf, int input_len,
|
|
1007
|
+
unsigned char **output_buf, uint16_t *output_len)
|
|
1008
|
+
{
|
|
1009
|
+
uint32_t cmd;
|
|
1010
|
+
uint8_t *ntlmssp;
|
|
1011
|
+
int ntlmssp_len;
|
|
1012
|
+
uint8_t *spnego_buf;
|
|
1013
|
+
int spnego_len;
|
|
1014
|
+
int is_wrapped;
|
|
1015
|
+
|
|
1016
|
+
free(auth_data->buf);
|
|
1017
|
+
auth_data->buf = NULL;
|
|
1018
|
+
auth_data->len = 0;
|
|
1019
|
+
auth_data->allocated = 0;
|
|
1020
|
+
|
|
1021
|
+
if (input_buf == NULL) {
|
|
1022
|
+
if (smb2_is_server(smb2)) {
|
|
1023
|
+
return -1;
|
|
1024
|
+
}
|
|
1025
|
+
encode_ntlm_negotiate_message(smb2, auth_data);
|
|
1026
|
+
|
|
1027
|
+
if (auth_data->spnego_wrap) {
|
|
1028
|
+
spnego_len = smb2_spnego_wrap_gssapi(smb2, auth_data->buf,
|
|
1029
|
+
auth_data->len, (void*)&spnego_buf);
|
|
1030
|
+
if (spnego_len < 0) {
|
|
1031
|
+
smb2_set_error(smb2, "can not wrap negotiate");
|
|
1032
|
+
return -1;
|
|
1033
|
+
}
|
|
1034
|
+
free(auth_data->buf);
|
|
1035
|
+
auth_data->buf = spnego_buf;
|
|
1036
|
+
auth_data->len = spnego_len;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
else {
|
|
1040
|
+
if(ntlmssp_get_message_type(smb2, input_buf,
|
|
1041
|
+
input_len,
|
|
1042
|
+
0,
|
|
1043
|
+
&cmd,
|
|
1044
|
+
&ntlmssp, &ntlmssp_len,
|
|
1045
|
+
&is_wrapped) < 0) {
|
|
1046
|
+
ntlmssp_len = 0;
|
|
1047
|
+
}
|
|
1048
|
+
if (ntlmssp_len < 12) {
|
|
1049
|
+
smb2_set_error(smb2, "no message type in NTLMSSP blob");
|
|
1050
|
+
return -1;
|
|
1051
|
+
}
|
|
1052
|
+
if (is_wrapped) {
|
|
1053
|
+
auth_data->spnego_wrap = 1;
|
|
1054
|
+
}
|
|
1055
|
+
if (smb2_is_server(smb2)) {
|
|
1056
|
+
if (cmd == NEGOTIATE_MESSAGE) {
|
|
1057
|
+
if (encode_ntlm_challenge(smb2, auth_data)) {
|
|
1058
|
+
smb2_set_error(smb2, "can not encode challenge");
|
|
1059
|
+
return -1;
|
|
1060
|
+
}
|
|
1061
|
+
if (auth_data->spnego_wrap) {
|
|
1062
|
+
spnego_len = smb2_spnego_wrap_ntlmssp_challenge(smb2,
|
|
1063
|
+
auth_data->buf,
|
|
1064
|
+
auth_data->len, (void*)&spnego_buf);
|
|
1065
|
+
if (spnego_len < 0) {
|
|
1066
|
+
smb2_set_error(smb2, "can not wrap challenge");
|
|
1067
|
+
return -1;
|
|
1068
|
+
}
|
|
1069
|
+
free(auth_data->buf);
|
|
1070
|
+
auth_data->buf = spnego_buf;
|
|
1071
|
+
auth_data->len = spnego_len;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
else if (cmd == AUTHENTICATION_MESSAGE) {
|
|
1075
|
+
auth_data->is_authenticated = !ntlmssp_authenticate_blob(server,
|
|
1076
|
+
smb2, auth_data,
|
|
1077
|
+
ntlmssp, ntlmssp_len);
|
|
1078
|
+
if (auth_data->spnego_wrap) {
|
|
1079
|
+
spnego_len = smb2_spnego_wrap_authenticate_result(smb2,
|
|
1080
|
+
auth_data->is_authenticated, (void*)&spnego_buf);
|
|
1081
|
+
if (spnego_len < 0) {
|
|
1082
|
+
smb2_set_error(smb2, "can not wrap auth result");
|
|
1083
|
+
return -1;
|
|
1084
|
+
}
|
|
1085
|
+
free(auth_data->buf);
|
|
1086
|
+
auth_data->buf = spnego_buf;
|
|
1087
|
+
auth_data->len = spnego_len;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
else {
|
|
1091
|
+
return -1;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
else {
|
|
1095
|
+
if (cmd == CHALLENGE_MESSAGE) {
|
|
1096
|
+
if (ntlm_decode_challenge_message(smb2, auth_data,
|
|
1097
|
+
ntlmssp, ntlmssp_len) < 0) {
|
|
1098
|
+
smb2_set_error(smb2, "can not decode challenge");
|
|
1099
|
+
return -1;
|
|
1100
|
+
}
|
|
1101
|
+
if (auth_data->domain == NULL && auth_data->target_name) {
|
|
1102
|
+
smb2_set_domain(smb2, auth_data->target_name);
|
|
1103
|
+
auth_data->domain = strdup(auth_data->target_name);
|
|
1104
|
+
if (auth_data->domain == NULL) {
|
|
1105
|
+
return -1;
|
|
1106
|
+
}
|
|
1107
|
+
/* Update the password now that we know the domain */
|
|
1108
|
+
smb2_set_password_from_file(smb2);
|
|
1109
|
+
}
|
|
1110
|
+
if (encode_ntlm_auth(smb2, t, auth_data,
|
|
1111
|
+
(char *)&auth_data->ntlm_buf[24]) < 0) {
|
|
1112
|
+
smb2_set_error(smb2, "can not encode auth data");
|
|
1113
|
+
return -1;
|
|
1114
|
+
}
|
|
1115
|
+
if (auth_data->spnego_wrap) {
|
|
1116
|
+
spnego_len = smb2_spnego_wrap_ntlmssp_auth(smb2,
|
|
1117
|
+
auth_data->buf, auth_data->len,
|
|
1118
|
+
(void*)&spnego_buf);
|
|
1119
|
+
if (spnego_len < 0) {
|
|
1120
|
+
smb2_set_error(smb2, "can not wrap auth result");
|
|
1121
|
+
return -1;
|
|
1122
|
+
}
|
|
1123
|
+
free(auth_data->buf);
|
|
1124
|
+
auth_data->buf = spnego_buf;
|
|
1125
|
+
auth_data->len = spnego_len;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
else {
|
|
1129
|
+
smb2_set_error(smb2, "Unexpected NTLMSSP message %08X, wanted challenge", cmd);
|
|
1130
|
+
return -1;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
*output_buf = auth_data->buf;
|
|
1136
|
+
*output_len = (uint16_t)auth_data->len;
|
|
1137
|
+
|
|
1138
|
+
return 0;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
void
|
|
1142
|
+
ntlmssp_get_utf16_field(uint8_t *input_buf, int input_len, int offset, char **result)
|
|
1143
|
+
{
|
|
1144
|
+
uint32_t field_len;
|
|
1145
|
+
uint32_t field_off;
|
|
1146
|
+
uint32_t u32;
|
|
1147
|
+
|
|
1148
|
+
*result = NULL;
|
|
1149
|
+
|
|
1150
|
+
if (offset > (input_len - 8)) {
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
memcpy(&u32, &input_buf[offset], 4);
|
|
1154
|
+
field_len = le32toh(u32) >> 16;
|
|
1155
|
+
memcpy(&u32, &input_buf[offset + 4], 4);
|
|
1156
|
+
field_off = le32toh(u32);
|
|
1157
|
+
if (field_len && field_off) {
|
|
1158
|
+
*result = (char*)smb2_utf16_to_utf8((uint16_t *)(void *)(input_buf + field_off), field_len / 2);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
int
|
|
1163
|
+
ntlmssp_authenticate_blob(struct smb2_server *server, struct smb2_context *smb2,
|
|
1164
|
+
struct auth_data *auth_data,
|
|
1165
|
+
unsigned char *input_buf, int input_len)
|
|
1166
|
+
{
|
|
1167
|
+
unsigned char ResponseKeyNT[16];
|
|
1168
|
+
unsigned char NTProofStr[16];
|
|
1169
|
+
unsigned char key_exch[SMB2_KEY_SIZE];
|
|
1170
|
+
uint32_t field_len;
|
|
1171
|
+
uint32_t field_off;
|
|
1172
|
+
uint32_t challenge_len;
|
|
1173
|
+
uint8_t *response;
|
|
1174
|
+
uint8_t *temp;
|
|
1175
|
+
uint32_t temp_len;
|
|
1176
|
+
int ret = -1;
|
|
1177
|
+
/* uint32_t negotiate_flags; */
|
|
1178
|
+
uint32_t u32;
|
|
1179
|
+
|
|
1180
|
+
if (!input_buf || (input_len < 8) || memcmp(input_buf, "NTLMSSP", 8)) {
|
|
1181
|
+
return -1;
|
|
1182
|
+
}
|
|
1183
|
+
memcpy(&u32, &input_buf[4*2], 4);
|
|
1184
|
+
u32 = le32toh(u32);
|
|
1185
|
+
if (u32 != AUTHENTICATION_MESSAGE) {
|
|
1186
|
+
return -1;
|
|
1187
|
+
}
|
|
1188
|
+
if (auth_data->domain) {
|
|
1189
|
+
free(auth_data->domain);
|
|
1190
|
+
auth_data->domain = NULL;
|
|
1191
|
+
}
|
|
1192
|
+
if (auth_data->user) {
|
|
1193
|
+
free(auth_data->user);
|
|
1194
|
+
auth_data->user = NULL;
|
|
1195
|
+
}
|
|
1196
|
+
if (auth_data->workstation) {
|
|
1197
|
+
free(auth_data->workstation);
|
|
1198
|
+
auth_data->workstation = NULL;
|
|
1199
|
+
}
|
|
1200
|
+
ntlmssp_get_utf16_field(input_buf, input_len, 4*7, &auth_data->domain);
|
|
1201
|
+
ntlmssp_get_utf16_field(input_buf, input_len, 4*9, &auth_data->user);
|
|
1202
|
+
ntlmssp_get_utf16_field(input_buf, input_len, 4*11, &auth_data->workstation);
|
|
1203
|
+
memcpy(&u32, &input_buf[4*15], 4);
|
|
1204
|
+
|
|
1205
|
+
smb2_set_user(smb2, auth_data->user);
|
|
1206
|
+
smb2_set_domain(smb2, auth_data->domain);
|
|
1207
|
+
smb2_set_workstation(smb2, auth_data->workstation);
|
|
1208
|
+
|
|
1209
|
+
/* call server handler to get pw for this user */
|
|
1210
|
+
if (server && server->handlers) {
|
|
1211
|
+
if(server->handlers->authorize_user(server, smb2,
|
|
1212
|
+
auth_data->user,
|
|
1213
|
+
auth_data->domain,
|
|
1214
|
+
auth_data->workstation)) {
|
|
1215
|
+
smb2_set_error(smb2, "server can not authorize %s",
|
|
1216
|
+
auth_data->user);
|
|
1217
|
+
return -1;
|
|
1218
|
+
}
|
|
1219
|
+
if (!smb2->password && !server->allow_anonymous) {
|
|
1220
|
+
smb2_set_error(smb2, "server has no passwd for %s",
|
|
1221
|
+
auth_data->user);
|
|
1222
|
+
return -1;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
/* if no user/pw, and anonymous allowed, do anonymous */
|
|
1226
|
+
if (!auth_data->user || (auth_data->user[0] == '\0') ||
|
|
1227
|
+
!smb2->password || (smb2->password[0] == '\0')) {
|
|
1228
|
+
if (server->allow_anonymous) {
|
|
1229
|
+
return 0;
|
|
1230
|
+
}
|
|
1231
|
+
return -1;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/* negotiate_flags = le32toh(u32); */
|
|
1235
|
+
|
|
1236
|
+
/* Lan Man response (we dont even look at, its obsolete) */
|
|
1237
|
+
|
|
1238
|
+
/* NTLM response */
|
|
1239
|
+
memcpy(&u32, &input_buf[4*5], 4);
|
|
1240
|
+
field_len = le32toh(u32) >> 16;
|
|
1241
|
+
memcpy(&u32, &input_buf[4*6], 4);
|
|
1242
|
+
field_off = le32toh(u32);
|
|
1243
|
+
if (field_len == 0 || field_off == 0) {
|
|
1244
|
+
return -1;
|
|
1245
|
+
}
|
|
1246
|
+
if (field_off > (uint32_t)input_len) {
|
|
1247
|
+
return -1;
|
|
1248
|
+
}
|
|
1249
|
+
/* 16 byte NTLMv2 response */
|
|
1250
|
+
response = input_buf + field_off;
|
|
1251
|
+
challenge_len = field_len - 16;
|
|
1252
|
+
if (challenge_len > 9*4) {
|
|
1253
|
+
temp = input_buf + field_off + 16;
|
|
1254
|
+
temp_len = field_len - 16;
|
|
1255
|
+
if (auth_data->client_challenge) {
|
|
1256
|
+
free(auth_data->client_challenge);
|
|
1257
|
+
}
|
|
1258
|
+
auth_data->client_challenge = malloc(8);
|
|
1259
|
+
memcpy(auth_data->client_challenge, input_buf + field_off + 32, 8);
|
|
1260
|
+
}
|
|
1261
|
+
else {
|
|
1262
|
+
smb2_set_error(smb2, "bad NTLMSSP challenge len %d",
|
|
1263
|
+
challenge_len);
|
|
1264
|
+
return -1;
|
|
1265
|
+
}
|
|
1266
|
+
if (NTOWFv2(auth_data->user, smb2->password,
|
|
1267
|
+
auth_data->domain, ResponseKeyNT) < 0) {
|
|
1268
|
+
return -1;
|
|
1269
|
+
}
|
|
1270
|
+
/* wipe pw out now that its been used */
|
|
1271
|
+
smb2_set_password(smb2, "");
|
|
1272
|
+
auth_data->len = 0;
|
|
1273
|
+
if (encoder(auth_data->server_challenge, 8, auth_data)) {
|
|
1274
|
+
return -1;
|
|
1275
|
+
}
|
|
1276
|
+
if (encoder(temp, temp_len, auth_data)) {
|
|
1277
|
+
return -1;
|
|
1278
|
+
}
|
|
1279
|
+
temp = auth_data->buf;
|
|
1280
|
+
temp_len = auth_data->len;
|
|
1281
|
+
|
|
1282
|
+
smb2_hmac_md5(temp, temp_len, ResponseKeyNT, 16, NTProofStr);
|
|
1283
|
+
memcpy(auth_data->buf, NTProofStr, 16);
|
|
1284
|
+
|
|
1285
|
+
/* verify ntproof */
|
|
1286
|
+
if (memcmp(NTProofStr, response, 16)) {
|
|
1287
|
+
smb2_set_error(smb2, "NTLMSSP NTProof != response. Auth failed");
|
|
1288
|
+
goto fail;
|
|
1289
|
+
}
|
|
1290
|
+
smb2_hmac_md5(NTProofStr, 16, ResponseKeyNT, 16, key_exch);
|
|
1291
|
+
memcpy(auth_data->exported_session_key, key_exch, 16);
|
|
1292
|
+
ret = 0;
|
|
1293
|
+
fail:
|
|
1294
|
+
free(auth_data->buf);
|
|
1295
|
+
auth_data->buf = NULL;
|
|
1296
|
+
auth_data->len = 0;
|
|
1297
|
+
return ret;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
int
|
|
1302
|
+
ntlmssp_get_session_key(struct auth_data *auth,
|
|
1303
|
+
uint8_t **key,
|
|
1304
|
+
uint8_t *key_size)
|
|
1305
|
+
{
|
|
1306
|
+
uint8_t *mkey = NULL;
|
|
1307
|
+
|
|
1308
|
+
if (auth == NULL || key == NULL || key_size == NULL) {
|
|
1309
|
+
return -1;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
mkey = (uint8_t *) malloc(SMB2_KEY_SIZE);
|
|
1313
|
+
if (mkey == NULL) {
|
|
1314
|
+
return -1;
|
|
1315
|
+
}
|
|
1316
|
+
memcpy(mkey, auth->exported_session_key, SMB2_KEY_SIZE);
|
|
1317
|
+
|
|
1318
|
+
*key = mkey;
|
|
1319
|
+
*key_size = SMB2_KEY_SIZE;
|
|
1320
|
+
|
|
1321
|
+
return 0;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
int
|
|
1325
|
+
ntlmssp_get_message_type(struct smb2_context *smb2,
|
|
1326
|
+
uint8_t *buffer, int len,
|
|
1327
|
+
int suppress_errors,
|
|
1328
|
+
uint32_t *message_type,
|
|
1329
|
+
uint8_t **ntlmssp_ptr, int *ntlmssp_len,
|
|
1330
|
+
int *is_wrapped)
|
|
1331
|
+
{
|
|
1332
|
+
uint8_t *ntlmssp = NULL;
|
|
1333
|
+
uint32_t u32;
|
|
1334
|
+
uint32_t mechanisms;
|
|
1335
|
+
int ntlm_len;
|
|
1336
|
+
|
|
1337
|
+
if (message_type) {
|
|
1338
|
+
*message_type = 0xFFFFFFFF;
|
|
1339
|
+
}
|
|
1340
|
+
if (ntlmssp_ptr) {
|
|
1341
|
+
*ntlmssp_ptr = NULL;
|
|
1342
|
+
}
|
|
1343
|
+
if (ntlmssp_len) {
|
|
1344
|
+
*ntlmssp_len = 0;
|
|
1345
|
+
}
|
|
1346
|
+
if (!buffer || len < 12) {
|
|
1347
|
+
return -1;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
ntlm_len = smb2_spnego_unwrap_blob(smb2, buffer, len,
|
|
1351
|
+
suppress_errors, &ntlmssp, &mechanisms);
|
|
1352
|
+
if (ntlm_len < 12 || !ntlmssp) {
|
|
1353
|
+
return -1;
|
|
1354
|
+
}
|
|
1355
|
+
if (ntlmssp != buffer) {
|
|
1356
|
+
if (is_wrapped) {
|
|
1357
|
+
*is_wrapped = 1;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
else {
|
|
1361
|
+
if (is_wrapped) {
|
|
1362
|
+
*is_wrapped = 0;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
if (ntlmssp_ptr) {
|
|
1366
|
+
*ntlmssp_ptr = ntlmssp;
|
|
1367
|
+
}
|
|
1368
|
+
if (ntlmssp_len) {
|
|
1369
|
+
*ntlmssp_len = ntlm_len;
|
|
1370
|
+
}
|
|
1371
|
+
if (!memcmp(ntlmssp, "NTLMSSP", 7)) {
|
|
1372
|
+
memcpy(&u32, ntlmssp + 8, sizeof(uint32_t));
|
|
1373
|
+
if (message_type) {
|
|
1374
|
+
*message_type = le32toh(u32);
|
|
1375
|
+
}
|
|
1376
|
+
return 0;
|
|
1377
|
+
}
|
|
1378
|
+
return -1;
|
|
1379
|
+
}
|
|
1380
|
+
|