diff -uNr samba-4.14.4/auth/credentials/credentials_krb5.c samba-4.14.4.mod/auth/credentials/credentials_krb5.c --- samba-4.14.4/auth/credentials/credentials_krb5.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/auth/credentials/credentials_krb5.c 2021-05-06 11:30:43.338213898 +0000 @@ -625,7 +625,7 @@ must_free_cc_name = true; if (lpcfg_parm_bool(lp_ctx, NULL, "credentials", "krb5_cc_file", false)) { - ccache_name = talloc_asprintf(ccc, "FILE:/tmp/krb5_cc_samba_%u_%p", + ccache_name = talloc_asprintf(ccc, "FILE:@TERMUX_PREFIX@/tmp/krb5_cc_samba_%u_%p", (unsigned int)getpid(), ccc); } else { ccache_name = talloc_asprintf(ccc, "MEMORY:%p", diff -uNr samba-4.14.4/ctdb/tests/src/porting_tests.c samba-4.14.4.mod/ctdb/tests/src/porting_tests.c --- samba-4.14.4/ctdb/tests/src/porting_tests.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/ctdb/tests/src/porting_tests.c 2021-05-06 11:30:43.338213898 +0000 @@ -41,7 +41,7 @@ pid_t helper_pid; int socket; } globals = { - .socketname = "/tmp/test.sock" + .socketname = "@TERMUX_PREFIX@/tmp/test.sock" }; diff -uNr samba-4.14.4/lib/ldb/tools/ldbedit.c samba-4.14.4.mod/lib/ldb/tools/ldbedit.c --- samba-4.14.4/lib/ldb/tools/ldbedit.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/lib/ldb/tools/ldbedit.c 2021-05-06 11:30:43.338213898 +0000 @@ -218,7 +218,7 @@ { int fd, ret; FILE *f; - char file_template[] = "/tmp/ldbedit.XXXXXX"; + char file_template[] = "@TERMUX_PREFIX@/tmp/ldbedit.XXXXXX"; char *cmd; struct ldb_ldif *ldif; struct ldb_message **msgs2 = NULL; diff -uNr samba-4.14.4/lib/param/loadparm.c samba-4.14.4.mod/lib/param/loadparm.c --- samba-4.14.4/lib/param/loadparm.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/lib/param/loadparm.c 2021-05-06 11:30:43.338213898 +0000 @@ -2514,12 +2514,12 @@ tmp = lpcfg_parm_string(lp_ctx, NULL, "vlp", "tdbfile"); if (tmp == NULL) { - tmp = "/tmp/vlp.tdb"; + tmp = "@TERMUX_PREFIX@/tmp/vlp.tdb"; } tdbfile = talloc_asprintf(tmp_ctx, "tdbfile=%s", tmp); if (tdbfile == NULL) { - tdbfile="tdbfile=/tmp/vlp.tdb"; + tdbfile="tdbfile=@TERMUX_PREFIX@/tmp/vlp.tdb"; } tmp = talloc_asprintf(tmp_ctx, "vlp %s print %%p %%s", diff -uNr samba-4.14.4/lib/replace/wscript samba-4.14.4.mod/lib/replace/wscript --- samba-4.14.4/lib/replace/wscript 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/lib/replace/wscript 2021-05-06 11:30:43.342213897 +0000 @@ -778,8 +778,8 @@ conf.CHECK_CODE(''' struct stat st; - char tpl[20]="/tmp/test.XXXXXX"; - char tpl2[20]="/tmp/test.XXXXXX"; + char tpl[51]="@TERMUX_PREFIX@/tmp/test.XXXXXX"; + char tpl2[51]="@TERMUX_PREFIX@/tmp/test.XXXXXX"; int fd = mkstemp(tpl); int fd2 = mkstemp(tpl2); if (fd == -1) { @@ -793,7 +793,7 @@ unlink(tpl2); if (fstat(fd, &st) != 0) exit(1); if ((st.st_mode & 0777) != 0600) exit(1); - if (strcmp(tpl, "/tmp/test.XXXXXX") == 0) { + if (strcmp(tpl, "@TERMUX_PREFIX@/tmp/test.XXXXXX") == 0) { exit(1); } if (strcmp(tpl, tpl2) == 0) { diff -uNr samba-4.14.4/lib/util/util.c samba-4.14.4.mod/lib/util/util.c --- samba-4.14.4/lib/util/util.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/lib/util/util.c 2021-05-06 11:30:43.342213897 +0000 @@ -62,7 +62,7 @@ char *p; if ((p = getenv("TMPDIR"))) return p; - return "/tmp"; + return "@TERMUX_PREFIX@/tmp"; } diff -uNr samba-4.14.4/nsswitch/winbind_nss_aix.c samba-4.14.4.mod/nsswitch/winbind_nss_aix.c --- samba-4.14.4/nsswitch/winbind_nss_aix.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/nsswitch/winbind_nss_aix.c 2021-05-06 11:30:43.342213897 +0000 @@ -63,7 +63,7 @@ if (!debug_enabled) { return; } - f = fopen("/tmp/WINBIND_DEBUG.log", "a"); + f = fopen("@TERMUX_PREFIX@/tmp/WINBIND_DEBUG.log", "a"); if (!f) return; va_start(ap, format); vfprintf(f, format, ap); diff -uNr samba-4.14.4/source3/client/smbspool_krb5_wrapper.c samba-4.14.4.mod/source3/client/smbspool_krb5_wrapper.c --- samba-4.14.4/source3/client/smbspool_krb5_wrapper.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source3/client/smbspool_krb5_wrapper.c 2021-05-06 11:30:43.342213897 +0000 @@ -309,7 +309,7 @@ } /* Fallback to a FILE ccache */ - snprintf(gen_cc, sizeof(gen_cc), "FILE:/tmp/krb5cc_%u", uid); + snprintf(gen_cc, sizeof(gen_cc), "FILE:@TERMUX_PREFIX@/tmp/krb5cc_%u", uid); create_env: /* diff -uNr samba-4.14.4/source3/lib/smbconf/testsuite.c samba-4.14.4.mod/source3/lib/smbconf/testsuite.c --- samba-4.14.4/source3/lib/smbconf/testsuite.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source3/lib/smbconf/testsuite.c 2021-05-06 11:30:43.342213897 +0000 @@ -208,7 +208,7 @@ { sbcErr err; bool ret = true; - const char *filename = "/tmp/smb.conf.smbconf_testsuite"; + const char *filename = "@TERMUX_PREFIX@/tmp/smb.conf.smbconf_testsuite"; struct smbconf_ctx *conf_ctx = NULL; TALLOC_CTX *mem_ctx = talloc_stackframe(); diff -uNr samba-4.14.4/source3/modules/vfs_virusfilter.c samba-4.14.4.mod/source3/modules/vfs_virusfilter.c --- samba-4.14.4/source3/modules/vfs_virusfilter.c 2021-04-20 10:04:03.000000000 +0000 +++ samba-4.14.4.mod/source3/modules/vfs_virusfilter.c 2021-05-06 11:31:15.350214614 +0000 @@ -292,7 +292,7 @@ quarantine_dir = lp_parm_const_string( snum, "virusfilter", "quarantine directory", - tmp ? tmp : "/tmp/.quarantine"); + tmp ? tmp : "@TERMUX_PREFIX@/tmp/.quarantine"); if (quarantine_dir != NULL) { config->quarantine_dir = talloc_strdup(config, quarantine_dir); if (config->quarantine_dir == NULL) { diff -uNr samba-4.14.4/source3/modules/vfs_virusfilter_fsav.c samba-4.14.4.mod/source3/modules/vfs_virusfilter_fsav.c --- samba-4.14.4/source3/modules/vfs_virusfilter_fsav.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source3/modules/vfs_virusfilter_fsav.c 2021-05-06 11:30:43.342213897 +0000 @@ -23,7 +23,7 @@ #ifdef FSAV_DEFAULT_SOCKET_PATH # define VIRUSFILTER_DEFAULT_SOCKET_PATH FSAV_DEFAULT_SOCKET_PATH #else -# define VIRUSFILTER_DEFAULT_SOCKET_PATH "/tmp/.fsav-0" +# define VIRUSFILTER_DEFAULT_SOCKET_PATH "@TERMUX_PREFIX@/tmp/.fsav-0" #endif /* Default values for module-specific configuration variables */ diff -uNr samba-4.14.4/source3/registry/tests/test_regfio.c samba-4.14.4.mod/source3/registry/tests/test_regfio.c --- samba-4.14.4/source3/registry/tests/test_regfio.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source3/registry/tests/test_regfio.c 2021-05-06 11:30:43.342213897 +0000 @@ -65,7 +65,7 @@ if (ret == 0) { test_ctx = talloc_get_type_abort(*state, struct test_ctx); - test_ctx->tmp_regfile = talloc_strdup(test_ctx, "/tmp/regfio.XXXXXX"); + test_ctx->tmp_regfile = talloc_strdup(test_ctx, "@TERMUX_PREFIX@/tmp/regfio.XXXXXX"); assert_non_null(test_ctx->tmp_regfile); test_ctx->tmp_regfile_fd = mkstemp(test_ctx->tmp_regfile); diff -uNr samba-4.14.4/source3/smbd/notifyd/tests.c samba-4.14.4.mod/source3/smbd/notifyd/tests.c --- samba-4.14.4/source3/smbd/notifyd/tests.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source3/smbd/notifyd/tests.c 2021-05-06 11:30:43.342213897 +0000 @@ -66,12 +66,12 @@ .instance.filter = UINT32_MAX, .instance.subdir_filter = UINT32_MAX }; - char path[64]; + char path[256]; size_t len; struct iovec iov[2]; NTSTATUS status; - len = snprintf(path, sizeof(path), "/tmp%u", i); + len = snprintf(path, sizeof(path), "@TERMUX_PREFIX@/tmp%u", i); iov[0].iov_base = &msg; iov[0].iov_len = offsetof(struct notify_rec_change_msg, path); diff -uNr samba-4.14.4/source3/smbd/process.c samba-4.14.4.mod/source3/smbd/process.c --- samba-4.14.4/source3/smbd/process.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source3/smbd/process.c 2021-05-06 11:30:43.342213897 +0000 @@ -1418,7 +1418,7 @@ len = smb_len_tcp(data)+4; for (i=1;i<100;i++) { fname = talloc_asprintf(talloc_tos(), - "/tmp/%s.%d.%s", + "@TERMUX_PREFIX@/tmp/%s.%d.%s", name, i, type ? "req" : "resp"); diff -uNr samba-4.14.4/source3/utils/interact.c samba-4.14.4.mod/source3/utils/interact.c --- samba-4.14.4/source3/utils/interact.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source3/utils/interact.c 2021-05-06 11:30:43.342213897 +0000 @@ -76,7 +76,7 @@ char* interact_edit(TALLOC_CTX* mem_ctx, const char* str) { - char fname[] = "/tmp/net_idmap_check.XXXXXX"; + char fname[] = "@TERMUX_PREFIX@/tmp/net_idmap_check.XXXXXX"; char buf[128]; char* ret = NULL; FILE* file; diff -uNr samba-4.14.4/source3/utils/net_rpc_samsync.c samba-4.14.4.mod/source3/utils/net_rpc_samsync.c --- samba-4.14.4/source3/utils/net_rpc_samsync.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source3/utils/net_rpc_samsync.c 2021-05-06 11:30:43.342213897 +0000 @@ -47,7 +47,7 @@ "\t to pull accounts from a remote PDC where we are a BDC\n" "\t\t no args puts accounts in local passdb from smb.conf\n" "\t\t ldif - put accounts in ldif format (file defaults to " - "/tmp/tmp.ldif)\n" + "@TERMUX_PREFIX@/tmp/tmp.ldif)\n" "\t\t keytab - put account passwords in krb5 keytab " "(defaults to system keytab)\n")); diff -uNr samba-4.14.4/source3/winbindd/winbindd_pam.c samba-4.14.4.mod/source3/winbindd/winbindd_pam.c --- samba-4.14.4/source3/winbindd/winbindd_pam.c 2021-02-04 08:24:37.000000000 +0000 +++ samba-4.14.4.mod/source3/winbindd/winbindd_pam.c 2021-05-06 11:30:43.342213897 +0000 @@ -573,11 +573,11 @@ if (uid != -1) { if (strequal(type, "FILE")) { gen_cc = talloc_asprintf( - mem_ctx, "FILE:/tmp/krb5cc_%d", uid); + mem_ctx, "FILE:@TERMUX_PREFIX@/tmp/krb5cc_%d", uid); } if (strequal(type, "WRFILE")) { gen_cc = talloc_asprintf( - mem_ctx, "WRFILE:/tmp/krb5cc_%d", uid); + mem_ctx, "WRFILE:@TERMUX_PREFIX@/tmp/krb5cc_%d", uid); } if (strequal(type, "KEYRING")) { gen_cc = talloc_asprintf( diff -uNr samba-4.14.4/source4/heimdal/lib/krb5/expand_path.c samba-4.14.4.mod/source4/heimdal/lib/krb5/expand_path.c --- samba-4.14.4/source4/heimdal/lib/krb5/expand_path.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source4/heimdal/lib/krb5/expand_path.c 2021-05-06 11:30:43.346213897 +0000 @@ -287,11 +287,11 @@ const char *p = NULL; if (issuid()) - p = getenv("TEMP"); + p = getenv("TMPDIR"); if (p) *ret = strdup(p); else - *ret = strdup("/tmp"); + *ret = strdup("@TERMUX_PREFIX@/tmp"); if (*ret == NULL) return ENOMEM; return 0; diff -uNr samba-4.14.4/source4/heimdal/lib/krb5/krb5.h samba-4.14.4.mod/source4/heimdal/lib/krb5/krb5.h --- samba-4.14.4/source4/heimdal/lib/krb5/krb5.h 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source4/heimdal/lib/krb5/krb5.h 2021-05-06 11:30:43.346213897 +0000 @@ -351,7 +351,7 @@ #ifdef KRB5_USE_PATH_TOKENS #define KRB5_DEFAULT_CCFILE_ROOT "%{TEMP}/krb5cc_" #else -#define KRB5_DEFAULT_CCFILE_ROOT "/tmp/krb5cc_" +#define KRB5_DEFAULT_CCFILE_ROOT "@TERMUX_PREFIX@/tmp/krb5cc_" #endif #define KRB5_DEFAULT_CCROOT "FILE:" KRB5_DEFAULT_CCFILE_ROOT diff -uNr samba-4.14.4/source4/heimdal/lib/krb5/krb5_locl.h samba-4.14.4.mod/source4/heimdal/lib/krb5/krb5_locl.h --- samba-4.14.4/source4/heimdal/lib/krb5/krb5_locl.h 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source4/heimdal/lib/krb5/krb5_locl.h 2021-05-06 11:30:43.346213897 +0000 @@ -303,7 +303,7 @@ } krb5_context_data; #ifndef KRB5_USE_PATH_TOKENS -#define KRB5_DEFAULT_CCNAME_FILE "FILE:/tmp/krb5cc_%{uid}" +#define KRB5_DEFAULT_CCNAME_FILE "FILE:@TERMUX_PREFIX@/tmp/krb5cc_%{uid}" #else #define KRB5_DEFAULT_CCNAME_FILE "FILE:%{TEMP}/krb5cc_%{uid}" #endif diff -uNr samba-4.14.4/source4/heimdal/lib/krb5/krb5-v4compat.h samba-4.14.4.mod/source4/heimdal/lib/krb5/krb5-v4compat.h --- samba-4.14.4/source4/heimdal/lib/krb5/krb5-v4compat.h 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source4/heimdal/lib/krb5/krb5-v4compat.h 2021-05-06 11:30:43.346213897 +0000 @@ -108,7 +108,7 @@ #ifdef KRB5_USE_PATH_TOKENS #define TKT_ROOT "%{TEMP}/tkt" #else -#define TKT_ROOT "/tmp/tkt" +#define TKT_ROOT "@TERMUX_PREFIX@/tmp/tkt" #endif #endif diff -uNr samba-4.14.4/source4/librpc/tests/binding_string.c samba-4.14.4.mod/source4/librpc/tests/binding_string.c --- samba-4.14.4/source4/librpc/tests/binding_string.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source4/librpc/tests/binding_string.c 2021-05-06 11:30:43.346213897 +0000 @@ -127,9 +127,9 @@ "ncadg_ip_udp:", "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_np:localhost", "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_ip_tcp:127.0.0.1", - "ncacn_unix_stream:[/tmp/epmapper]", + "ncacn_unix_stream:[@TERMUX_PREFIX@/tmp/epmapper]", "ncalrpc:[IDENTIFIER]", - "ncacn_unix_stream:[/tmp/epmapper,sign]", + "ncacn_unix_stream:[@TERMUX_PREFIX@/tmp/epmapper,sign]", "ncacn_ip_tcp:127.0.0.1[75,target_hostname=port75.example.com,target_principal=host/port75.example.com]", "ncacn_ip_tcp:127.0.0.1[75,connect,target_hostname=port75.example.com,target_principal=host/port75.example.com,assoc_group_id=0x01234567]", "ncacn_ip_tcp:127.0.0.1[75,packet,target_hostname=port75.example.com,target_principal=host/port75.example.com,assoc_group_id=0x01234567]", diff -uNr samba-4.14.4/source4/param/tests/share.c samba-4.14.4.mod/source4/param/tests/share.c --- samba-4.14.4/source4/param/tests/share.c 2021-01-21 13:20:40.000000000 +0000 +++ samba-4.14.4.mod/source4/param/tests/share.c 2021-05-06 11:30:43.346213897 +0000 @@ -50,7 +50,7 @@ bool found = false; struct share_info inf[] = { { SHARE_INFO_STRING, SHARE_TYPE, discard_const_p(void *, "IPC$") }, - { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "/tmp/bla") } + { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "@TERMUX_PREFIX@/tmp/bla") } }; NTSTATUS status; @@ -126,7 +126,7 @@ struct share_context *ctx = (struct share_context *)discard_const(tcase_data); struct share_info inf[] = { { SHARE_INFO_STRING, SHARE_TYPE, discard_const_p(void *, "IPC$") }, - { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "/tmp/bla") } + { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "@TERMUX_PREFIX@/tmp/bla") } }; NTSTATUS status; @@ -149,7 +149,7 @@ struct share_context *ctx = (struct share_context *)discard_const(tcase_data); struct share_info inf[] = { { SHARE_INFO_STRING, SHARE_TYPE, discard_const_p(void *, "IPC$") }, - { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "/tmp/bla") } + { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "@TERMUX_PREFIX@/tmp/bla") } }; NTSTATUS status; diff -uNr samba-4.14.4/testsuite/nsswitch/getgrent_r.c samba-4.14.4.mod/testsuite/nsswitch/getgrent_r.c --- samba-4.14.4/testsuite/nsswitch/getgrent_r.c 2021-01-21 13:20:41.000000000 +0000 +++ samba-4.14.4.mod/testsuite/nsswitch/getgrent_r.c 2021-05-06 11:30:43.346213897 +0000 @@ -14,12 +14,12 @@ void dump_grent(char *id) { struct group *gr; - char fname[255]; + char fname[512]; FILE *fptr; /* Open results file */ - sprintf(fname, "/tmp/getgrent_r-%s.out-%d", id, getpid()); + sprintf(fname, "@TERMUX_PREFIX@/tmp/getgrent_r-%s.out-%d", id, getpid()); if ((fptr = fopen(fname, "w")) == NULL) { fprintf(stderr, "ERROR: could not open file %s: %s\n", fname, diff -uNr samba-4.14.4/testsuite/nsswitch/getpwent_r.c samba-4.14.4.mod/testsuite/nsswitch/getpwent_r.c --- samba-4.14.4/testsuite/nsswitch/getpwent_r.c 2021-01-21 13:20:41.000000000 +0000 +++ samba-4.14.4.mod/testsuite/nsswitch/getpwent_r.c 2021-05-06 11:30:43.346213897 +0000 @@ -14,12 +14,12 @@ void dump_pwent(char *id) { struct passwd *pw; - char fname[255]; + char fname[512]; FILE *fptr; /* Open results file */ - sprintf(fname, "/tmp/getpwent_r-%s.out-%d", id, getpid()); + sprintf(fname, "@TERMUX_PREFIX@/tmp/getpwent_r-%s.out-%d", id, getpid()); if ((fptr = fopen(fname, "w")) == 0) { fprintf(stderr, "ERROR: could not open file %s: %s\n", fname, diff -uNr samba-4.14.4/testsuite/unittests/test_krb5_samba.c samba-4.14.4.mod/testsuite/unittests/test_krb5_samba.c --- samba-4.14.4/testsuite/unittests/test_krb5_samba.c 2021-01-21 13:20:41.000000000 +0000 +++ samba-4.14.4.mod/testsuite/unittests/test_krb5_samba.c 2021-05-06 11:30:43.346213897 +0000 @@ -37,7 +37,7 @@ krb5_context context = *state; krb5_keytab keytab = NULL; krb5_error_code code; - char keytab_template[] = "/tmp/keytab.XXXXXX"; + char keytab_template[] = "@TERMUX_PREFIX@/tmp/keytab.XXXXXX"; int fd; fd = mkstemp(keytab_template); @@ -59,7 +59,7 @@ krb5_context context = *state; krb5_keytab keytab = NULL; krb5_error_code code; - char keytab_template[] = "/tmp/keytab.XXXXXX"; + char keytab_template[] = "@TERMUX_PREFIX@/tmp/keytab.XXXXXX"; char keytab_file[6 + strlen(keytab_template)]; int fd; diff -uNr samba-4.14.4/third_party/pam_wrapper/pam_wrapper.c samba-4.14.4.mod/third_party/pam_wrapper/pam_wrapper.c --- samba-4.14.4/third_party/pam_wrapper/pam_wrapper.c 2021-01-21 13:20:41.000000000 +0000 +++ samba-4.14.4.mod/third_party/pam_wrapper/pam_wrapper.c 2021-05-06 11:30:43.346213897 +0000 @@ -1158,7 +1158,7 @@ static void pwrap_init(void) { - char tmp_config_dir[] = "/tmp/pam.X"; + char tmp_config_dir[] = "@TERMUX_PREFIX@/tmp/pam.X"; size_t len = strlen(tmp_config_dir); const char *env; struct stat sb;