The branch, master has been updated
       via  1c71485 Clean up some const and other compiler warnings.
      from  ff215f5 I added them, so I get to kill them :-). Finally remove all 
uses of safe_strcpy and safe_strcat. Change to strlcpy, strlcat.

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


- Log -----------------------------------------------------------------
commit 1c714850d5068864b1f04a4211223dec11a30d67
Author: Jeremy Allison <[email protected]>
Date:   Wed May 4 14:57:37 2011 -0700

    Clean up some const and other compiler warnings.
    
    Autobuild-User: Jeremy Allison <[email protected]>
    Autobuild-Date: Thu May  5 00:59:40 CEST 2011 on sn-devel-104

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

Summary of changes:
 lib/nss_wrapper/nss_wrapper.c    |    2 ++
 lib/util/charset/util_str.c      |    8 ++++----
 lib/util/charset/util_unistr_w.c |    4 ++--
 lib/util/util_net.c              |    2 +-
 nsswitch/libwbclient/wbc_util.c  |   16 ++++++++--------
 source4/torture/basic/attr.c     |    2 +-
 source4/torture/raw/acls.c       |   14 +++++++++++---
 source4/torture/raw/open.c       |    2 +-
 source4/torture/raw/qfileinfo.c  |    2 +-
 source4/torture/raw/streams.c    |    8 ++++++--
 source4/torture/smb2/acls.c      |    7 +++++--
 11 files changed, 42 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c
index cfa5a68..8767fbf 100644
--- a/lib/nss_wrapper/nss_wrapper.c
+++ b/lib/nss_wrapper/nss_wrapper.c
@@ -36,7 +36,9 @@
 
 /* defining this gives us the posix getpwnam_r() calls on solaris
    Thanks to heimdal for this */
+#ifndef _POSIX_PTHREAD_SEMANTICS
 #define _POSIX_PTHREAD_SEMANTICS
+#endif
 
 #define NSS_WRAPPER_NOT_REPLACE
 #include "../replace/replace.h"
diff --git a/lib/util/charset/util_str.c b/lib/util/charset/util_str.c
index 71a3778..4f4ca93 100644
--- a/lib/util/charset/util_str.c
+++ b/lib/util/charset/util_str.c
@@ -329,7 +329,7 @@ _PUBLIC_ char *strchr_m(const char *src, char c)
 
        for (s = src; *s && !(((unsigned char)s[0]) & 0x80); s++) {
                if (*s == c)
-                       return (char *)s;
+                       return discard_const_p(char, s);
        }
 
        if (!*s)
@@ -397,7 +397,7 @@ _PUBLIC_ char *strrchr_m(const char *s, char c)
                                        break;
                                }
                                /* No - we have a match ! */
-                               return (char *)cp;
+                               return discard_const_p(char , cp);
                        }
                } while (cp-- != s);
                if (!got_mb)
@@ -492,7 +492,7 @@ char *strstr_m(const char *src, const char *findstr)
 
        /* for correctness */
        if (!findstr[0]) {
-               return (char*)src;
+               return discard_const_p(char, src);
        }
 
        /* Samba does single character findstr calls a *lot*. */
@@ -509,7 +509,7 @@ char *strstr_m(const char *src, const char *findstr)
                                findstr_len = strlen(findstr);
 
                        if (strncmp(s, findstr, findstr_len) == 0) {
-                               return (char *)s;
+                               return discard_const_p(char, s);
                        }
                }
        }
diff --git a/lib/util/charset/util_unistr_w.c b/lib/util/charset/util_unistr_w.c
index a550e52..22f22ab 100644
--- a/lib/util/charset/util_unistr_w.c
+++ b/lib/util/charset/util_unistr_w.c
@@ -22,8 +22,8 @@
 #include "includes.h"
 
 /* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied 
smb_ucs2_t */
-#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned 
char *)(src))[0],\
-                               ((unsigned char *)(dest))[1] = ((unsigned char 
*)(src))[1], (dest))
+#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((const 
unsigned char *)(src))[0],\
+                               ((unsigned char *)(dest))[1] = ((const unsigned 
char *)(src))[1], (dest))
 
 
 /* return an ascii version of a ucs2 character */
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index a8a05da..7d678c9 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -591,7 +591,7 @@ char *print_sockaddr(char *dest,
                        size_t destlen,
                        const struct sockaddr_storage *psa)
 {
-       return print_sockaddr_len(dest, destlen, (struct sockaddr *)psa,
+       return print_sockaddr_len(dest, destlen, (const struct sockaddr *)psa,
                        sizeof(struct sockaddr_storage));
 }
 
diff --git a/nsswitch/libwbclient/wbc_util.c b/nsswitch/libwbclient/wbc_util.c
index d783ba3..af134ba 100644
--- a/nsswitch/libwbclient/wbc_util.c
+++ b/nsswitch/libwbclient/wbc_util.c
@@ -623,13 +623,13 @@ static void wbcDomainControllerInfoExDestructor(void *ptr)
 {
        struct wbcDomainControllerInfoEx *i =
                (struct wbcDomainControllerInfoEx *)ptr;
-       free((char *)(i->dc_unc));
-       free((char *)(i->dc_address));
-       free((char *)(i->domain_guid));
-       free((char *)(i->domain_name));
-       free((char *)(i->forest_name));
-       free((char *)(i->dc_site_name));
-       free((char *)(i->client_site_name));
+       free(discard_const_p(char, i->dc_unc));
+       free(discard_const_p(char, i->dc_address));
+       free(discard_const_p(char, i->domain_guid));
+       free(discard_const_p(char, i->domain_name));
+       free(discard_const_p(char, i->forest_name));
+       free(discard_const_p(char, i->dc_site_name));
+       free(discard_const_p(char, i->client_site_name));
 }
 
 static wbcErr wbc_create_domain_controller_info_ex(const struct 
winbindd_response *resp,
@@ -758,7 +758,7 @@ static void wbcNamedBlobDestructor(void *ptr)
        struct wbcNamedBlob *b = (struct wbcNamedBlob *)ptr;
 
        while (b->name != NULL) {
-               free((char *)(b->name));
+               free(discard_const_p(char, b->name));
                free(b->blob.data);
                b += 1;
        }
diff --git a/source4/torture/basic/attr.c b/source4/torture/basic/attr.c
index 09d1ae2..9655f7a 100644
--- a/source4/torture/basic/attr.c
+++ b/source4/torture/basic/attr.c
@@ -374,7 +374,7 @@ error_exit_file:
                                [0x%x], got attr 0x%x, should be 0x%x\n",
                                open_attrs_table[j],
                                (uint16_t)attr,
-                               open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY);
+                               
(int)open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY);
                        CHECK_MAX_FAILURES(error_exit_dir);
                }
 
diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c
index 666d164..53de4e3 100644
--- a/source4/torture/raw/acls.c
+++ b/source4/torture/raw/acls.c
@@ -1846,6 +1846,7 @@ done:
        return ret;
 }
 
+#if 0
 static bool test_inheritance_flags(struct torture_context *tctx,
     struct smbcli_state *cli)
 {
@@ -2073,6 +2074,7 @@ done:
        smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
+#endif
 
 /*
   test dynamic acl inheritance
@@ -2244,6 +2246,8 @@ done:
        CHECK_STATUS_FOR_BIT_ACTION(status, bits, do {} while (0)); \
 } while (0)
 
+#if 0
+
 /* test what access mask is needed for getting and setting security_descriptors
   Test copied to smb2/acls.c for SMB2. */
 static bool test_sd_get_set(struct torture_context *tctx, 
@@ -2433,6 +2437,7 @@ done:
        return ret;
 }
 
+#endif
 
 /* 
    basic testing of security descriptor calls
@@ -2450,11 +2455,14 @@ struct torture_suite *torture_raw_acls(TALLOC_CTX 
*mem_ctx)
        torture_suite_add_1smb_test(suite, "owner", test_owner_bits);
        torture_suite_add_1smb_test(suite, "inheritance", test_inheritance);
 
-       /* torture_suite_add_1smb_test(suite, "INHERITFLAGS", 
test_inheritance_flags); */
+#if 0
+       torture_suite_add_1smb_test(suite, "INHERITFLAGS", 
test_inheritance_flags);
+#endif
        torture_suite_add_1smb_test(suite, "dynamic", test_inheritance_dynamic);
-       /* XXX This test does not work against XP or Vista.
+#if 0
+       /* XXX This test does not work against XP or Vista. */
        torture_suite_add_1smb_test(suite, "GETSET", test_sd_get_set);
-       */
+#endif
 
        return suite;
 }
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 89042d7..beb6290 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -152,7 +152,7 @@ static const char *rdwr_string(enum rdwr_mode m)
        status = smb_raw_setpathinfo(cli->tree, &sfinfo); \
        if (!NT_STATUS_IS_OK(status)) { \
                torture_warning(tctx, "(%s) Failed to set attrib 0x%x on %s\n", 
\
-                      __location__, sattrib, fname); \
+                      __location__, (int)sattrib, fname); \
        }} while (0)
 
 /*
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 4140840..ca5f667 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -779,7 +779,7 @@ static bool torture_raw_qfileinfo_internals(struct 
torture_context *torture,
        s1 = fnum_find("BASIC_INFO");
        if (s1 && is_ipc) {
                if (s1->basic_info.out.attrib != FILE_ATTRIBUTE_NORMAL) {
-                       printf("(%d) attrib basic_info/nlink incorrect - %d 
should be %d\n", __LINE__, s1->basic_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
+                       printf("(%d) attrib basic_info/nlink incorrect - %d 
should be %d\n", __LINE__, s1->basic_info.out.attrib, 
(int)FILE_ATTRIBUTE_NORMAL);
                        ret = false;
                }
        }
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index 5ce9b75..ae3bc2a 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -1629,6 +1629,7 @@ static bool test_stream_create_disposition(struct 
torture_context *tctx,
        return ret;
 }
 
+#if 0
 /* Test streaminfo with enough streams on a file to fill up the buffer.  */
 static bool test_stream_large_streaminfo(struct torture_context *tctx,
                                         struct smbcli_state *cli)
@@ -1674,6 +1675,7 @@ static bool test_stream_large_streaminfo(struct 
torture_context *tctx,
        smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
+#endif
 
 /* Test the effect of setting attributes on a stream. */
 static bool test_stream_attributes(struct torture_context *tctx,
@@ -1913,8 +1915,10 @@ struct torture_suite *torture_raw_streams(TALLOC_CTX 
*tctx)
        torture_suite_add_1smb_test(suite, "attr", test_stream_attributes);
        torture_suite_add_1smb_test(suite, "sumtab", test_stream_summary_tab);
 
-       /* torture_suite_add_1smb_test(suite, "LARGESTREAMINFO", */
-       /*     test_stream_large_streaminfo); */
+#if 0
+       torture_suite_add_1smb_test(suite, "LARGESTREAMINFO",
+               test_stream_large_streaminfo);
+#endif
 
        return suite;
 }
diff --git a/source4/torture/smb2/acls.c b/source4/torture/smb2/acls.c
index 3883ae5..fa6c002 100644
--- a/source4/torture/smb2/acls.c
+++ b/source4/torture/smb2/acls.c
@@ -1662,6 +1662,7 @@ done:
        CHECK_STATUS_FOR_BIT_ACTION(status, bits, do {} while (0)); \
 } while (0)
 
+#if 0
 /* test what access mask is needed for getting and setting 
security_descriptors */
 /* Note: This test was copied from raw/acls.c. */
 static bool test_sd_get_set(struct torture_context *tctx, struct smb2_tree 
*tree)
@@ -1849,6 +1850,7 @@ done:
 
        return ret;
 }
+#endif
 
 /*
    basic testing of SMB2 ACLs
@@ -1863,9 +1865,10 @@ struct torture_suite *torture_smb2_acls_init(void)
        torture_suite_add_1smb2_test(suite, "INHERITANCE", test_inheritance);
        torture_suite_add_1smb2_test(suite, "INHERITFLAGS", 
test_inheritance_flags);
        torture_suite_add_1smb2_test(suite, "DYNAMIC", 
test_inheritance_dynamic);
-       /* XXX This test does not work against XP or Vista.
+#if 0
+       /* XXX This test does not work against XP or Vista. */
        torture_suite_add_1smb2_test(suite, "GETSET", test_sd_get_set);
-       */
+#endif
 
        suite->description = talloc_strdup(suite, "SMB2-ACLS tests");
 


-- 
Samba Shared Repository

Reply via email to