[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri Aug 28 02:19:02 UTC 2020


The branch, master has been updated
       via  232054c09b1 lib/util: remove extra safe_string.h file
       via  c2ac923c6a5 s3: safe_string: do not include string_wrappers.h
       via  1fde7db3bc5 string_wrappers: include replace.h
       via  d485f369e92 lib/util: do not make string_wrappers.h public
       via  87bf6aa7168 s3: safe_string: remove unnecessary include
      from  afb5cee6e78 s3:smbd: Fix strict aliasing in get_socket_port()

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


- Log -----------------------------------------------------------------
commit 232054c09b1932b3940f08aa818703b51d29d968
Author: Matthew DeVore <matvore at google.com>
Date:   Fri Aug 7 13:27:39 2020 -0700

    lib/util: remove extra safe_string.h file
    
    lib/util/safe_string.h is similar to source3/include/safe_string.h, but
    the former has fewer checks. It is missing bcopy, strcasecmp, and
    strncasecmp.
    
    Add the missing elements to lib/util/safe_string.h remove the other
    safe_string.h which is in the source3-specific path. To accomodate
    existing uses of str(n?)casecmp, add #undef lines to source files where
    they are used.
    
    Signed-off-by: Matthew DeVore <matvore at google.com>
    Reviewed-by: David Mulder <dmulder at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Aug 28 02:18:40 UTC 2020 on sn-devel-184

commit c2ac923c6a5d089fe110eb3eb6cf78298b46992d
Author: Matthew DeVore <matvore at google.com>
Date:   Fri Aug 7 11:17:34 2020 -0700

    s3: safe_string: do not include string_wrappers.h
    
    Rather than have safe_string.h #include string_wrappers.h, make users of
    string_wrappers.h include it explicitly.
    
    includes.h now no longer includes string_wrappers.h transitively. Still
    allow includes.h to #include safe_string.h for now so that as many
    modules as possible get the safety checks in it.
    
    Signed-off-by: Matthew DeVore <matvore at google.com>
    Reviewed-by: David Mulder <dmulder at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1fde7db3bc51b1f9a13388315b09ab3ce7f20b80
Author: Matthew DeVore <matvore at google.com>
Date:   Fri Aug 7 11:14:57 2020 -0700

    string_wrappers: include replace.h
    
    To ensure we always get the right value for the config.h macro
    `HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS`, #include "lib/util/replace.h"
    rather than rely on it being included by the API user.
    
    Signed-off-by: Matthew DeVore <matvore at google.com>
    Reviewed-by: David Mulder <dmulder at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d485f369e92b5eb5c6482989c397a4eec29cd824
Author: Matthew DeVore <matvore at google.com>
Date:   Fri Aug 7 11:27:53 2020 -0700

    lib/util: do not make string_wrappers.h public
    
    string_wrappers.h is a collection of macros. All but one of the macros
    rely on symbols not defined in public headers, so it is not useful as a
    public header.
    
    For instance, fstring is defined in includes.h. PTR_DIFF is defined in
    lib/util/memory.h, which is not public.
    
    checked_strlcpy is actually self-contained and is usable outside of a
    Samba build, but without a Samba config.h, it is just aliased to
    strlcpy.
    
    Signed-off-by: Matthew DeVore <matvore at google.com>
    Reviewed-by: David Mulder <dmulder at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 87bf6aa7168a6e44d52d91fb804b210a5fadbce6
Author: Matthew DeVore <matvore at google.com>
Date:   Thu Aug 6 15:42:46 2020 -0700

    s3: safe_string: remove unnecessary include
    
    safe_string.h is only included by source3/include/includes.h, which
    already includes ntstatus.h, so it is not necessary to include it
    from within safe_string.h.
    
    Signed-off-by: Matthew DeVore <matvore at google.com>
    Reviewed-by: David Mulder <dmulder at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 auth/credentials/credentials_krb5.c                |  2 +
 auth/gensec/gensec_start.c                         |  2 +
 dfs_server/dfs_server_ad.c                         |  2 +
 lib/ldb/include/ldb.h                              |  1 +
 lib/util/charset/tests/charset.c                   |  3 +
 lib/util/charset/util_str.c                        |  4 ++
 lib/util/safe_string.h                             | 22 ++++++-
 lib/util/string_wrappers.h                         |  2 +
 lib/util/util_net.c                                |  2 +
 lib/util/wscript_build                             |  1 -
 libcli/http/gensec/generic.c                       |  2 +
 libcli/http/http.c                                 |  1 +
 libcli/http/http_auth.c                            |  3 +
 libcli/security/util_sid.c                         |  3 +
 libgpo/gpext/gpext.c                               |  1 +
 libgpo/gpo_filesync.c                              |  1 +
 librpc/rpc/dcerpc_util.c                           |  2 +
 librpc/rpc/dcesrv_core.c                           |  2 +
 nsswitch/wbinfo.c                                  |  1 +
 nsswitch/wins.c                                    |  1 +
 source3/auth/auth_builtin.c                        |  1 +
 source3/auth/pampass.c                             |  1 +
 source3/client/client.c                            |  1 +
 source3/include/includes.h                         |  2 +-
 source3/include/safe_string.h                      | 68 ----------------------
 source3/lib/idmap_cache.c                          |  1 +
 source3/lib/privileges.c                           |  1 +
 source3/lib/string_replace.c                       |  1 +
 source3/lib/substitute.c                           |  1 +
 source3/lib/username.c                             |  1 +
 source3/lib/util.c                                 |  1 +
 source3/lib/util_sd.c                              |  1 +
 source3/lib/util_sid.c                             |  1 +
 source3/lib/wins_srv.c                             |  1 +
 source3/libnet/libnet_dssync_passdb.c              |  1 +
 source3/librpc/crypto/gse_krb5.c                   |  1 +
 source3/libsmb/cli_smb2_fnum.c                     |  1 +
 source3/libsmb/clidgram.c                          |  1 +
 source3/libsmb/cliprint.c                          |  1 +
 source3/libsmb/clirap.c                            |  1 +
 source3/libsmb/libsmb_dir.c                        |  1 +
 source3/libsmb/libsmb_xattr.c                      |  1 +
 source3/libsmb/namequery.c                         |  1 +
 source3/libsmb/namequery_dc.c                      |  1 +
 source3/libsmb/nmblib.c                            |  1 +
 source3/modules/vfs_afsacl.c                       |  1 +
 source3/modules/vfs_default.c                      |  1 +
 source3/modules/vfs_full_audit.c                   |  1 +
 source3/modules/vfs_vxfs.c                         |  2 +
 source3/nmbd/nmbd_become_lmb.c                     |  1 +
 source3/nmbd/nmbd_browserdb.c                      |  1 +
 source3/nmbd/nmbd_browsesync.c                     |  1 +
 source3/nmbd/nmbd_elections.c                      |  1 +
 source3/nmbd/nmbd_incomingdgrams.c                 |  1 +
 source3/nmbd/nmbd_nameregister.c                   |  1 +
 source3/nmbd/nmbd_packets.c                        |  1 +
 source3/nmbd/nmbd_sendannounce.c                   |  1 +
 source3/nmbd/nmbd_serverlistdb.c                   |  1 +
 source3/nmbd/nmbd_synclists.c                      |  1 +
 source3/nmbd/nmbd_workgroupdb.c                    |  1 +
 source3/param/loadparm.c                           |  1 +
 source3/passdb/machine_account_secrets.c           |  1 +
 source3/passdb/passdb.c                            |  1 +
 source3/passdb/pdb_interface.c                     |  1 +
 source3/passdb/pdb_ldap.c                          |  1 +
 source3/passdb/pdb_smbpasswd.c                     |  1 +
 source3/passdb/pdb_tdb.c                           |  1 +
 source3/passdb/py_passdb.c                         |  1 +
 source3/printing/lpq_parse.c                       |  1 +
 source3/printing/notify.c                          |  1 +
 source3/printing/nt_printing.c                     |  1 +
 source3/printing/nt_printing_tdb.c                 |  1 +
 source3/printing/print_cups.c                      |  1 +
 source3/printing/print_iprint.c                    |  1 +
 source3/printing/printing.c                        |  1 +
 source3/printing/printing_db.c                     |  1 +
 source3/registry/reg_objects.c                     |  1 +
 source3/rpc_server/spoolss/srv_spoolss_nt.c        |  1 +
 source3/rpcclient/cmd_spoolss.c                    |  1 +
 source3/rpcclient/cmd_srvsvc.c                     |  1 +
 source3/smbd/dir.c                                 |  1 +
 source3/smbd/dosmode.c                             |  1 +
 source3/smbd/lanman.c                              |  1 +
 source3/smbd/negprot.c                             |  1 +
 source3/smbd/reply.c                               |  1 +
 source3/smbd/service.c                             |  1 +
 source3/smbd/sesssetup.c                           |  1 +
 source3/smbd/srvstr.c                              |  1 +
 source3/smbd/trans2.c                              |  1 +
 source3/torture/locktest2.c                        |  1 +
 source3/torture/mangle_test.c                      |  1 +
 source3/torture/masktest.c                         |  1 +
 source3/torture/torture.c                          |  1 +
 source3/torture/utable.c                           |  1 +
 source3/utils/conn_tdb.c                           |  1 +
 source3/utils/eventlogadm.c                        |  1 +
 source3/utils/net_ads.c                            |  1 +
 source3/utils/net_groupmap.c                       |  1 +
 source3/utils/net_rpc.c                            |  1 +
 source3/utils/net_rpc_printer.c                    |  1 +
 source3/utils/net_rpc_rights.c                     |  1 +
 source3/utils/net_rpc_service.c                    |  1 +
 source3/utils/net_sam.c                            |  1 +
 source3/utils/net_usershare.c                      |  1 +
 source3/utils/nmblookup.c                          |  1 +
 source3/utils/ntlm_auth.c                          |  1 +
 source3/utils/sharesec.c                           |  1 +
 source3/utils/smbcontrol.c                         |  1 +
 source3/utils/smbpasswd.c                          |  1 +
 source3/utils/status.c                             |  1 +
 source3/winbindd/idmap_autorid.c                   |  1 +
 source3/winbindd/idmap_autorid_tdb.c               |  1 +
 source3/winbindd/idmap_tdb.c                       |  1 +
 source3/winbindd/wb_getpwsid.c                     |  1 +
 source3/winbindd/winbindd_cache.c                  |  1 +
 source3/winbindd/winbindd_cm.c                     |  1 +
 source3/winbindd/winbindd_domain_info.c            |  1 +
 source3/winbindd/winbindd_dsgetdcname.c            |  1 +
 source3/winbindd/winbindd_dual.c                   |  1 +
 source3/winbindd/winbindd_getdcname.c              |  1 +
 source3/winbindd/winbindd_getgrnam.c               |  1 +
 source3/winbindd/winbindd_lookuprids.c             |  1 +
 source3/winbindd/winbindd_lookupsid.c              |  1 +
 source3/winbindd/winbindd_misc.c                   |  1 +
 source3/winbindd/winbindd_pam.c                    |  1 +
 source3/winbindd/winbindd_pam_auth.c               |  1 +
 source3/winbindd/winbindd_pam_auth_crap.c          |  1 +
 source3/winbindd/winbindd_pam_chauthtok.c          |  1 +
 source3/winbindd/winbindd_util.c                   |  1 +
 source3/winbindd/winbindd_wins_byip.c              |  1 +
 source4/auth/ntlm/auth_developer.c                 |  2 +
 source4/client/client.c                            |  2 +
 source4/dns_server/dlz_bind9.c                     |  2 +
 source4/dns_server/dnsserver_common.c              |  2 +
 source4/dsdb/common/util.c                         |  2 +
 source4/dsdb/common/util_trusts.c                  |  2 +
 source4/dsdb/repl/drepl_partitions.c               |  2 +
 source4/dsdb/samdb/cracknames.c                    |  2 +
 source4/dsdb/samdb/ldb_modules/acl.c               |  3 +
 source4/dsdb/samdb/ldb_modules/count_attrs.c       |  2 +
 source4/dsdb/samdb/ldb_modules/encrypted_secrets.c |  1 +
 source4/dsdb/samdb/ldb_modules/extended_dn_in.c    |  2 +
 source4/dsdb/samdb/ldb_modules/extended_dn_out.c   |  3 +
 source4/dsdb/samdb/ldb_modules/linked_attributes.c |  1 +
 source4/dsdb/samdb/ldb_modules/netlogon.c          |  2 +
 source4/dsdb/samdb/ldb_modules/password_hash.c     |  2 +
 source4/dsdb/samdb/ldb_modules/ranged_results.c    |  2 +
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c    |  2 +
 source4/dsdb/samdb/ldb_modules/rootdse.c           |  2 +
 source4/dsdb/samdb/ldb_modules/samldb.c            |  2 +
 source4/dsdb/samdb/ldb_modules/schema_data.c       |  2 +
 source4/dsdb/schema/schema_convert_to_ol.c         |  2 +
 source4/dsdb/schema/schema_description.c           |  2 +
 source4/dsdb/schema/schema_init.c                  |  1 +
 source4/dsdb/schema/schema_query.c                 |  3 +
 source4/dsdb/schema/schema_set.c                   |  2 +
 source4/dsdb/schema/schema_syntax.c                |  2 +
 source4/kdc/db-glue.c                              |  2 +
 source4/ldap_server/ldap_server.c                  |  2 +
 source4/lib/com/dcom/main.c                        |  2 +
 source4/lib/registry/interface.c                   |  1 +
 source4/lib/registry/patchfile_preg.c              |  3 +
 source4/lib/registry/regf.c                        |  1 +
 source4/lib/socket/socket_ip.c                     |  2 +
 source4/libcli/dgram/mailslot.c                    |  2 +
 source4/libcli/resolve/resolve.c                   |  2 +
 source4/librpc/rpc/dcerpc_connect.c                |  2 +
 source4/librpc/rpc/dcerpc_smb.c                    |  2 +
 source4/nbt_server/wins/winsdb.c                   |  2 +
 source4/ntvfs/ipc/vfs_ipc.c                        |  2 +
 source4/ntvfs/ntvfs_generic.c                      |  2 +
 source4/ntvfs/posix/pvfs_shortname.c               |  2 +
 source4/ntvfs/sysdep/sys_lease.c                   |  2 +
 source4/ntvfs/sysdep/sys_notify.c                  |  2 +
 source4/param/share_ldb.c                          |  2 +
 source4/rpc_server/backupkey/dcesrv_backupkey.c    |  2 +
 source4/rpc_server/common/share_info.c             |  2 +
 source4/rpc_server/dnsserver/dcerpc_dnsserver.c    |  2 +
 source4/rpc_server/dnsserver/dnsdata.c             |  1 +
 source4/rpc_server/dnsserver/dnsdb.c               |  2 +
 source4/rpc_server/dnsserver/dnsutils.c            |  2 +
 source4/rpc_server/drsuapi/writespn.c              |  2 +
 source4/rpc_server/lsa/dcesrv_lsa.c                |  2 +
 source4/rpc_server/netlogon/dcerpc_netlogon.c      |  2 +
 source4/rpc_server/samr/dcesrv_samr.c              |  2 +
 source4/rpc_server/srvsvc/dcesrv_srvsvc.c          |  3 +
 source4/smb_server/smb/service.c                   |  2 +
 source4/smbd/service.c                             |  2 +
 source4/torture/basic/mangle_test.c                |  2 +
 source4/torture/gpo/apply.c                        |  2 +
 source4/torture/krb5/kdc-canon-heimdal.c           |  2 +
 source4/torture/ldap/basic.c                       |  1 +
 source4/torture/ldap/netlogon.c                    |  2 +
 source4/torture/libnetapi/libnetapi_group.c        |  2 +
 source4/torture/libnetapi/libnetapi_user.c         |  2 +
 source4/torture/raw/search.c                       |  1 +
 source4/torture/rpc/drsuapi_cracknames.c           |  2 +
 source4/torture/rpc/forest_trust.c                 |  2 +
 source4/torture/rpc/netlogon.c                     |  2 +
 source4/torture/rpc/samr.c                         |  2 +
 source4/torture/smb2/mangle.c                      |  2 +
 source4/torture/unix/whoami.c                      |  1 +
 source4/torture/winbind/struct_based.c             |  1 +
 source4/utils/oLschema2ldif/lib.c                  |  2 +
 testsuite/smbd/se_access_check_utils.c             |  1 +
 205 files changed, 310 insertions(+), 71 deletions(-)
 delete mode 100644 source3/include/safe_string.h


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials_krb5.c b/auth/credentials/credentials_krb5.c
index 259b35b73b0..c321f713130 100644
--- a/auth/credentials/credentials_krb5.c
+++ b/auth/credentials/credentials_krb5.c
@@ -38,6 +38,8 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
 
+#undef strncasecmp
+
 static void cli_credentials_invalidate_client_gss_creds(
 					struct cli_credentials *cred,
 					enum credentials_obtained obtained);
diff --git a/auth/gensec/gensec_start.c b/auth/gensec/gensec_start.c
index d2d62d6652e..d34ef2d5e39 100644
--- a/auth/gensec/gensec_start.c
+++ b/auth/gensec/gensec_start.c
@@ -37,6 +37,8 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
 
+#undef strcasecmp
+
 /* the list of currently registered GENSEC backends */
 static const struct gensec_security_ops **generic_security_ops;
 static int gensec_num_backends;
diff --git a/dfs_server/dfs_server_ad.c b/dfs_server/dfs_server_ad.c
index 84a19bd3805..7f4384f443e 100644
--- a/dfs_server/dfs_server_ad.c
+++ b/dfs_server/dfs_server_ad.c
@@ -31,6 +31,8 @@
 
 #define MAX_DFS_RESPONSE 56*1024 /* 56 Kb */
 
+#undef strcasecmp
+
 /* A DC set is a group of DC, they might have been grouped together
    because they belong to the same site, or to site with same cost ...
 */
diff --git a/lib/ldb/include/ldb.h b/lib/ldb/include/ldb.h
index 7f53e6420e1..08e2096b914 100644
--- a/lib/ldb/include/ldb.h
+++ b/lib/ldb/include/ldb.h
@@ -1944,6 +1944,7 @@ int ldb_dn_update_components(struct ldb_dn *dn, const struct ldb_dn *ref_dn);
   strcasecmp and toupper here is ok.
   return 0 for match
 */
+#undef strcasecmp
 #define ldb_attr_cmp(a, b) strcasecmp(a, b)
 char *ldb_attr_casefold(TALLOC_CTX *mem_ctx, const char *s);
 int ldb_attr_dn(const char *attr);
diff --git a/lib/util/charset/tests/charset.c b/lib/util/charset/tests/charset.c
index 71635c6fea3..547dc51e59d 100644
--- a/lib/util/charset/tests/charset.c
+++ b/lib/util/charset/tests/charset.c
@@ -21,6 +21,9 @@
 #include "includes.h"
 #include "torture/torture.h"
 
+#undef strcasecmp
+#undef strncasecmp
+
 struct torture_suite *torture_local_charset(TALLOC_CTX *mem_ctx);
 
 static bool test_toupper_m(struct torture_context *tctx)
diff --git a/lib/util/charset/util_str.c b/lib/util/charset/util_str.c
index 3f5b247bd92..d1148c7387a 100644
--- a/lib/util/charset/util_str.c
+++ b/lib/util/charset/util_str.c
@@ -28,6 +28,10 @@
 #ifdef strcasecmp
 #undef strcasecmp
 #endif
+#ifdef strncasecmp
+#undef strncasecmp
+#endif
+
 
 /**
  Case insensitive string compararison, handle specified for testing
diff --git a/lib/util/safe_string.h b/lib/util/safe_string.h
index a6c052f8746..edff296f028 100644
--- a/lib/util/safe_string.h
+++ b/lib/util/safe_string.h
@@ -2,6 +2,7 @@
    Unix SMB/CIFS implementation.
    Safe string handling routines.
    Copyright (C) Andrew Tridgell 1994-1998
+   Copyright (C) Andrew Bartlett <abartlet at samba.org> 2003
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -19,11 +20,16 @@
 
 #ifndef _SAFE_STRING_H
 #define _SAFE_STRING_H
-
 #ifndef _SPLINT_ /* http://www.splint.org */
+
 /* Some macros to ensure people don't use buffer overflow vulnerable string
    functions. */
 
+#ifdef bcopy
+#undef bcopy
+#endif /* bcopy */
+#define bcopy(src,dest,size) __ERROR__XX__NEVER_USE_BCOPY___;
+
 #ifdef strcpy
 #undef strcpy
 #endif /* strcpy */
@@ -39,6 +45,20 @@
 #endif /* sprintf */
 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
 
+/*
+ * strcasecmp/strncasecmp aren't an error, but it means you're not thinking about
+ * multibyte. Don't use them. JRA.
+ */
+#ifdef strcasecmp
+#undef strcasecmp
+#endif
+#define strcasecmp __ERROR__XX__NEVER_USE_STRCASECMP__;
+
+#ifdef strncasecmp
+#undef strncasecmp
+#endif
+#define strncasecmp __ERROR__XX__NEVER_USE_STRNCASECMP__;
+
 #endif /* !_SPLINT_ */
 
 #endif
diff --git a/lib/util/string_wrappers.h b/lib/util/string_wrappers.h
index 1feea8cbc07..00bce079fbf 100644
--- a/lib/util/string_wrappers.h
+++ b/lib/util/string_wrappers.h
@@ -23,6 +23,8 @@
 #ifndef _STRING_WRAPPERS_H
 #define _STRING_WRAPPERS_H
 
+#include "lib/replace/replace.h" /* for config symbols */
+
 #define strlcpy_base(dest, src, base, size) \
 do { \
 	const char *_strlcpy_base_src = (const char *)src; \
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index daaf9808b8f..8376f8876a4 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -28,7 +28,9 @@
 #include "system/locale.h"
 #include "system/filesys.h"
 #include "lib/util/util_net.h"
+
 #undef strcasecmp
+#undef strncasecmp
 
 /*******************************************************************
  Set an address to INADDR_ANY.
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 0a730c17c88..7ae14130173 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -163,7 +163,6 @@ else:
                                  debug.h
                                  discard.h
                                  time.h
-                                 string_wrappers.h
                                  idtree.h
                                  idtree_random.h
                                  blocking.h
diff --git a/libcli/http/gensec/generic.c b/libcli/http/gensec/generic.c
index 5bafb839d65..2f09b9d5eac 100644
--- a/libcli/http/gensec/generic.c
+++ b/libcli/http/gensec/generic.c
@@ -27,6 +27,8 @@
 #include "auth/gensec/gensec_internal.h"
 #include "lib/util/base64.h"
 
+#undef strncasecmp
+
 _PUBLIC_ NTSTATUS gensec_http_generic_init(TALLOC_CTX *);
 
 struct gensec_http_generic_state {
diff --git a/libcli/http/http.c b/libcli/http/http.c
index 6be053136c8..d20fc25f9e2 100644
--- a/libcli/http/http.c
+++ b/libcli/http/http.c
@@ -26,6 +26,7 @@
 #include "util/tevent_werror.h"
 #include "lib/util/dlinklist.h"
 
+#undef strcasecmp
 
 /**
  * Determines if a response should have a body.
diff --git a/libcli/http/http_auth.c b/libcli/http/http_auth.c
index ece660584f6..3dcf52c626e 100644
--- a/libcli/http/http_auth.c
+++ b/libcli/http/http_auth.c
@@ -29,6 +29,9 @@
 #include "auth/credentials/credentials.h"
 #include "lib/util/data_blob.h"
 
+#undef strcasecmp
+#undef strncasecmp
+
 /**
  * Copy the request headers from src to dst
  */
diff --git a/libcli/security/util_sid.c b/libcli/security/util_sid.c
index e47ed04c30f..634628f04d9 100644
--- a/libcli/security/util_sid.c
+++ b/libcli/security/util_sid.c
@@ -28,6 +28,9 @@
 #include "../librpc/gen_ndr/netlogon.h"
 #include "../libcli/security/security.h"
 
+#undef strcasecmp
+#undef strncasecmp
+
 /*
  * Some useful sids, more well known sids can be found at
  * http://support.microsoft.com/kb/243330/EN-US/
diff --git a/libgpo/gpext/gpext.c b/libgpo/gpext/gpext.c
index 73bebf1879f..45c89707720 100644
--- a/libgpo/gpext/gpext.c
+++ b/libgpo/gpext/gpext.c
@@ -27,6 +27,7 @@
 #include "registry.h"
 #include "registry/reg_api.h"
 #include "lib/util/util_paths.h"
+#include "lib/util/string_wrappers.h"
 
 static struct gp_extension *extensions = NULL;
 
diff --git a/libgpo/gpo_filesync.c b/libgpo/gpo_filesync.c
index 28637619226..3cd94706551 100644
--- a/libgpo/gpo_filesync.c
+++ b/libgpo/gpo_filesync.c
@@ -22,6 +22,7 @@
 #include "libsmb/libsmb.h"
 #include "../libgpo/gpo.h"
 #include "libgpo/gpo_proto.h"
+#include "lib/util/string_wrappers.h"
 
 struct sync_context {
 	TALLOC_CTX *mem_ctx;
diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
index 3d622b2be49..42e8e611019 100644
--- a/librpc/rpc/dcerpc_util.c
+++ b/librpc/rpc/dcerpc_util.c
@@ -33,6 +33,8 @@
 #include "lib/crypto/gnutls_helpers.h"
 #include <gnutls/crypto.h>
 
+#undef strncasecmp
+
 /* we need to be able to get/set the fragment length without doing a full
    decode */
 void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v)
diff --git a/librpc/rpc/dcesrv_core.c b/librpc/rpc/dcesrv_core.c
index 88838121f2f..a12bf134077 100644
--- a/librpc/rpc/dcesrv_core.c
+++ b/librpc/rpc/dcesrv_core.c
@@ -37,6 +37,8 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
 
+#undef strcasecmp
+
 static NTSTATUS dcesrv_negotiate_contexts(struct dcesrv_call_state *call,
 				const struct dcerpc_bind *b,
 				struct dcerpc_ack_ctx *ack_ctx_list);
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 39e3878b396..6cd795ea72e 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -28,6 +28,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "lib/afs/afs_settoken.h"
 #include "lib/util/smb_strtox.h"
+#include "lib/util/string_wrappers.h"
 
 #ifdef DBGC_CLASS
 #undef DBGC_CLASS
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index 371ab78d2f8..4f79cc67a1d 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -21,6 +21,7 @@
 #include "includes.h"
 #include "nsswitch/winbind_client.h"
 #include "nsswitch/libwbclient/wbclient.h"
+#include "lib/util/string_wrappers.h"
 
 #ifdef HAVE_NS_API_H
 
diff --git a/source3/auth/auth_builtin.c b/source3/auth/auth_builtin.c
index f16b3cc2934..046b9793e33 100644
--- a/source3/auth/auth_builtin.c
+++ b/source3/auth/auth_builtin.c
@@ -20,6 +20,7 @@
 
 #include "includes.h"
 #include "auth.h"
+#include "lib/util/string_wrappers.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 751cee61ce1..c3c3d82c77d 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -29,6 +29,7 @@
 #include "includes.h"
 #include "auth.h"
 #include "../libcli/auth/pam_errors.h"
+#include "lib/util/string_wrappers.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
diff --git a/source3/client/client.c b/source3/client/client.c
index 30287ffd253..3d467498920 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -40,6 +40,7 @@
 #include "include/ntioctl.h"
 #include "../libcli/smb/smbXcli_base.h"
 #include "lib/util/time_basic.h"
+#include "lib/util/string_wrappers.h"
 
 #ifndef REGISTER
 #define REGISTER 0
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 8fa65cc3122..33bca3363b7 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -297,7 +297,7 @@ typedef char fstring[FSTRING_LEN];
 /* String routines */
 
 #include "srvstr.h"
-#include "safe_string.h"
+#include "lib/util/safe_string.h"
 
 #ifndef SIGCLD
 #define SIGCLD SIGCHLD
diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h
deleted file mode 100644
index e77017c61c9..00000000000
--- a/source3/include/safe_string.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Safe string handling routines.
-   Copyright (C) Andrew Tridgell 1994-1998
-   Copyright (C) Andrew Bartlett <abartlet at samba.org> 2003
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SAFE_STRING_H
-#define _SAFE_STRING_H
-
-#ifndef _SPLINT_ /* http://www.splint.org */
-
-/* Some macros to ensure people don't use buffer overflow vulnerable string
-   functions. */
-
-#ifdef bcopy
-#undef bcopy
-#endif /* bcopy */
-#define bcopy(src,dest,size) __ERROR__XX__NEVER_USE_BCOPY___;
-
-#ifdef strcpy
-#undef strcpy
-#endif /* strcpy */
-#define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
-
-#ifdef strcat
-#undef strcat
-#endif /* strcat */
-#define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
-
-#ifdef sprintf
-#undef sprintf
-#endif /* sprintf */
-#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
-
-/*
- * strcasecmp/strncasecmp aren't an error, but it means you're not thinking about
- * multibyte. Don't use them. JRA.
- */
-#ifdef strcasecmp
-#undef strcasecmp
-#endif
-#define strcasecmp __ERROR__XX__NEVER_USE_STRCASECMP__;
-
-#ifdef strncasecmp
-#undef strncasecmp
-#endif
-#define strncasecmp __ERROR__XX__NEVER_USE_STRNCASECMP__;
-
-#endif /* !_SPLINT_ */
-
-#include "../libcli/util/ntstatus.h"
-#include "lib/util/string_wrappers.h"
-
-#endif
diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c
index d5a60e73403..a4b8861f466 100644
--- a/source3/lib/idmap_cache.c
+++ b/source3/lib/idmap_cache.c
@@ -22,6 +22,7 @@
 #include "../libcli/security/security.h"
 #include "../librpc/gen_ndr/idmap.h"
 #include "lib/gencache.h"
+#include "lib/util/string_wrappers.h"
 
 /**
  * Find a sid2xid mapping
diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c
index 19412133342..9900aa6f93b 100644
--- a/source3/lib/privileges.c
+++ b/source3/lib/privileges.c
@@ -27,6 +27,7 @@
 #include "libcli/security/privileges_private.h"
 #include "../libcli/security/security.h"
 #include "passdb.h"
+#include "lib/util/string_wrappers.h"
 
 #define PRIVPREFIX              "PRIV_"
 
diff --git a/source3/lib/string_replace.c b/source3/lib/string_replace.c
index 25486afcbd4..42022d78ab9 100644
--- a/source3/lib/string_replace.c
+++ b/source3/lib/string_replace.c
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "smbd/smbd.h"
 #include "string_replace.h"
+#include "lib/util/string_wrappers.h"
 
 #define MAP_SIZE        0xFF
 #define MAP_NUM         0x101 /* max unicode charval / MAP_SIZE */
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index 833af10b6f0..e359ef89494 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -23,6 +23,7 @@
 #include "system/passwd.h"
 #include "secrets.h"
 #include "auth.h"
+#include "lib/util/string_wrappers.h"
 
 /* Max DNS name is 253 + '\0' */
 #define MACHINE_NAME_SIZE 254
diff --git a/source3/lib/username.c b/source3/lib/username.c
index f69d9c3bf22..280285e25d2 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -23,6 +23,7 @@
 #include "system/passwd.h"
 #include "../lib/util/memcache.h"
 #include "../lib/util/util_pw.h"
+#include "lib/util/string_wrappers.h"
 
 /* internal functions */
 static struct passwd *uname_string_combinations(char *s, TALLOC_CTX *mem_ctx,
diff --git a/source3/lib/util.c b/source3/lib/util.c
index a51c4aaf514..62584bc7ca2 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -37,6 +37,7 @@
 #include "lib/util/util_process.h"
 #include "lib/dbwrap/dbwrap_ctdb.h"
 #include "lib/gencache.h"
+#include "lib/util/string_wrappers.h"
 
 #ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
diff --git a/source3/lib/util_sd.c b/source3/lib/util_sd.c
index 39083b15438..bcf152b22cf 100644
--- a/source3/lib/util_sd.c
+++ b/source3/lib/util_sd.c
@@ -28,6 +28,7 @@
 #include "../libcli/security/security.h"
 #include "rpc_client/cli_pipe.h"
 #include "rpc_client/cli_lsarpc.h"


-- 
Samba Shared Repository



More information about the samba-cvs mailing list