Skip to content

Commit

Permalink
mkdir and rmdir. also only inject login when needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
tschak909 committed Apr 21, 2021
1 parent be0c875 commit c93066c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
Binary file modified data/autorun.atr
Binary file not shown.
6 changes: 3 additions & 3 deletions include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define FN_VERSION_MAJOR 0
#define FN_VERSION_MINOR 5

#define FN_VERSION_BUILD "31f01cdd"
#define FN_VERSION_BUILD "be0c875e"

#define FN_VERSION_DATE "2021-04-19 04:19:41"
#define FN_VERSION_DATE "2021-04-21 04:21:51"

#define FN_VERSION_FULL "0.5.31f01cdd"
#define FN_VERSION_FULL "0.5.be0c875e"
26 changes: 23 additions & 3 deletions lib/network-protocol/SMB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool NetworkProtocolSMB::mount(EdUrlParser *url)

smb2_set_security_mode(smb, SMB2_NEGOTIATE_SIGNING_ENABLED);

if (!login->empty())
if (login != nullptr)
{
smb2_set_user(smb, login->c_str());
smb2_set_password(smb, password->c_str());
Expand Down Expand Up @@ -247,22 +247,42 @@ bool NetworkProtocolSMB::del(EdUrlParser *url, cmdFrame_t *cmdFrame)

bool NetworkProtocolSMB::mkdir(EdUrlParser *url, cmdFrame_t *cmdFrame)
{
mount(url);

if (smb2_mkdir(smb, smb_url->path) != 0)
{
fserror_to_error();
Debug_printf("NetworkProtocolSMB::mkdir(%s) SMB error: %s\n",url->mRawUrl.c_str(), smb2_get_error(smb));
}

umount();

return false;
}

bool NetworkProtocolSMB::rmdir(EdUrlParser *url, cmdFrame_t *cmdFrame)
{
mount(url);

if (smb2_rmdir(smb, smb_url->path) != 0)
{
fserror_to_error();
Debug_printf("NetworkProtocolSMB::rmdir(%s) SMB error: %s\n",url->mRawUrl.c_str(), smb2_get_error(smb));
}

umount();

return false;
}

bool NetworkProtocolSMB::stat()
{
struct smb2_stat_64 st;

smb2_stat(smb, smb_url->path, &st);
int ret = smb2_stat(smb, smb_url->path, &st);

fileSize = st.smb2_size;
return false;
return ret != 0;
}

bool NetworkProtocolSMB::lock(EdUrlParser *url, cmdFrame_t *cmdFrame)
Expand Down

0 comments on commit c93066c

Please sign in to comment.