Add support for new libsmbclient interface.

This commit is contained in:
Andreas Schneider 2008-04-29 09:54:29 +02:00
parent 0377c034f6
commit fb55788e2e

View file

@ -40,6 +40,26 @@
SMBCCTX *smb_context; 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 * Authentication callback for libsmbclient
*/ */
@ -56,6 +76,7 @@ static void get_auth_data_fn(const char *pServer,
maxLenPassword)); maxLenPassword));
return; return;
} }
#endif
typedef struct smb_fhandle_s { typedef struct smb_fhandle_s {
int fd; 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 */ /* 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->debug = 0;
smb_context->callbacks.auth_fn = get_auth_data_fn; smb_context->callbacks.auth_fn = get_auth_data_fn;
#endif
if (smbc_init_context(smb_context) == NULL) { if (smbc_init_context(smb_context) == NULL) {
fprintf(stderr, "CSYNC_SMB: Failed to initialize the smbc context"); 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) #if defined(SMB_CTX_FLAG_USE_KERBEROS) && defined(SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS)
smb_context->flags |= (SMB_CTX_FLAG_USE_KERBEROS | 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 #endif
smbc_set_context(smb_context); smbc_set_context(smb_context);