mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 22:46:04 +03:00
Add support for new libsmbclient interface.
This commit is contained in:
parent
0377c034f6
commit
fb55788e2e
1 changed files with 32 additions and 1 deletions
|
@ -40,6 +40,26 @@
|
|||
|
||||
SMBCCTX *smb_context;
|
||||
|
||||
#ifdef DEPRECATED_SMBC_INTERFACE
|
||||
|
||||
/*
|
||||
* Authentication callback for libsmbclient
|
||||
*/
|
||||
static void get_auth_data_with_context_fn(SMBCCTX *c,
|
||||
const char *srv,
|
||||
const char *shr,
|
||||
char *wg, int wglen,
|
||||
char *un, int unlen,
|
||||
char *pw, int pwlen) {
|
||||
/* FIXME: need to handle non kerberos authentication for libsmbclient
|
||||
* here, currently it is only a placeholder so that libsmbclient can be
|
||||
* initialized */
|
||||
DEBUG_SMB(("FIXME: %p, %s, %s, %s, %d, %s, %d, %s, %d\n", c, srv, shr, wg,
|
||||
wglen, un, unlen, pw ? "******" : "null", pwlen));
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
||||
/*
|
||||
* Authentication callback for libsmbclient
|
||||
*/
|
||||
|
@ -56,6 +76,7 @@ static void get_auth_data_fn(const char *pServer,
|
|||
maxLenPassword));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct smb_fhandle_s {
|
||||
int fd;
|
||||
|
@ -409,8 +430,13 @@ csync_vio_method_t *vio_module_init(const char *method_name, const char *args) {
|
|||
}
|
||||
|
||||
/* set debug level and authentication function callback */
|
||||
#ifdef DEPRECATED_SMBC_INTERFACE
|
||||
smbc_setDebug(smb_context, 0);
|
||||
smbc_setFunctionAuthDataWithContext(smb_context, get_auth_data_with_context_fn);
|
||||
#else
|
||||
smb_context->debug = 0;
|
||||
smb_context->callbacks.auth_fn = get_auth_data_fn;
|
||||
#endif
|
||||
|
||||
if (smbc_init_context(smb_context) == NULL) {
|
||||
fprintf(stderr, "CSYNC_SMB: Failed to initialize the smbc context");
|
||||
|
@ -419,7 +445,12 @@ csync_vio_method_t *vio_module_init(const char *method_name, const char *args) {
|
|||
}
|
||||
|
||||
#if defined(SMB_CTX_FLAG_USE_KERBEROS) && defined(SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS)
|
||||
#ifdef DEPRECATED_SMBC_INTERFACE
|
||||
smbc_setOptionUseKerberos(smb_context, 1);
|
||||
smbc_setOptionFallbackAfterKerberos(smb_context, 1);
|
||||
#else
|
||||
smb_context->flags |= (SMB_CTX_FLAG_USE_KERBEROS | SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
smbc_set_context(smb_context);
|
||||
|
|
Loading…
Reference in a new issue