summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-02-20 16:40:00 -0800
committerKarolin Seeger <kseeger@samba.org>2009-02-23 09:31:06 +0100
commit45bcc61a38e3dbf75df6decaff9f1cac495420fc (patch)
treeb6755e57a73286fa1d34be19e6cf1b280354177e
parentefda729240e998155e1ba226f14cb61ff80dcd9d (diff)
downloadsamba-45bcc61a38e3dbf75df6decaff9f1cac495420fc.tar.gz
Change smbc_set_credentials_with_fallback() (unreleased) to use
const approptiately. Jeremy. (cherry picked from commit 07c7085f25718915cda07e38a87a008a72abbf4f)
-rw-r--r--source/include/libsmbclient.h6
-rw-r--r--source/libsmb/libsmb_context.c21
2 files changed, 17 insertions, 10 deletions
diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h
index efc471c85b4..8c642b1794c 100644
--- a/source/include/libsmbclient.h
+++ b/source/include/libsmbclient.h
@@ -2692,9 +2692,9 @@ smbc_set_credentials(char *workgroup,
void
smbc_set_credentials_with_fallback(SMBCCTX *ctx,
- char *workgroup,
- char *user,
- char *password);
+ const char *workgroup,
+ const char *user,
+ const char *password);
/**
* @ingroup structure
diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c
index 489cc01c864..90f18ac5370 100644
--- a/source/libsmb/libsmb_context.c
+++ b/source/libsmb/libsmb_context.c
@@ -648,9 +648,9 @@ smbc_set_credentials(char *workgroup,
}
void smbc_set_credentials_with_fallback(SMBCCTX *context,
- char *workgroup,
- char *user,
- char *password)
+ const char *workgroup,
+ const char *user,
+ const char *password)
{
smbc_bool use_kerberos = false;
const char *signing_state = "off";
@@ -675,11 +675,18 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context,
signing_state = "force";
}
- smbc_set_credentials(workgroup,
- user,
- password,
+ /* Using CONST_DISCARD here is ugly, but
+ * we know that smbc_set_credentials() doesn't
+ * actually modify the strings, and should have
+ * been const from the start. We're constrained
+ * by the ABI here.
+ */
+
+ smbc_set_credentials(CONST_DISCARD(char *,workgroup),
+ CONST_DISCARD(char *,user),
+ CONST_DISCARD(char *,password),
use_kerberos,
- (char *)signing_state);
+ CONST_DISCARD(char *,signing_state));
if (smbc_getOptionFallbackAfterKerberos(context)) {
cli_cm_set_fallback_after_kerberos();