Change smbc_set_credentials_with_fallback() (unreleased) to use
authorJeremy Allison <jra@samba.org>
Sat, 21 Feb 2009 00:40:00 +0000 (16:40 -0800)
committerJeremy Allison <jra@samba.org>
Sat, 21 Feb 2009 00:40:00 +0000 (16:40 -0800)
const approptiately.
Jeremy.

source/include/libsmbclient.h
source/libsmb/libsmb_context.c

index efc471c85b4c34b27cbf8fc0f02c2c09cf722bf3..8c642b1794cd6354a86016c8be1300253c2c9bfa 100644 (file)
@@ -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
index 489cc01c864338ffe0316a4a7b6b02879d4db7e1..90f18ac537090031ef982ca55be911752da08a88 100644 (file)
@@ -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();