mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2025-04-13 04:15:43 +02:00
Fix kerberos support.
libsmbclient calls always the authentication function. So what we have to do is to try to authenticat with the current credentials.
This commit is contained in:
parent
8f52348315
commit
cdda179203
@ -36,6 +36,7 @@
|
||||
|
||||
SMBCCTX *smb_context = NULL;
|
||||
csync_module_auth_callback auth_cb = NULL;
|
||||
int try_krb5 = 1;
|
||||
|
||||
#ifdef DEPRECATED_SMBC_INTERFACE
|
||||
|
||||
@ -56,6 +57,12 @@ static void get_auth_data_with_context_fn(SMBCCTX *c,
|
||||
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",
|
||||
un, wg, srv, shr));
|
||||
|
||||
if (try_krb5 && getenv("KRB5CCNAME")) {
|
||||
try_krb5 = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't authenticate for workgroup listing */
|
||||
if (srv == NULL || srv[0] == '\0') {
|
||||
DEBUG_SMB(("csync_smb - emtpy server name"));
|
||||
@ -70,6 +77,8 @@ static void get_auth_data_with_context_fn(SMBCCTX *c,
|
||||
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",
|
||||
un, wg, srv, shr));
|
||||
|
||||
try_krb5 = 1;
|
||||
|
||||
return;
|
||||
}
|
||||
#else
|
||||
@ -89,9 +98,16 @@ static void get_auth_data_fn(const char *pServer,
|
||||
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",
|
||||
pUsername, pWorkgroup, pServer, pShare));
|
||||
|
||||
if (try_krb5 && getenv("KRB5CCNAME")) {
|
||||
DEBUG_SMB(("csync_smb - trying kerberos authentication\n"));
|
||||
try_krb5 = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't authenticate for workgroup listing */
|
||||
if (pServer == NULL || pServer[0] == '\0') {
|
||||
DEBUG_SMB(("csync_smb - emtpy server name"));
|
||||
DEBUG_SMB(("csync_smb - emtpy server name\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -103,6 +119,8 @@ static void get_auth_data_fn(const char *pServer,
|
||||
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",
|
||||
pUsername, pWorkgroup, pServer, pShare));
|
||||
|
||||
try_krb5 = 1;
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user