[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-1039-g87a4c09

Jeremy Allison jra at samba.org
Sat Feb 21 00:42:34 GMT 2009


The branch, master has been updated
       via  87a4c09b9bd37a967abcf874888a5d5161e7434f (commit)
      from  d9a842b26f306a6328e0fb4f226ed8292a8c221a (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 87a4c09b9bd37a967abcf874888a5d5161e7434f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Feb 20 16:41:41 2009 -0800

    Change smbc_set_credentials_with_fallback() (unreleased) to use
    const approptiately.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source3/include/libsmbclient.h  |    6 +++---
 source3/libsmb/libsmb_context.c |   21 ++++++++++++++-------
 2 files changed, 17 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index efc471c..8c642b1 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/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/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c
index e4df7fc..c7c9903 100644
--- a/source3/libsmb/libsmb_context.c
+++ b/source3/libsmb/libsmb_context.c
@@ -654,9 +654,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";
@@ -681,11 +681,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();


-- 
Samba Shared Repository


More information about the samba-cvs mailing list