Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
7d97d0ae
Commit
7d97d0ae
authored
Jul 20, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/smbclient/Init: move code to SmbclientContext::New()
We no longer need to call smbc_init() because we don't need the compat layer anymore.
parent
f6dc9bca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
25 deletions
+21
-25
Context.cxx
src/lib/smbclient/Context.cxx
+19
-0
Init.cxx
src/lib/smbclient/Init.cxx
+2
-25
No files found.
src/lib/smbclient/Context.cxx
View file @
7d97d0ae
...
...
@@ -22,6 +22,21 @@
#include <cerrno>
#include <string.h>
static
void
mpd_smbc_get_auth_data
([[
maybe_unused
]]
const
char
*
srv
,
[[
maybe_unused
]]
const
char
*
shr
,
char
*
wg
,
[[
maybe_unused
]]
int
wglen
,
char
*
un
,
[[
maybe_unused
]]
int
unlen
,
char
*
pw
,
[[
maybe_unused
]]
int
pwlen
)
{
// TODO: implement
strcpy
(
wg
,
"WORKGROUP"
);
strcpy
(
un
,
""
);
strcpy
(
pw
,
""
);
}
SmbclientContext
SmbclientContext
::
New
()
{
...
...
@@ -29,6 +44,10 @@ SmbclientContext::New()
if
(
ctx
==
nullptr
)
throw
MakeErrno
(
"smbc_new_context() failed"
);
constexpr
int
debug
=
0
;
smbc_setDebug
(
ctx
,
debug
);
smbc_setFunctionAuthData
(
ctx
,
mpd_smbc_get_auth_data
);
SMBCCTX
*
ctx2
=
smbc_init_context
(
ctx
);
if
(
ctx2
==
nullptr
)
{
int
e
=
errno
;
...
...
src/lib/smbclient/Init.cxx
View file @
7d97d0ae
...
...
@@ -18,33 +18,10 @@
*/
#include "Init.hxx"
#include "Mutex.hxx"
#include "thread/Mutex.hxx"
#include "system/Error.hxx"
#include <libsmbclient.h>
#include <string.h>
static
void
mpd_smbc_get_auth_data
([[
maybe_unused
]]
const
char
*
srv
,
[[
maybe_unused
]]
const
char
*
shr
,
char
*
wg
,
[[
maybe_unused
]]
int
wglen
,
char
*
un
,
[[
maybe_unused
]]
int
unlen
,
char
*
pw
,
[[
maybe_unused
]]
int
pwlen
)
{
// TODO: implement
strcpy
(
wg
,
"WORKGROUP"
);
strcpy
(
un
,
""
);
strcpy
(
pw
,
""
);
}
void
SmbclientInit
()
{
const
std
::
lock_guard
<
Mutex
>
protect
(
smbclient_mutex
);
constexpr
int
debug
=
0
;
if
(
smbc_init
(
mpd_smbc_get_auth_data
,
debug
)
<
0
)
throw
MakeErrno
(
"smbc_init() failed"
);
/* this is currently a no-op, but one day, we might want to
call smbc_thread_posix() here */
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment