Skip to content

Commit

Permalink
s3: safe_string: do not include string_wrappers.h
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: David Mulder <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
matvore authored and jrasamba committed Aug 28, 2020
1 parent 1fde7db commit c2ac923
Show file tree
Hide file tree
Showing 114 changed files with 113 additions and 2 deletions.
1 change: 1 addition & 0 deletions libgpo/gpext/gpext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions libgpo/gpo_filesync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions nsswitch/wbinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions nsswitch/wins.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions source3/auth/auth_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "includes.h"
#include "auth.h"
#include "lib/util/string_wrappers.h"

#undef DBGC_CLASS
#define DBGC_CLASS DBGC_AUTH
Expand Down
1 change: 1 addition & 0 deletions source3/auth/pampass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions source3/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions source3/include/safe_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,4 @@

#endif /* !_SPLINT_ */

#include "lib/util/string_wrappers.h"

#endif
1 change: 1 addition & 0 deletions source3/lib/idmap_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions source3/lib/privileges.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_"

Expand Down
1 change: 1 addition & 0 deletions source3/lib/string_replace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions source3/lib/substitute.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions source3/lib/username.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions source3/lib/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions source3/lib/util_sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "../libcli/security/security.h"
#include "rpc_client/cli_pipe.h"
#include "rpc_client/cli_lsarpc.h"
#include "lib/util/string_wrappers.h"

/* These values discovered by inspection */

Expand Down
1 change: 1 addition & 0 deletions source3/lib/util_sid.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "../librpc/gen_ndr/ndr_security.h"
#include "../librpc/gen_ndr/netlogon.h"
#include "../libcli/security/security.h"
#include "lib/util/string_wrappers.h"


/*****************************************************************
Expand Down
1 change: 1 addition & 0 deletions source3/lib/wins_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "includes.h"
#include "lib/gencache.h"
#include "lib/util/string_wrappers.h"

/*
This is pretty much a complete rewrite of the earlier code. The main
Expand Down
1 change: 1 addition & 0 deletions source3/libnet/libnet_dssync_passdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "../libds/common/flag_mapping.h"
#include "passdb.h"
#include "lib/util/base64.h"
#include "lib/util/string_wrappers.h"

/****************************************************************
****************************************************************/
Expand Down
1 change: 1 addition & 0 deletions source3/librpc/crypto/gse_krb5.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "gse_krb5.h"
#include "lib/param/loadparm.h"
#include "libads/kerberos_proto.h"
#include "lib/util/string_wrappers.h"

#ifdef HAVE_KRB5

Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/cli_smb2_fnum.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "librpc/gen_ndr/ndr_ioctl.h"
#include "ntioctl.h"
#include "librpc/gen_ndr/ndr_quota.h"
#include "lib/util/string_wrappers.h"

struct smb2_hnd {
uint64_t fid_persistent;
Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/clidgram.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "messages.h"
#include "librpc/gen_ndr/samr.h"
#include "../lib/util/pidfile.h"
#include "lib/util/string_wrappers.h"

/*
* cli_send_mailslot, send a mailslot for client code ...
Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/cliprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "libsmb/libsmb.h"
#include "libsmb/clirap.h"
#include "../libcli/smb/smbXcli_base.h"
#include "lib/util/string_wrappers.h"

/*****************************************************************************
Convert a character pointer in a cli_call_api() response to a form we can use.
Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/clirap.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "trans2.h"
#include "../libcli/smb/smbXcli_base.h"
#include "cli_smb2_fnum.h"
#include "lib/util/string_wrappers.h"

#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/libsmb_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "../libcli/security/security.h"
#include "lib/util/tevent_ntstatus.h"
#include "lib/util/time_basic.h"
#include "lib/util/string_wrappers.h"

/*
* Routine to open a directory
Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/libsmb_xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "rpc_client/rpc_client.h"
#include "rpc_client/cli_lsarpc.h"
#include "../libcli/security/security.h"
#include "lib/util/string_wrappers.h"

/*
* Find an lsa pipe handle associated with a cli struct.
Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/namequery.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "lib/gencache.h"
#include "librpc/gen_ndr/dns.h"
#include "lib/util/util_net.h"
#include "lib/util/string_wrappers.h"

/* nmbd.c sets this to True. */
bool global_in_nmbd = False;
Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/namequery_dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "ads.h"
#include "../librpc/gen_ndr/nbt.h"
#include "lib/param/loadparm.h"
#include "lib/util/string_wrappers.h"

/**********************************************************************
Is this our primary domain ?
Expand Down
1 change: 1 addition & 0 deletions source3/libsmb/nmblib.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "includes.h"
#include "libsmb/nmblib.h"
#include "lib/util/string_wrappers.h"

static const struct opcode_names {
const char *nmb_opcode_name;
Expand Down
1 change: 1 addition & 0 deletions source3/modules/vfs_afsacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "../libcli/security/dom_sid.h"
#include "passdb.h"
#include "lib/afs/afs_settoken.h"
#include "lib/util/string_wrappers.h"

#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
Expand Down
1 change: 1 addition & 0 deletions source3/modules/vfs_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "librpc/gen_ndr/ndr_ioctl.h"
#include "offload_token.h"
#include "util_reparse.h"
#include "lib/util/string_wrappers.h"

#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
Expand Down
1 change: 1 addition & 0 deletions source3/modules/vfs_full_audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
#include "libcli/security/sddl.h"
#include "passdb/machine_sid.h"
#include "lib/util/tevent_ntstatus.h"
#include "lib/util/string_wrappers.h"

static int vfs_full_audit_debug_level = DBGC_VFS;

Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_become_lmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "includes.h"
#include "nmbd/nmbd.h"
#include "../librpc/gen_ndr/svcctl.h"
#include "lib/util/string_wrappers.h"

extern uint16_t samba_nb_type; /* Samba's NetBIOS name type. */

Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_browserdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "includes.h"
#include "nmbd/nmbd.h"
#include "lib/util/string_wrappers.h"

/* -------------------------------------------------------------------------- **
* Variables...
Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_browsesync.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "includes.h"
#include "nmbd/nmbd.h"
#include "lib/util/string_wrappers.h"

/* This is our local master browser list database. */
extern struct browse_cache_record *lmb_browserlist;
Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_elections.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "includes.h"
#include "nmbd/nmbd.h"
#include "lib/util/string_wrappers.h"

/* Election parameters. */
extern time_t StartupTime;
Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_incomingdgrams.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
#include "nmbd/nmbd.h"
#include "lib/util/string_wrappers.h"

extern bool found_lm_clients;

Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_nameregister.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "includes.h"
#include "nmbd/nmbd.h"
#include "lib/util/string_wrappers.h"

/* forward declarations */
static void wins_next_registration(struct response_record *rrec);
Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_packets.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "system/select.h"
#include "libsmb/libsmb.h"
#include "libsmb/unexpected.h"
#include "lib/util/string_wrappers.h"

extern int ClientNMB;
extern int ClientDGRAM;
Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_sendannounce.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
#include "nmbd/nmbd.h"
#include "lib/util/string_wrappers.h"

extern int updatecount;
extern bool found_lm_clients;
Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_serverlistdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "system/filesys.h"
#include "../librpc/gen_ndr/svcctl.h"
#include "nmbd/nmbd.h"
#include "lib/util/string_wrappers.h"

int updatecount = 0;

Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_synclists.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "libsmb/libsmb.h"
#include "libsmb/clirap.h"
#include "../libcli/smb/smbXcli_base.h"
#include "lib/util/string_wrappers.h"

struct sync_record {
struct sync_record *next, *prev;
Expand Down
1 change: 1 addition & 0 deletions source3/nmbd/nmbd_workgroupdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
#include "nmbd/nmbd.h"
#include "lib/util/string_wrappers.h"

extern uint16_t samba_nb_type;

Expand Down
1 change: 1 addition & 0 deletions source3/param/loadparm.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include "source4/lib/tls/tls.h"
#include "libcli/auth/ntlm_check.h"
#include "lib/crypto/gnutls_helpers.h"
#include "lib/util/string_wrappers.h"

#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
Expand Down
1 change: 1 addition & 0 deletions source3/passdb/machine_account_secrets.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "lib/krb5_wrap/krb5_samba.h"
#include "lib/util/time_basic.h"
#include "../libds/common/flags.h"
#include "lib/util/string_wrappers.h"

#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
Expand Down
1 change: 1 addition & 0 deletions source3/passdb/passdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "util_tdb.h"
#include "auth/credentials/credentials.h"
#include "lib/param/param.h"
#include "lib/util/string_wrappers.h"

#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
Expand Down
1 change: 1 addition & 0 deletions source3/passdb/pdb_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "passdb/pdb_secrets.h"
#include "lib/util_sid_passdb.h"
#include "idmap_cache.h"
#include "lib/util/string_wrappers.h"

#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
Expand Down
1 change: 1 addition & 0 deletions source3/passdb/pdb_ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "lib/param/loadparm.h"
#include "lib/util_sid_passdb.h"
#include "lib/util/smb_strtox.h"
#include "lib/util/string_wrappers.h"

#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
Expand Down
1 change: 1 addition & 0 deletions source3/passdb/pdb_smbpasswd.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "../librpc/gen_ndr/samr.h"
#include "../libcli/security/security.h"
#include "passdb/pdb_smbpasswd.h"
#include "lib/util/string_wrappers.h"

#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
Expand Down
1 change: 1 addition & 0 deletions source3/passdb/pdb_tdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "util_tdb.h"
#include "passdb/pdb_tdb.h"
#include "lib/util/smb_strtox.h"
#include "lib/util/string_wrappers.h"

#if 0 /* when made a module use this */

Expand Down
1 change: 1 addition & 0 deletions source3/passdb/py_passdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "passdb.h"
#include "secrets.h"
#include "idmap.h"
#include "lib/util/string_wrappers.h"

#ifndef Py_TYPE /* Py_TYPE is only available on Python > 2.6 */
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
Expand Down
Loading

0 comments on commit c2ac923

Please sign in to comment.