mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
Restructure code and add some comments.
This commit is contained in:
parent
b73684cc80
commit
5496d868ca
1 changed files with 21 additions and 14 deletions
|
@ -37,6 +37,7 @@
|
||||||
SMBCCTX *smb_context = NULL;
|
SMBCCTX *smb_context = NULL;
|
||||||
csync_module_auth_callback auth_cb = NULL;
|
csync_module_auth_callback auth_cb = NULL;
|
||||||
|
|
||||||
|
/* Do we build against Samba 3.2 */
|
||||||
#ifdef DEPRECATED_SMBC_INTERFACE
|
#ifdef DEPRECATED_SMBC_INTERFACE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -59,18 +60,20 @@ static void get_auth_data_with_context_fn(SMBCCTX *c,
|
||||||
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",
|
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",
|
||||||
un, wg, srv, shr));
|
un, wg, srv, shr));
|
||||||
|
|
||||||
if (try_krb5 && getenv("KRB5CCNAME")) {
|
|
||||||
try_krb5 = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't authenticate for workgroup listing */
|
/* Don't authenticate for workgroup listing */
|
||||||
if (srv == NULL || srv[0] == '\0') {
|
if (srv == NULL || srv[0] == '\0') {
|
||||||
DEBUG_SMB(("csync_smb - emtpy server name"));
|
DEBUG_SMB(("csync_smb - emtpy server name"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Try kerberos authentication if available */
|
||||||
|
if (try_krb5 && getenv("KRB5CCNAME")) {
|
||||||
|
try_krb5 = 0;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call the passwort prompt */
|
||||||
if (auth_cb != NULL) {
|
if (auth_cb != NULL) {
|
||||||
DEBUG_SMB(("csync_smb - execute authentication callback\n"));
|
DEBUG_SMB(("csync_smb - execute authentication callback\n"));
|
||||||
(*auth_cb) (un, unlen, pw, pwlen);
|
(*auth_cb) (un, unlen, pw, pwlen);
|
||||||
|
@ -83,7 +86,8 @@ static void get_auth_data_with_context_fn(SMBCCTX *c,
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
#else /* DEPRECATED_SMBC_INTERFACE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Authentication callback for libsmbclient
|
* Authentication callback for libsmbclient
|
||||||
|
@ -103,6 +107,13 @@ static void get_auth_data_fn(const char *pServer,
|
||||||
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",
|
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",
|
||||||
pUsername, pWorkgroup, pServer, pShare));
|
pUsername, pWorkgroup, pServer, pShare));
|
||||||
|
|
||||||
|
/* Don't authenticate for workgroup listing */
|
||||||
|
if (pServer == NULL || pServer[0] == '\0') {
|
||||||
|
DEBUG_SMB(("csync_smb - emtpy server name\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try kerberos authentication if available */
|
||||||
if (try_krb5 && getenv("KRB5CCNAME")) {
|
if (try_krb5 && getenv("KRB5CCNAME")) {
|
||||||
DEBUG_SMB(("csync_smb - trying kerberos authentication\n"));
|
DEBUG_SMB(("csync_smb - trying kerberos authentication\n"));
|
||||||
try_krb5 = 0;
|
try_krb5 = 0;
|
||||||
|
@ -110,12 +121,7 @@ static void get_auth_data_fn(const char *pServer,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't authenticate for workgroup listing */
|
/* Call the passwort prompt */
|
||||||
if (pServer == NULL || pServer[0] == '\0') {
|
|
||||||
DEBUG_SMB(("csync_smb - emtpy server name\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (auth_cb != NULL) {
|
if (auth_cb != NULL) {
|
||||||
DEBUG_SMB(("csync_smb - execute authentication callback\n"));
|
DEBUG_SMB(("csync_smb - execute authentication callback\n"));
|
||||||
(*auth_cb) (pUsername, maxLenUsername, pPassword, maxLenPassword);
|
(*auth_cb) (pUsername, maxLenUsername, pPassword, maxLenPassword);
|
||||||
|
@ -128,7 +134,8 @@ static void get_auth_data_fn(const char *pServer,
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif /* DEPRECATED_SMBC_INTERFACE */
|
||||||
|
|
||||||
typedef struct smb_fhandle_s {
|
typedef struct smb_fhandle_s {
|
||||||
int fd;
|
int fd;
|
||||||
|
|
Loading…
Reference in a new issue