Ronnie Sahlberg [Wed, 24 Jun 2020 07:29:54 +0000 (17:29 +1000)]
Merge branch 'master' of github.com:sahlberg/libsmb2
Ronnie Sahlberg [Wed, 24 Jun 2020 05:41:45 +0000 (15:41 +1000)]
dcerpc: fix handling of pointers for NetShareGetInfo ndr64
our pointer alignment was broken
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Timmeh87 [Fri, 19 Jun 2020 22:13:59 +0000 (18:13 -0400)]
Added connection timeout for sync interface, now if not 'is_connected' after 'timeout' seconds, operation is aborted regardless of status
Ronnie Sahlberg [Tue, 23 Jun 2020 05:13:04 +0000 (15:13 +1000)]
Merge pull request #149 from timmeh87/master
Improved timeout for sync interface when connection does not exist
Ronnie Sahlberg [Wed, 17 Jun 2020 04:25:53 +0000 (14:25 +1000)]
dcerpc: rework dcerpc and try to layer it a little better vs smb2
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Timmeh87 [Fri, 19 Jun 2020 22:13:59 +0000 (18:13 -0400)]
Added connection timeout for sync interface, now if not 'is_connected' after 'timeout' seconds, operation is aborted regardless of status
Ronnie Sahlberg [Wed, 17 Jun 2020 02:34:55 +0000 (12:34 +1000)]
Merge pull request #147 from timmeh87/master
winsock error message / null pointer checks
Timmeh87 [Mon, 15 Jun 2020 20:47:00 +0000 (16:47 -0400)]
Added windows specific error message if winsock is not init
added null pointer checks to some of the core api functions to improve reliability
Ronnie Sahlberg [Thu, 11 Jun 2020 21:30:18 +0000 (07:30 +1000)]
smb2-cat-sync: improve the example read loop
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 11 Jun 2020 01:39:12 +0000 (11:39 +1000)]
smb2-cat-sync: try to use very large reads
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 11 Jun 2020 01:16:58 +0000 (11:16 +1000)]
pread/pwrite: make sure to always update the number of credits we need
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Tue, 12 May 2020 02:21:38 +0000 (12:21 +1000)]
Add support for timeout
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Mon, 20 Apr 2020 05:33:42 +0000 (15:33 +1000)]
sync: don't access freed memory for cancelled PDUs
If we fail wait_for_reply in the sync API it means that the the underlying
SMB2 PDU might still be in fligth and our sync callback will be invoked later.
Solve this by not freeing the cb_data structure on wait_for_reply failures
and instead just flag the status as CANCELLED.
Later when the callback is invoked, if status is CANCELLED it means we should
just free cb_data and return.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Mon, 20 Apr 2020 04:26:09 +0000 (14:26 +1000)]
sync: don't use cb structures allocated on the stack
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Mon, 20 Apr 2020 03:49:06 +0000 (13:49 +1000)]
Revert "We can not access cb_data when status is CANCELLED"
This reverts commit
5c4d6db14ce4048b7d08d9af3307022ba4992833.
Ronnie Sahlberg [Fri, 17 Apr 2020 02:31:31 +0000 (12:31 +1000)]
Merge pull request #139 from amandeepgautam/master
return appropriate error codes on failure
Ronnie Sahlberg [Sun, 12 Apr 2020 03:29:05 +0000 (13:29 +1000)]
Add a URL argument and API to enforce signing
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Amandeep Gautam [Thu, 9 Apr 2020 01:18:24 +0000 (18:18 -0700)]
return appropriate error codes on failure
with current change one can have same error handling logic for callbacks and
function return values. '-1' corresponds to permission denied which
makes it problematic.
Ronnie Sahlberg [Sun, 5 Apr 2020 23:10:16 +0000 (09:10 +1000)]
Merge pull request #138 from amandeepgautam/master
fix regression from commit: "extend error codes (from samba)"
Amandeep Gautam [Sun, 5 Apr 2020 22:38:49 +0000 (15:38 -0700)]
fix regression from commit: "extend error codes (from samba)"
Ronnie Sahlberg [Fri, 20 Mar 2020 08:39:55 +0000 (18:39 +1000)]
Merge pull request #136 from amandeepgautam/master
add const for filename
Amandeep Gautam [Fri, 20 Mar 2020 08:26:37 +0000 (01:26 -0700)]
add const for filename
Ronnie Sahlberg [Mon, 9 Mar 2020 05:52:12 +0000 (15:52 +1000)]
dcerpc: the srvsvc_interface belong in dcerpc-srvsvc.c not dcerpc.c
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Fri, 6 Mar 2020 01:29:04 +0000 (11:29 +1000)]
dcerpc: add example of NetShareGetInfo
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Sun, 23 Feb 2020 10:54:07 +0000 (20:54 +1000)]
dcerpc: make it possible to control le/be from url arguments for testing
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Sun, 23 Feb 2020 05:02:44 +0000 (15:02 +1000)]
dcerpc: make it possible to select ndr transfer syntax from url for testing
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Sat, 22 Feb 2020 20:44:23 +0000 (06:44 +1000)]
dcerpc: fix top level ref pointer bug.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Sat, 22 Feb 2020 20:36:16 +0000 (06:36 +1000)]
dcerpc: add comment that NDR64 is only available for LE encodings
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Sat, 22 Feb 2020 07:18:47 +0000 (17:18 +1000)]
dcerpc: we need portable-endian.h for some platforms
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Sat, 22 Feb 2020 04:19:00 +0000 (14:19 +1000)]
dcerpc: support sending dcerpc pdus in big-endian mode
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Fri, 21 Feb 2020 22:24:19 +0000 (08:24 +1000)]
dcerpc: track the data representation in the dcerpc context
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 20 Feb 2020 04:48:24 +0000 (14:48 +1000)]
We can not access cb_data when status is CANCELLED
since the pointer may no longer be valid.
Reported-by: hgourvest@progdigy.com
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 20 Feb 2020 04:23:12 +0000 (14:23 +1000)]
Fix cast in dcerpc.c
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 20 Feb 2020 03:39:27 +0000 (13:39 +1000)]
IPv6 is available on all platforms. No need to check for it
We weren't even checking for this in configure.ac anyway.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Tue, 18 Feb 2020 10:00:54 +0000 (20:00 +1000)]
Merge pull request #130 from amandeepgautam/master
extend error codes (from samba)
Ronnie Sahlberg [Tue, 11 Feb 2020 06:00:29 +0000 (16:00 +1000)]
Add callbacks to notify application of fd or event changes
Add callbacks to allow libsmb2 to call back into the application to
inform when the filedescriptor to wait on changes or when the set
ot events (POLLIN/POLLOUT) changes.
This allows better integration with more sophisticated eventsystems
such as those built on epoll() than the older way libsmb2 provided.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Tue, 11 Feb 2020 01:44:31 +0000 (11:44 +1000)]
Merge pull request #132 from
76716C86/master
fix __cplusplus guards
Catalin Pichiu [Mon, 3 Feb 2020 10:29:44 +0000 (12:29 +0200)]
fix __cplusplus guards
* Some functions weren't included in the __cplusplus scope which caused
the compiler to mangle those names which made it impossible for the
linker to find the proper names.
* Properly close all the __cplusplus scopes. Some of them were left
opened and caused weird errors when compiling c++ code.
Amandeep Gautam [Fri, 31 Jan 2020 21:24:22 +0000 (13:24 -0800)]
extend error codes (from samba)
Ronnie Sahlberg [Thu, 9 Jan 2020 03:49:50 +0000 (13:49 +1000)]
Merge pull request #128 from amandeepgautam/master
add const qualifier for smb write related code
Amandeep Gautam [Wed, 8 Jan 2020 02:26:56 +0000 (18:26 -0800)]
add const qualifier for smb write related code
Ronnie Sahlberg [Wed, 18 Dec 2019 07:37:09 +0000 (17:37 +1000)]
Merge pull request #124 from amandeepgautam/master
do not clamp read/write request to 60KB
Amandeep Gautam [Wed, 18 Dec 2019 07:30:40 +0000 (23:30 -0800)]
do not clamp read/write request to 60KB
Ronnie Sahlberg [Wed, 18 Dec 2019 07:06:25 +0000 (17:06 +1000)]
Merge pull request #123 from amandeepgautam/master
evaluate smb status before call to krb5 lib
Amandeep Gautam [Wed, 18 Dec 2019 05:37:34 +0000 (21:37 -0800)]
update readme to say that signing is supported with ntlm plugin
Amandeep Gautam [Tue, 17 Dec 2019 08:40:31 +0000 (00:40 -0800)]
evaluate smb status before call to krb5 lib
This leads to better error messages. For example, for incorrect pass we
have a message like following:
Session setup failed with (0xc000006d) STATUS_LOGON_FAILURE (-111)
with current change instead of
gss_init_sec_context: (Invalid token was supplied, Unknown error) (-1)
Ronnie Sahlberg [Tue, 26 Nov 2019 12:06:33 +0000 (22:06 +1000)]
fix SIGBUS in smb2_set_uint64
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Namjae Jeon [Mon, 18 Nov 2019 00:49:06 +0000 (19:49 -0500)]
libsmb2: don't call dcerpc_free_pdu to avoid use-after-free
ret = dcerpc_decode_pdu(dce, pdu, &iov);
if (ret < 0) {
pdu->cb(dce, -EINVAL, NULL, pdu->cb_data); -> use after free.
smb2_free_data(dce->smb2, rep->output);
dcerpc_free_pdu(dce, pdu); -> re-free here.
return;
}
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Namjae Jeon [Mon, 18 Nov 2019 00:49:07 +0000 (19:49 -0500)]
libsmb2: fix potential memory leak
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Namjae Jeon [Mon, 18 Nov 2019 00:49:05 +0000 (19:49 -0500)]
libsmb2: alloc_hint with unint32 type never less than zero
unsigned type alloc_hint could not be negative.
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Namjae Jeon [Mon, 18 Nov 2019 00:49:04 +0000 (19:49 -0500)]
libsmb2: fix use-after-free of c_data->utf8_unc
freed c_data->utf8_unc by free_c_data could be used.
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Volker Lendecke [Sat, 2 Nov 2019 14:25:25 +0000 (15:25 +0100)]
Use calloc where appropriate
Saves around 250 bytes with -Oz
Ronnie Sahlberg [Mon, 28 Oct 2019 04:00:56 +0000 (14:00 +1000)]
negotiate protocol: some servers do not return a blob in neg prot responses
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Sun, 27 Oct 2019 17:56:14 +0000 (03:56 +1000)]
Merge pull request #118 from tguillem/more-errnos
More errnos
Thomas Guillem [Thu, 24 Oct 2019 15:50:53 +0000 (17:50 +0200)]
smb2_connect_share_async: don't return ENOMEM if connect fails
Thomas Guillem [Thu, 24 Oct 2019 16:01:53 +0000 (18:01 +0200)]
smb2_connect_async: convert getaddrinfo to errno
Thomas Guillem [Thu, 24 Oct 2019 15:49:16 +0000 (17:49 +0200)]
smb2_connect_async: return errno
Ronnie Sahlberg [Mon, 21 Oct 2019 04:47:43 +0000 (14:47 +1000)]
Merge pull request #113 from ePirat/configure-cleanup
Configure cleanup
Marvin Scholz [Fri, 18 Oct 2019 19:20:54 +0000 (21:20 +0200)]
Use AS_IF instead of shell if statements
This is more consistent with the rest of the file
Marvin Scholz [Fri, 18 Oct 2019 19:08:09 +0000 (21:08 +0200)]
Use GCC variable instead of ac_cv_prog_gcc
This is documented in the AC_PROG_CC documentation and seems a bit
cleaner than to use the "internal" caching variable. And it is easier
to read.
Marvin Scholz [Fri, 18 Oct 2019 19:05:27 +0000 (21:05 +0200)]
Remove unused header checks
None of the headers checked by these checks are used in the project.
Marvin Scholz [Fri, 18 Oct 2019 01:12:45 +0000 (03:12 +0200)]
Cleanup comments
A lot of comments were duplicated as both autoconf and shell
comments, which seems unnecessary.
Additionally slight rewording of some comments.
Ronnie Sahlberg [Fri, 18 Oct 2019 05:14:47 +0000 (15:14 +1000)]
Merge pull request #112 from ePirat/ci-run-prs
Trigger CI builds for pull requests
Ronnie Sahlberg [Fri, 18 Oct 2019 05:14:15 +0000 (15:14 +1000)]
Merge pull request #111 from ePirat/add-ci-windows
Add windows build to CI
Ronnie Sahlberg [Fri, 18 Oct 2019 05:13:37 +0000 (15:13 +1000)]
Merge pull request #110 from ePirat/fix-windows-msvc
Various MSVC build fixes
Marvin Scholz [Fri, 18 Oct 2019 01:09:12 +0000 (03:09 +0200)]
Fix indentation
Marvin Scholz [Fri, 18 Oct 2019 00:56:36 +0000 (02:56 +0200)]
Add missing quotes
While these are not all needed it is much easier to be consistent and
quote, so that when editing later to not accidentally forget to quote
a value that did not need quoting before.
Marvin Scholz [Fri, 18 Oct 2019 00:50:14 +0000 (02:50 +0200)]
Do not use deprecated AC_HELP_STRING
Marvin Scholz [Fri, 18 Oct 2019 00:48:59 +0000 (02:48 +0200)]
Remove explicit PKG_PROG_PKG_CONFIG call
This will be called implicitly when needed
Marvin Scholz [Fri, 18 Oct 2019 00:46:49 +0000 (02:46 +0200)]
Set minimum supported autoconf version to 2.58
The file is already using things only available since 2.58, not 2.50
Marvin Scholz [Fri, 18 Oct 2019 00:45:53 +0000 (02:45 +0200)]
Check for AM_PROG_AR instead of defining to nothing
Marvin Scholz [Fri, 18 Oct 2019 00:45:25 +0000 (02:45 +0200)]
Set needed automake version to 1.11
This version should be old enough and gives us an opportunity to know
what is actually the lowest supported version, erroring out with a
helpful error message if someone tries to use an older version than
that, instead of obscure errors due to missing macros.
Marvin Scholz [Fri, 18 Oct 2019 00:38:21 +0000 (02:38 +0200)]
Simplify suppression of default CFLAGS
This is the way autoconf documents this should be done and much
simpler than before.
Marvin Scholz [Fri, 18 Oct 2019 00:36:38 +0000 (02:36 +0200)]
Add config.h.in~ to gitignore
Marvin Scholz [Thu, 17 Oct 2019 23:32:34 +0000 (01:32 +0200)]
Trigger CI builds for pull requests
Marvin Scholz [Thu, 17 Oct 2019 22:29:09 +0000 (00:29 +0200)]
Add windows build to CI
Marvin Scholz [Thu, 17 Oct 2019 22:38:05 +0000 (00:38 +0200)]
Various MSVC build fixes
Fix #101
Ronnie Sahlberg [Thu, 17 Oct 2019 22:00:55 +0000 (08:00 +1000)]
Merge pull request #108 from ePirat/add-ci
Add GitHub Actions CI
Ronnie Sahlberg [Thu, 17 Oct 2019 21:55:43 +0000 (07:55 +1000)]
Merge pull request #107 from ePirat/fix-distcheck
Fix autotools distcheck
ePirat [Thu, 17 Oct 2019 14:10:33 +0000 (16:10 +0200)]
Add GitHub Actions CI
Marvin Scholz [Thu, 17 Oct 2019 16:03:50 +0000 (18:03 +0200)]
Remove check for popt and fix conditional directory
Using an automake conditional here allows automake to correctly
always add examples sources to the dist tarballs, even when disabled.
Fixes `make distcheck`
Marvin Scholz [Thu, 17 Oct 2019 14:43:25 +0000 (16:43 +0200)]
Add missing headers files to Makefile.am
This fixes `make distcheck` and produces correct
tarballs with `make dist`.
Ronnie Sahlberg [Thu, 17 Oct 2019 14:16:57 +0000 (00:16 +1000)]
Merge pull request #105 from ePirat/remove-popt-dep
Remove unused popt dependency for examples
Ronnie Sahlberg [Thu, 17 Oct 2019 14:11:12 +0000 (00:11 +1000)]
Merge pull request #106 from ePirat/fix-macos-compilation
aes128ccm: Add missing portable-endian header
Ronnie Sahlberg [Thu, 17 Oct 2019 14:09:35 +0000 (00:09 +1000)]
Merge pull request #104 from ePirat/add-error-code
errors: Add SMB2_STATUS_BAD_NETWORK_PATH
Marvin Scholz [Thu, 17 Oct 2019 13:52:32 +0000 (15:52 +0200)]
errors: Add SMB2_STATUS_BAD_NETWORK_PATH
This error code is returned by macOS SMB implementation when not
specifying the share to which to connect.
Marvin Scholz [Thu, 17 Oct 2019 13:48:13 +0000 (15:48 +0200)]
aes128ccm: Add missing portable-endian header
This fixes the compilation on macOS and other platforms that
do not have htobe* functions.
Marvin Scholz [Thu, 17 Oct 2019 13:45:56 +0000 (15:45 +0200)]
Remove unused popt dependency for examples
The examples have a dependency on popt even though that library is
not used by any examples, making it unnecessary.
Ronnie Sahlberg [Thu, 17 Oct 2019 12:53:57 +0000 (22:53 +1000)]
Merge pull request #102 from tguillem/smb2-password-fix
Don't override password set via smb2_set_password()
Ronnie Sahlberg [Thu, 17 Oct 2019 11:59:04 +0000 (21:59 +1000)]
Revert "fix correct length for error PDUs"
This reverts commit
938cc11fabfb7c31e88ffcd2d04fce859664a9e1.
Some servers (win10 for anonymous/guest logins) actually violate the spec
here and does NOT provide the extra byte.
Thomas Guillem [Tue, 15 Oct 2019 08:29:28 +0000 (10:29 +0200)]
don't override password set via smb2_set_password()
Regression from
bf5c12d7072d3a81438ffee67e7308077bfa3adb
This was impossible for an user to provide a password via smb2_set_password()
since it was overridden from smb2_connect_share_async(). Indeed,
smb2_set_password_from_file() is called from smb2_set_user(), that is called
from smb2_connect_share_async().
Thomas Guillem [Tue, 15 Oct 2019 08:28:04 +0000 (10:28 +0200)]
check fopen return value
Ronnie Sahlberg [Thu, 3 Oct 2019 23:54:49 +0000 (09:24 +0930)]
krb5: ignore errors if SMB2 layer returned success
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 26 Sep 2019 08:45:58 +0000 (01:45 -0700)]
change bitfield from int:1 to uint8_t:1 to make lgtm.com happy
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 26 Sep 2019 08:44:23 +0000 (01:44 -0700)]
Add header guards to make lgtm.com happy
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 26 Sep 2019 05:38:05 +0000 (22:38 -0700)]
we don't need SHA512 either
This all now shaves off 5-6kb of text size !!!
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 26 Sep 2019 05:13:03 +0000 (22:13 -0700)]
we don't need SHA384
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 26 Sep 2019 05:07:15 +0000 (22:07 -0700)]
we dont need sha1
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 26 Sep 2019 05:00:59 +0000 (22:00 -0700)]
We don't need SHA224
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Ronnie Sahlberg [Thu, 26 Sep 2019 04:37:46 +0000 (21:37 -0700)]
aes: we do not need the CBC version of AES
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>