summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-01-24 19:24:10 +0100
committerVolker Lendecke <vl@samba.org>2010-01-24 20:32:17 +0100
commit4eb1523d87e4ed1bcc5b1ec64da0b53ce2264000 (patch)
tree9a055dd6b0d22d1805aca5660332c8fee2161480 /source3
parentdc1bcec73cb3c895ebd84614cc5a14ca0eae0505 (diff)
downloadsamba-4eb1523d87e4ed1bcc5b1ec64da0b53ce2264000.tar.gz
samba-4eb1523d87e4ed1bcc5b1ec64da0b53ce2264000.tar.bz2
samba-4eb1523d87e4ed1bcc5b1ec64da0b53ce2264000.zip
s3-libsmbclient: Add smbc_setOptionUseCCache()
Can we enable this by default? This would be a change in behaviour, but this feature is just too cool for everyone to catch up in the apps. The patch would be
Diffstat (limited to 'source3')
-rw-r--r--source3/include/libsmbclient.h11
-rw-r--r--source3/libsmb/libsmb_context.c14
-rw-r--r--source3/libsmb/libsmb_server.c7
-rw-r--r--source3/libsmb/libsmb_setget.c18
4 files changed, 50 insertions, 0 deletions
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index 7de5000615..dd6f93e261 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -263,10 +263,13 @@ typedef struct _SMBCCTX SMBCCTX;
* smbc_getOptionFallbackAFterKerberos()
* smbc_setOptionNoAutoAnonymousLogin()
* smbc_getOptionNoAutoAnonymousLogin()
+ * smbc_setOptionUseCCache()
+ * smbc_getOptionUseCCache()
*/
# define SMB_CTX_FLAG_USE_KERBEROS (1 << 0)
# define SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS (1 << 1)
# define SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON (1 << 2)
+# define SMB_CTX_FLAG_USE_CCACHE (1 << 3)
@@ -732,6 +735,14 @@ smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c);
void
smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b);
+/** Get whether to enable use of the winbind ccache */
+smbc_bool
+smbc_getOptionUseCCache(SMBCCTX *c);
+
+/** Set whether to enable use of the winbind ccache */
+void
+smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b);
+
/*************************************
diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c
index 336172ce6f..2e56911f70 100644
--- a/source3/libsmb/libsmb_context.c
+++ b/source3/libsmb/libsmb_context.c
@@ -168,6 +168,7 @@ smbc_new_context(void)
smbc_setOptionFullTimeNames(context, False);
smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE);
smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_NONE);
+ smbc_setOptionUseCCache(context, True);
smbc_setOptionCaseSensitive(context, False);
smbc_setOptionBrowseMaxLmbCount(context, 3); /* # LMBs to query */
smbc_setOptionUrlEncodeReaddirEntries(context, False);
@@ -399,6 +400,10 @@ smbc_option_set(SMBCCTX *context,
option_value.b = (bool) va_arg(ap, int);
smbc_setOptionFallbackAfterKerberos(context, option_value.b);
+ } else if (strcmp(option_name, "use_ccache") == 0) {
+ option_value.b = (bool) va_arg(ap, int);
+ smbc_setOptionUseCCache(context, option_value.b);
+
} else if (strcmp(option_name, "no_auto_anonymous_login") == 0) {
option_value.b = (bool) va_arg(ap, int);
smbc_setOptionNoAutoAnonymousLogin(context, option_value.b);
@@ -505,6 +510,13 @@ smbc_option_get(SMBCCTX *context,
return (void *) (bool) smbc_getOptionFallbackAfterKerberos(context);
#endif
+ } else if (strcmp(option_name, "use_ccache") == 0) {
+#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
+ return (void *) (intptr_t) smbc_getOptionUseCCache(context);
+#else
+ return (void *) (bool) smbc_getOptionUseCCache(context);
+#endif
+
} else if (strcmp(option_name, "no_auto_anonymous_login") == 0) {
#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
return (void *) (intptr_t) smbc_getOptionNoAutoAnonymousLogin(context);
@@ -748,6 +760,8 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context,
set_cmdline_auth_info_signing_state(auth_info, signing_state);
set_cmdline_auth_info_fallback_after_kerberos(auth_info,
smbc_getOptionFallbackAfterKerberos(context));
+ set_cmdline_auth_info_use_ccache(
+ auth_info, smbc_getOptionUseCCache(context));
set_global_myworkgroup(workgroup);
TALLOC_FREE(context->internal->auth_info);
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 71cb67c61b..eb292da2ce 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -413,6 +413,10 @@ again:
c->fallback_after_kerberos = True;
}
+ if (smbc_getOptionUseCCache(context)) {
+ c->use_ccache = True;
+ }
+
c->timeout = smbc_getTimeout(context);
/*
@@ -759,6 +763,9 @@ SMBC_attr_server(TALLOC_CTX *ctx,
if (smbc_getOptionUseKerberos(context)) {
flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
}
+ if (smbc_getOptionUseCCache(context)) {
+ flags |= CLI_FULL_CONNECTION_USE_CCACHE;
+ }
zero_sockaddr(&ss);
nt_status = cli_full_connection(&ipc_cli,
diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c
index 791b4cd9e4..20835781ec 100644
--- a/source3/libsmb/libsmb_setget.c
+++ b/source3/libsmb/libsmb_setget.c
@@ -420,6 +420,24 @@ smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b)
}
}
+/** Get whether to enable use of kerberos */
+smbc_bool
+smbc_getOptionUseCCache(SMBCCTX *c)
+{
+ return c->flags & SMB_CTX_FLAG_USE_CCACHE ? True : False;
+}
+
+/** Set whether to enable use of kerberos */
+void
+smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b)
+{
+ if (b) {
+ c->flags |= SMB_CTX_FLAG_USE_CCACHE;
+ } else {
+ c->flags &= ~SMB_CTX_FLAG_USE_CCACHE;
+ }
+}
+
/** Get the function for obtaining authentication data */
smbc_get_auth_data_fn
smbc_getFunctionAuthData(SMBCCTX *c)