The branch, v3-3-test has been updated
via 2dab9ad77954dc608f8910bf4d3cb92fcaad5cb6 (commit)
via 888f922bd0d1c84a687d404e95ae314a9dd0aee1 (commit)
from 3d19112f645fb0f4bb6b644207ed2cee0b6b3ea9 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit 2dab9ad77954dc608f8910bf4d3cb92fcaad5cb6
Merge: 888f922bd0d1c84a687d404e95ae314a9dd0aee1
3d19112f645fb0f4bb6b644207ed2cee0b6b3ea9
Author: Derrell Lipman <[EMAIL PROTECTED]>
Date: Tue Jul 8 20:44:57 2008 -0400
Merge branch 'v3-3-test' of ssh://git.samba.org/data/git/samba into
v3-3-test
commit 888f922bd0d1c84a687d404e95ae314a9dd0aee1
Author: Derrell Lipman <[EMAIL PROTECTED]>
Date: Tue Jul 8 20:44:39 2008 -0400
[BUG 5580] Allow access to DFS shares via libsmbclient
Brian Sheehan provided a nice patch intended for the 3.0 code base. This
commit applies a similar patch for the 3.3 code base. It adds a new public
function to libsmbclient -- smbc_set_credentials() -- that may be called
from
the authentication callback when DFS referrals are in use.
Derrell
-----------------------------------------------------------------------
Summary of changes:
source/include/libsmbclient.h | 27 +++++++++++++++++++++++++++
source/include/proto.h | 1 +
source/lib/util.c | 5 +++++
source/libsmb/libsmb_context.c | 20 ++++++++++++++++++++
4 files changed, 53 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h
index 74d0d5c..2828e9e 100644
--- a/source/include/libsmbclient.h
+++ b/source/include/libsmbclient.h
@@ -2561,6 +2561,33 @@ smbc_version(void);
}
#endif
+/[EMAIL PROTECTED] misc
+ * Set the users credentials globally so they can be used for DFS
+ * referrals. Probably best to use this function in the smbc_get_auth_data_fn
+ * callback.
+ *
+ * @param workgroup Workgroup of the user.
+ *
+ * @param user Username of user.
+ *
+ * @param password Password of user.
+ *
+ * @param use_kerberos Whether to use Kerberos
+ *
+ * @param signing_state One of these strings (all equivalents on same line):
+ * "off", "no", "false"
+ * "on", "yes", "true", "auto"
+ * "force", "required", "forced"
+ */
+
+void
+smbc_set_credentials(char *workgroup,
+ char *user,
+ char *password,
+ bool use_kerberos,
+ char *signing_state);
+
+
/**
* @ingroup structure
* Structure that contains a client context information
diff --git a/source/include/proto.h b/source/include/proto.h
index 2a954f4..665a86d 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -1271,6 +1271,7 @@ const char *get_cmdline_auth_info_password(void);
void set_cmdline_auth_info_password(const char *password);
bool set_cmdline_auth_info_signing_state(const char *arg);
int get_cmdline_auth_info_signing_state(void);
+void set_cmdline_auth_info_use_kerberos(bool b);
bool get_cmdline_auth_info_use_kerberos(void);
void set_cmdline_auth_info_use_krb5_ticket(void);
void set_cmdline_auth_info_smb_encrypt(void);
diff --git a/source/lib/util.c b/source/lib/util.c
index 68524a2..8d744a5 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -353,6 +353,11 @@ int get_cmdline_auth_info_signing_state(void)
return cmdline_auth_info.signing_state;
}
+void set_cmdline_auth_info_use_kerberos(bool b)
+{
+ cmdline_auth_info.use_kerberos = b;
+}
+
bool get_cmdline_auth_info_use_kerberos(void)
{
return cmdline_auth_info.use_kerberos;
diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c
index dd78bce..51948d1 100644
--- a/source/libsmb/libsmb_context.c
+++ b/source/libsmb/libsmb_context.c
@@ -610,3 +610,23 @@ smbc_version(void)
}
+/*
+ * Set the credentials so DFS will work when following referrals.
+ */
+void
+smbc_set_credentials(char *workgroup,
+ char *user,
+ char *password,
+ bool use_kerberos,
+ char *signing_state)
+{
+
+ set_cmdline_auth_info_username(user);
+ set_cmdline_auth_info_password(password);
+ set_cmdline_auth_info_use_kerberos(use_kerberos);
+ if (! set_cmdline_auth_info_signing_state(signing_state)) {
+ DEBUG(0, ("Invalid signing state: %s", signing_state));
+ }
+ set_global_myworkgroup(workgroup);
+ cli_cm_set_credentials();
+}
--
Samba Shared Repository