source3: move lib/substitute.c functions out of proto.h
authorRalph Boehme <slow@samba.org>
Wed, 10 Nov 2021 19:18:07 +0000 (20:18 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 11 Nov 2021 13:49:32 +0000 (13:49 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14897

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
39 files changed:
source3/auth/auth_generic.c
source3/auth/auth_ntlmssp.c
source3/auth/auth_util.c
source3/include/proto.h
source3/lib/substitute.c
source3/lib/substitute.h [new file with mode: 0644]
source3/modules/vfs_expand_msdfs.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_recycle.c
source3/modules/vfs_unityed_media.c
source3/modules/vfs_virusfilter_utils.c
source3/nmbd/nmbd.c
source3/nmbd/nmbd_synclists.c
source3/param/loadparm.c
source3/passdb/passdb.c
source3/passdb/pdb_ldap.c
source3/printing/print_generic.c
source3/printing/printing.c
source3/rpc_server/lsa/srv_lsa_nt.c
source3/rpc_server/netlogon/srv_netlog_nt.c
source3/rpc_server/srvsvc/srv_srvsvc_nt.c
source3/smbd/ipc.c
source3/smbd/lanman.c
source3/smbd/message.c
source3/smbd/msdfs.c
source3/smbd/process.c
source3/smbd/reply.c
source3/smbd/server.c
source3/smbd/service.c
source3/smbd/sesssetup.c
source3/smbd/share_access.c
source3/smbd/smb2_server.c
source3/smbd/smb2_sesssetup.c
source3/smbd/trans2.c
source3/smbd/uid.c
source3/torture/torture.c
source3/utils/net_sam.c
source3/winbindd/wb_getpwsid.c
source3/winbindd/winbindd.c

index fc7a7549e8e5c6a6eb3b35f7ec62ad135c74d5e2..ff51307e43a1dddc2eda70a0c6b94b074d1cdae0 100644 (file)
@@ -36,6 +36,7 @@
 #include "auth/credentials/credentials.h"
 #include "lib/param/loadparm.h"
 #include "librpc/gen_ndr/dcerpc.h"
+#include "source3/lib/substitute.h"
 
 static NTSTATUS auth3_generate_session_info_pac(struct auth4_context *auth_ctx,
                                                TALLOC_CTX *mem_ctx,
index 676aa9d892c48c4e0532aaf5bcaf90335f3de417..f2deca09aa6891748ca03c5f332bccd8bfad585f 100644 (file)
@@ -25,6 +25,7 @@
 #include "auth.h"
 #include "libcli/security/security.h"
 #include "lib/util/tevent_ntstatus.h"
+#include "source3/lib/substitute.h"
 
 NTSTATUS auth3_generate_session_info(struct auth4_context *auth_context,
                                     TALLOC_CTX *mem_ctx,
index dec854d85c34f562ef13d1cf4271f2fd05863247..4527dedc49d9d8c802fe175dce842b1aa2796bd1 100644 (file)
@@ -38,6 +38,7 @@
 #include "rpc_client/util_netlogon.h"
 #include "source4/auth/auth.h"
 #include "auth/auth_util.h"
+#include "source3/lib/substitute.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
index c136db63b3888b285875f3cb19ff349878379192..6154b1ab26d452c17ff4a35a0c48c0c7cc09d55c 100644 (file)
@@ -139,39 +139,6 @@ int smbrun_no_sanitize(const char *cmd, int *outfd, char * const *env);
 int smbrun(const char *cmd, int *outfd, char * const *env);
 int smbrunsecret(const char *cmd, const char *secret);
 
-/* The following definitions come from lib/substitute.c  */
-
-bool set_local_machine_name(const char *local_name, bool perm);
-const char *get_local_machine_name(void);
-bool set_remote_machine_name(const char *remote_name, bool perm);
-const char *get_remote_machine_name(void);
-void sub_set_smb_name(const char *name);
-void set_current_user_info(const char *smb_name, const char *unix_name,
-                          const char *domain);
-void sub_set_socket_ids(const char *peeraddr, const char *peername,
-                       const char *sockaddr);
-const char *get_current_username(void);
-void standard_sub_basic(const char *smb_name, const char *domain_name,
-                       char *str, size_t len);
-char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
-                      const char *domain_name, const char *str);
-char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
-                       const char *input_string,
-                       const char *username,
-                       const char *grpname,
-                       const char *domain,
-                       uid_t uid,
-                       gid_t gid);
-char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
-                         const char *servicename, const char *user,
-                         const char *connectpath, gid_t gid,
-                         const char *str);
-char *talloc_sub_full(TALLOC_CTX *mem_ctx,
-                         const char *servicename, const char *user,
-                         const char *connectpath, gid_t gid,
-                         const char *smb_name, const char *domain_name,
-                         const char *str);
-
 /* The following definitions come from lib/sysquotas.c  */
 
 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
index b98a0acf1cbd9cd50732f6a0396b590f5a552540..a941b89f82a6092502a41888bc0b8dc1b16069ca 100644 (file)
@@ -20,6 +20,7 @@
 
 
 #include "includes.h"
+#include "substitute.h"
 #include "system/passwd.h"
 #include "secrets.h"
 #include "auth.h"
diff --git a/source3/lib/substitute.h b/source3/lib/substitute.h
new file mode 100644 (file)
index 0000000..2056d16
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+   Unix SMB/CIFS implementation.
+   string substitution functions
+   Copyright (C) Andrew Tridgell 1992-2000
+   Copyright (C) Gerald Carter   2006
+
+   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 SUBSTITUTE_H
+#define SUBSTITUTE_H
+
+bool set_local_machine_name(const char *local_name, bool perm);
+const char *get_local_machine_name(void);
+bool set_remote_machine_name(const char *remote_name, bool perm);
+const char *get_remote_machine_name(void);
+void sub_set_socket_ids(const char *peeraddr, const char *peername,
+                       const char *sockaddr);
+void set_current_user_info(const char *smb_name,
+                          const char *unix_name,
+                          const char *domain);
+const char *get_current_username(void);
+void standard_sub_basic(const char *smb_name,
+                       const char *domain_name,
+                       char *str,
+                       size_t len);
+char *talloc_sub_basic(TALLOC_CTX *mem_ctx,
+                       const char *smb_name,
+                       const char *domain_name,
+                       const char *str);
+char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
+                       const char *input_string,
+                       const char *username,
+                       const char *grpname,
+                       const char *domain,
+                       uid_t uid,
+                       gid_t gid);
+char *talloc_sub_advanced(TALLOC_CTX *ctx,
+                       const char *servicename,
+                       const char *user,
+                       const char *connectpath,
+                       gid_t gid,
+                       const char *str);
+char *talloc_sub_full(TALLOC_CTX *ctx,
+                       const char *servicename,
+                       const char *user,
+                       const char *connectpath,
+                       gid_t gid,
+                       const char *smb_name,
+                       const char *domain_name,
+                       const char *str);
+#endif
index 34e7051dca5ff83c2f8b90e531609dd8bfd0091e..fe3c6f47462cff5ca37c83b1e534167f5ee4f742 100644 (file)
@@ -25,6 +25,7 @@
 #include "auth.h"
 #include "../lib/tsocket/tsocket.h"
 #include "msdfs.h"
+#include "source3/lib/substitute.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
index 2c07eab69ca4a897ac8faefbc8461d11012dcc5f..5903849931ee2c64541826d842b7d7adb1da1d60 100644 (file)
@@ -73,6 +73,7 @@
 #include "passdb/machine_sid.h"
 #include "lib/util/tevent_ntstatus.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 static int vfs_full_audit_debug_level = DBGC_VFS;
 
index 6e65794311031a2743607460ae445dc876971d49..b794ebc2d8c17ea0387211cf1f34d30d3d27e614 100644 (file)
@@ -27,6 +27,7 @@
 #include "system/filesys.h"
 #include "../librpc/gen_ndr/ndr_netlogon.h"
 #include "auth.h"
+#include "source3/lib/substitute.h"
 
 #define ALLOC_CHECK(ptr, label) do { if ((ptr) == NULL) { DEBUG(0, ("recycle.bin: out of memory!\n")); errno = ENOMEM; goto label; } } while(0)
 
index 62a1456b9963228ae99480398fd0b5ecc340f32d..fbd4d968172adb12751b6206b1265ee88721ac2d 100644 (file)
@@ -62,6 +62,7 @@
 #include "../lib/tsocket/tsocket.h"
 #include "lib/util/smb_strtox.h"
 #include <libgen.h>
+#include "source3/lib/substitute.h"
 
 #define UM_PARAM_TYPE_NAME "unityed_media"
 
index c7f8089ffc733cb3d35396677fa98ffef4039719..b8b44eb203b9be6bd1dc2a67c851d03d75f85122 100644 (file)
@@ -25,6 +25,7 @@ struct iovec;
 #include "lib/util/iov_buf.h"
 #include <tevent.h>
 #include "lib/tsocket/tsocket.h"
+#include "source3/lib/substitute.h"
 
 int virusfilter_debug_class = DBGC_VFS;
 
index 44121e9915ca09b4e02d973bebd0c4e5fb954570..7470897587ea4e3fbaf92dd2f4fae20da956c42c 100644 (file)
@@ -29,6 +29,7 @@
 #include "util_cluster.h"
 #include "lib/gencache.h"
 #include "lib/global_contexts.h"
+#include "source3/lib/substitute.h"
 
 int ClientNMB       = -1;
 int ClientDGRAM     = -1;
index a65cbb87e0e254ac929139bfe67f7093fc9e15eb..d291927fbc88c82b2bc3f0084f80d1cd0b3e4756 100644 (file)
@@ -33,6 +33,7 @@
 #include "libsmb/clirap.h"
 #include "../libcli/smb/smbXcli_base.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 struct sync_record {
        struct sync_record *next, *prev;
index 62878c213d3a92b89a7199b51652191ead4c24d9..a08a9a0674883b9f4cedc065df499287c3996b7a 100644 (file)
@@ -76,6 +76,7 @@
 #include "lib/crypto/gnutls_helpers.h"
 #include "lib/util/string_wrappers.h"
 #include "auth/credentials/credentials.h"
+#include "source3/lib/substitute.h"
 
 #ifdef HAVE_SYS_SYSCTL_H
 #include <sys/sysctl.h>
index 068c5a5ea70c115fe780e778658fb7146714f516..863f260ea902b08887e48f4fe9e32fb64751440e 100644 (file)
@@ -33,6 +33,7 @@
 #include "auth/credentials/credentials.h"
 #include "lib/param/param.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_PASSDB
index e6d8a84c60fa22cf52c92ac06cff839ce6590c62..93da28b194145e7099e93f666cf475b8f14f9edc 100644 (file)
@@ -56,6 +56,7 @@
 #include "lib/util_sid_passdb.h"
 #include "lib/util/smb_strtox.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_PASSDB
index 743c311bbd5fa5a5fe2f0b9e7639bd3404b5c20f..8798a4cf34a3de30411d5107ef6051a63f6b59cf 100644 (file)
@@ -20,6 +20,7 @@
 #include "includes.h"
 #include "printing.h"
 #include "smbd/proto.h"
+#include "source3/lib/substitute.h"
 
 extern userdom_struct current_user_info;
 
index 499334df03f0d36cc8bbd0542689211cd4dff22d..67d798fbb214a3bc03c2a93b8399b647e51a6d49 100644 (file)
@@ -40,6 +40,7 @@
 #include "lib/util/string_wrappers.h"
 #include "lib/global_contexts.h"
 #include "source3/printing/rap_jobid.h"
+#include "source3/lib/substitute.h"
 
 extern userdom_struct current_user_info;
 
index 8d341b616b1c60457cc06d5a8929928a2ee14b2d..8d71b5252ab2363363e648bb3506abe8a2714955 100644 (file)
@@ -53,6 +53,7 @@
 #include "librpc/rpc/dcesrv_core.h"
 #include "librpc/rpc/dcerpc_helper.h"
 #include "lib/param/loadparm.h"
+#include "source3/lib/substitute.h"
 
 #include "lib/crypto/gnutls_helpers.h"
 #include <gnutls/gnutls.h>
index 70105894f53b3421716f2a7095088fd82294f960..ac5d22ce74d8ec07760eff2ed1c8127d8c939961 100644 (file)
@@ -50,6 +50,7 @@
 #include "lib/param/param.h"
 #include "libsmb/dsgetdcname.h"
 #include "lib/util/util_str_escape.h"
+#include "source3/lib/substitute.h"
 
 extern userdom_struct current_user_info;
 
index 8576e9d2ce24e1202ebe467dbff23c917ae3e1cf..fc27a459634b5f7de82b2a9ff721440fe432e921 100644 (file)
@@ -42,6 +42,7 @@
 #include "messages.h"
 #include "serverid.h"
 #include "lib/global_contexts.h"
+#include "source3/lib/substitute.h"
 
 extern const struct generic_mapping file_generic_mapping;
 
index f1c8ea0c2ed43d3e3e4740a10ce36dd458f04bb0..cf3b7c91c22102e7f10351b4ddc3039a75d361cd 100644 (file)
@@ -29,6 +29,7 @@
 #include "smbd/globals.h"
 #include "smbprofile.h"
 #include "rpc_server/srv_pipe_hnd.h"
+#include "source3/lib/substitute.h"
 
 #define NERR_notsupported 50
 
index 9194113e7686f217e7fdc3f71bdb077c7acf3ef5..eb8148753b9022daa39a0945dc8c6a2466ab5c2e 100644 (file)
@@ -45,6 +45,7 @@
 #include "rpc_server/rpc_ncacn_np.h"
 #include "lib/util/string_wrappers.h"
 #include "source3/printing/rap_jobid.h"
+#include "source3/lib/substitute.h"
 
 #ifdef CHECK_TYPES
 #undef CHECK_TYPES
index b97289468893f4b16aa3b56ceca1fd26230b3b4b..7185bec1289e19e39800d7c520c9ffd480e38cc1 100644 (file)
@@ -27,6 +27,7 @@
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
 #include "smbprofile.h"
+#include "source3/lib/substitute.h"
 
 extern userdom_struct current_user_info;
 
index 995ed815d908850148540e80ee33e48d95b8e027..fd002e98071ec0b892b119a6e4f2d6fe1927958a 100644 (file)
@@ -34,6 +34,7 @@
 #include "librpc/gen_ndr/ndr_dfsblobs.h"
 #include "lib/tsocket/tsocket.h"
 #include "lib/global_contexts.h"
+#include "source3/lib/substitute.h"
 
 /**********************************************************************
  Parse a DFS pathname of the form \hostname\service\reqpath
index 03409742752deee4b94d45e78506a31dbe2f821d..5015c143a042caa8687d95089905101ca8bb17dd 100644 (file)
@@ -46,6 +46,7 @@
 #include "libcli/smb/smbXcli_base.h"
 #include "lib/util/time_basic.h"
 #include "smb1_utils.h"
+#include "source3/lib/substitute.h"
 
 /* Internal message queue for deferred opens. */
 struct pending_message_list {
index 042e7f2329eb5c33de3525de1cb728949e70ad77..f85d1122a0763cd0ecdc95ea6f1729a28e2255a9 100644 (file)
@@ -50,6 +50,7 @@
 #include "libcli/smb/smb2_posix.h"
 #include "lib/util/string_wrappers.h"
 #include "source3/printing/rap_jobid.h"
+#include "source3/lib/substitute.h"
 
 /****************************************************************************
  Ensure we check the path in *exactly* the same way as W2K for a findfirst/findnext
index d7f5b4b73c0f85ac799511dfda1355d42dff585e..d02ff1bd883464a601c6dfe361c60fb12e63aa5b 100644 (file)
@@ -60,6 +60,7 @@
 #include "rpc_server/fssd.h"
 #include "rpc_server/mdssd.h"
 #include "lib/global_contexts.h"
+#include "source3/lib/substitute.h"
 
 #ifdef CLUSTER_SUPPORT
 #include "ctdb_protocol.h"
index afdea38b01619350e030d82fee137ddc60d8cc46..ef7c14d92d0e5edda4eb5522e67cb73942ddb735 100644 (file)
@@ -34,6 +34,7 @@
 #include "lib/afs/afs_funcs.h"
 #include "lib/util_path.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 bool canonicalize_connect_path(connection_struct *conn)
 {
index 2bd527ce80e4f551ecbcede0b8a5455f5da183cc..1705b8920b6ca616f903d5f7360421dbf8d2dd0b 100644 (file)
@@ -34,6 +34,7 @@
 #include "auth/gensec/gensec.h"
 #include "../libcli/smb/smb_signing.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 /****************************************************************************
  Add the standard 'Samba' signature to the end of the session setup.
index debe4fc6385c92d39485210fd2013e417f924f45..c44c4bd8c69489cdb8d904b79ef25441aeadcde6 100644 (file)
@@ -23,6 +23,7 @@
 #include "../libcli/security/security.h"
 #include "passdb/lookup_sid.h"
 #include "auth.h"
+#include "source3/lib/substitute.h"
 
 /*
  * We dropped NIS support in 2021, but need to keep configs working.
index f359db0729d8b03ae35ed26c3ad4a5363b05f991..f6b376e5a07adf1be829a4eebd4f8f5690d48b4a 100644 (file)
@@ -33,6 +33,7 @@
 #include "lib/util/iov_buf.h"
 #include "auth.h"
 #include "libcli/smb/smbXcli_base.h"
+#include "source3/lib/substitute.h"
 
 #if defined(LINUX)
 /* SIOCOUTQ TIOCOUTQ are the same */
index 38049e8535f205d22df58ef8f403c27e2d8dff42..14b806bc007dfa48ed919716546faac92fab6b3f 100644 (file)
@@ -28,6 +28,7 @@
 #include "../lib/tsocket/tsocket.h"
 #include "../libcli/security/security.h"
 #include "../lib/util/tevent_ntstatus.h"
+#include "source3/lib/substitute.h"
 
 #include "lib/crypto/gnutls_helpers.h"
 #include <gnutls/gnutls.h>
index cd6b61429c5447a0947ab11bfab6ca6b4aa1a049..a86ac3228e356119495894e4b66150da9b257216 100644 (file)
@@ -45,6 +45,7 @@
 #include "smb1_utils.h"
 #include "libcli/smb/smb2_posix.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 #define DIR_ENTRY_SAFETY_MARGIN 4096
 
index b0d7f21c200f43fe4ecdce72b190d8fa6d0e8a4b..52918c4f1819cc371df971cb35e8c24687c1e538 100644 (file)
@@ -26,6 +26,7 @@
 #include "passdb/lookup_sid.h"
 #include "auth.h"
 #include "../auth/auth_util.h"
+#include "source3/lib/substitute.h"
 
 /* what user is current? */
 extern struct current_user current_user;
index 197e1990e16f69528d76ca62876dfc700577e794..4a886614ae124202c322fbf4c6985fa9d1d91f43 100644 (file)
@@ -51,6 +51,7 @@
 #include "lib/param/param.h"
 #include "auth/gensec/gensec.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
index 6a2c6c861f9e60530b57d4d843af38f4adde0322..17cc47b2ddd1d0ed13324cb837f864e4cf5c2196 100644 (file)
@@ -33,6 +33,7 @@
 #include "idmap.h"
 #include "lib/util/smb_strtox.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 /*
  * Set a user's data
index fb0351ec20101210b1f0be812cf35432af440881..7f168bdda7a51f842cd6559c3e838c08bd8196ec 100644 (file)
@@ -22,6 +22,7 @@
 #include "librpc/gen_ndr/ndr_winbind_c.h"
 #include "../libcli/security/security.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 struct wb_getpwsid_state {
        struct tevent_context *ev;
index 2205eebd163ae596a89c1eda28ed41b895583aec..9dd7315cf9dc254e7d5a73bc80a07a4be1f80aee 100644 (file)
@@ -51,6 +51,7 @@
 #include "lib/gencache.h"
 #include "rpc_server/rpc_config.h"
 #include "lib/global_contexts.h"
+#include "source3/lib/substitute.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND