[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-5010-g53fea3a

Derrell Lipman derrell at samba.org
Tue Feb 24 14:49:40 GMT 2009


The branch, v3-3-test has been updated
       via  53fea3a7aef481151c3a15d01481cb0f11ae2e8b (commit)
      from  1bfdbb093f7c5e434ea3e653d389e1ccec578af6 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 53fea3a7aef481151c3a15d01481cb0f11ae2e8b
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Tue Feb 24 09:49:21 2009 -0500

    Make char* parameters const
    
    - Use const in function signatures whenever appropriate, to help prevent
      errant scribbling on users' buffers. smbc_set_credentials() always acted as
      if its formal parameters were const char *, and changing the formal
      declaration to specify that should not cause any change to the ABI. It is
      still allowable to pass a writable buffer to a function which specifies that
      it will not write to the buffer.
    
    Derrell

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

Summary of changes:
 source/include/libsmbclient.h  |    8 ++++----
 source/libsmb/libsmb_context.c |   22 ++++++----------------
 2 files changed, 10 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h
index 8c642b1..869aeb6 100644
--- a/source/include/libsmbclient.h
+++ b/source/include/libsmbclient.h
@@ -2677,11 +2677,11 @@ smbc_version(void);
  */
 
 void
-smbc_set_credentials(char *workgroup,
-                     char *user,
-                     char *password,
+smbc_set_credentials(const char *workgroup,
+                     const char *user,
+                     const char *password,
                      smbc_bool use_kerberos,
-                     char *signing_state);
+                     const char *signing_state);
 
 /*
  * Wrapper around smbc_set_credentials.
diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c
index 90f18ac..ec16311 100644
--- a/source/libsmb/libsmb_context.c
+++ b/source/libsmb/libsmb_context.c
@@ -630,11 +630,11 @@ smbc_version(void)
  * Set the credentials so DFS will work when following referrals.
  */
 void
-smbc_set_credentials(char *workgroup,
-                     char *user,
-                     char *password,
+smbc_set_credentials(const char *workgroup,
+                     const char *user,
+                     const char *password,
                      smbc_bool use_kerberos,
-                     char *signing_state)
+                     const char *signing_state)
 {
         
         set_cmdline_auth_info_username(user);
@@ -675,18 +675,8 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context,
 		signing_state = "force";
 	}
 
-	/* 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,
-			     CONST_DISCARD(char *,signing_state));
+	smbc_set_credentials(workgroup, user, password,
+                             use_kerberos, signing_state);
 
 	if (smbc_getOptionFallbackAfterKerberos(context)) {
 		cli_cm_set_fallback_after_kerberos();


-- 
Samba Shared Repository


More information about the samba-cvs mailing list