libsmb2 icon indicating copy to clipboard operation
libsmb2 copied to clipboard

no error string set as part of compound pdus

Open amandeepgautam opened this issue 6 years ago • 2 comments

when we use compound pdus, for example, smb2_cmd_open_async, smb2_cmd_read_async and smb2_cmd_close_async we do not get any error string from smb2_get_error() as probably it is not set. Is there any particular reason for this behaviour?

On top of that, smb2_set_error is private so we do not have the ability to set the error from our code. In our use case is that we are using compound pdus and high-level API's provided by the library like smb2_pread_async interchangeably. So availability of the error string becomes inconsistent in the two different code path.

Any suggestions?

amandeepgautam avatar Aug 13 '19 23:08 amandeepgautam

On Wed, Aug 14, 2019 at 9:38 AM Aman Deep Gautam [email protected] wrote:

when we use compound pdus, for example, smb2_cmd_open_async, smb2_cmd_read_async and smb2_cmd_close_async we do not get any error string from smb2_get_error() as probably it is not set. Is there any particular reason for this behaviour?

smb2_get_error() should always return the error string for the most recent error that has happened. If the compound failed, or one of the component in the compound failed, and there is no error string in smb2_get_error() then that is a bug.

Most likely it is due to an error handler somewhere that forgets to set smb2_set_error().

Do you have a specific instance of a compound that contains an error and where smb2_get_error() is empty afterwards ?

On top of that, smb2_set_error is private so we do not have the ability to set the error from our code. In our use case is that we are using compound pdus and high-level API's provided by the library like smb2_pread_async interchangeably. So availability of the error string becomes inconsistent in the two different code path.

Any suggestions?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sahlberg/libsmb2/issues/98?email_source=notifications&email_token=AADY3EESFECKINKRHBMCFH3QENAW5A5CNFSM4ILPVMXKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFCSN2A, or mute the thread https://github.com/notifications/unsubscribe-auth/AADY3EBKIJDXGRMJRUEUE5DQENAW5ANCNFSM4ILPVMXA .

sahlberg avatar Aug 13 '19 23:08 sahlberg

Hi, Sorry for the delayed response. Got caught up in other work. An instance I found was the following:

Here is an example: We call smb2_cmd_create_async, smb2_cmd_read_async and smb2_cmd_close_async to read a small file. When the client requests to read a file which does not exist, we see the following:

[In smb2_cmd_create_async callback] smb2 error: [In smb2_cmd_create_async callback] CreateCb: status STATUS_OBJECT_NAME_NOT_FOUND (c0000034) [In smb2_cmd_read_async callback] smb2 error: [In smb2_cmd_read_async callback] ReadCb: status STATUS_OBJECT_NAME_NOT_FOUND (c0000034) [In smb2_cmd_close_async callback] smb2 error: [In smb2_cmd_close_async callback] CloseCb: status STATUS_INVALID_PARAMETER (c000000d)

The string printed in front of smb2_error is empty and I use smb2_get_error(smb2) to get the error string where smb2 is the smb2_context

So, basically all of them are not setting the string error message.

amandeepgautam avatar Sep 12 '19 10:09 amandeepgautam

declaring github issues bancruptcy

sahlberg avatar Mar 29 '24 08:03 sahlberg