Gitweb:
https://git.exim.org/exim.git/commitdiff/649c209e19281edd67beee84e9e60b0849f84554
Commit: 649c209e19281edd67beee84e9e60b0849f84554
Parent: b68217b7953df813b7ffd7d6b02d2618847076d8
Author: Heiko Schlittermann (HS12-RIPE) <hs@???>
AuthorDate: Sun Mar 14 12:16:57 2021 +0100
Committer: Heiko Schlittermann (HS12-RIPE) <hs@???>
CommitDate: Mon Mar 15 21:50:48 2021 +0100
Fix error messages in dbfn_open
---
src/src/dbfn.c | 22 +++++++++++++++-------
test/stderr/0275 | 2 +-
test/stderr/0278 | 2 +-
test/stderr/0386 | 2 +-
test/stderr/0388 | 2 +-
test/stderr/0402 | 2 +-
test/stderr/0403 | 2 +-
test/stderr/0404 | 2 +-
test/stderr/0408 | 2 +-
test/stderr/0487 | 2 +-
10 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/src/src/dbfn.c b/src/src/dbfn.c
index 452e2ad..be6a47a 100644
--- a/src/src/dbfn.c
+++ b/src/src/dbfn.c
@@ -9,6 +9,11 @@
#include "exim.h"
+/* We have buffers holding path names for database files.
+PATH_MAX could be used here, but would be wasting memory, as we deal
+with database files like $spooldirectory/db/<name> */
+#define PATHLEN 256
+
/* Functions for accessing Exim's hints database, which consists of a number of
different DBM files. This module does not contain code for reading DBM files
@@ -93,7 +98,7 @@ int rc, save_errno;
BOOL read_only = flags == O_RDONLY;
BOOL created = FALSE;
flock_t lock_data;
-uschar dirname[256], filename[256];
+uschar dirname[PATHLEN], filename[PATHLEN];
DEBUG(D_hints_lookup) acl_level++;
@@ -196,12 +201,15 @@ but creation of the database file failed. */
if (created && geteuid() == root_uid)
{
DIR * dd;
- uschar *lastname = Ustrrchr(filename, '/') + 1;
+ uschar path[PATHLEN];
+ uschar *lastname;
int namelen = Ustrlen(name);
+ Ustrcpy(path, filename);
+ lastname = Ustrrchr(path, '/') + 1;
*lastname = 0;
- if ((dd = exim_opendir(filename)))
+ if ((dd = exim_opendir(path)))
for (struct dirent *ent; ent = readdir(dd); )
if (Ustrncmp(ent->d_name, name, namelen) == 0)
{
@@ -209,13 +217,13 @@ if (created && geteuid() == root_uid)
/* Filenames from readdir() are trusted,
so use a taint-nonchecking copy */
strcpy(CS lastname, CCS ent->d_name);
- if (Ustat(filename, &statbuf) >= 0 && statbuf.st_uid != exim_uid)
+ if (Ustat(path, &statbuf) >= 0 && statbuf.st_uid != exim_uid)
{
DEBUG(D_hints_lookup)
- debug_printf_indent("ensuring %s is owned by exim\n", filename);
- if (exim_chown(filename, exim_uid, exim_gid))
+ debug_printf_indent("ensuring %s is owned by exim\n", path);
+ if (exim_chown(path, exim_uid, exim_gid))
DEBUG(D_hints_lookup)
- debug_printf_indent("failed setting %s to owned by exim\n", filename);
+ debug_printf_indent("failed setting %s to owned by exim\n", path);
}
}
diff --git a/test/stderr/0275 b/test/stderr/0275
index a39ab10..4e27129 100644
--- a/test/stderr/0275
+++ b/test/stderr/0275
@@ -172,7 +172,7 @@ Delivery address list:
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: userx@???
diff --git a/test/stderr/0278 b/test/stderr/0278
index 634c3fa..4ea1cf3 100644
--- a/test/stderr/0278
+++ b/test/stderr/0278
@@ -131,7 +131,7 @@ Delivery address list:
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: CALLER@???
diff --git a/test/stderr/0386 b/test/stderr/0386
index fb7382b..9f53887 100644
--- a/test/stderr/0386
+++ b/test/stderr/0386
@@ -273,7 +273,7 @@ Delivery address list:
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: 2@b
diff --git a/test/stderr/0388 b/test/stderr/0388
index e23c903..f65b6f6 100644
--- a/test/stderr/0388
+++ b/test/stderr/0388
@@ -11,7 +11,7 @@ set_process_info: pppp delivering 10HmaX-0005vi-00
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: x@y
diff --git a/test/stderr/0402 b/test/stderr/0402
index 2fe542b..865bf34 100644
--- a/test/stderr/0402
+++ b/test/stderr/0402
@@ -214,7 +214,7 @@ Delivery address list:
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: CALLER@???
diff --git a/test/stderr/0403 b/test/stderr/0403
index c71e924..939c7f4 100644
--- a/test/stderr/0403
+++ b/test/stderr/0403
@@ -71,7 +71,7 @@ Delivery address list:
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: userx@???
diff --git a/test/stderr/0404 b/test/stderr/0404
index 4d5aeaf..1240813 100644
--- a/test/stderr/0404
+++ b/test/stderr/0404
@@ -172,7 +172,7 @@ Delivery address list:
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: userx@???
diff --git a/test/stderr/0408 b/test/stderr/0408
index 6320691..bd7e753 100644
--- a/test/stderr/0408
+++ b/test/stderr/0408
@@ -71,7 +71,7 @@ Delivery address list:
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: userx@???
diff --git a/test/stderr/0487 b/test/stderr/0487
index e8e9dcb..2a3446d 100644
--- a/test/stderr/0487
+++ b/test/stderr/0487
@@ -99,7 +99,7 @@ Delivery address list:
EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags=O_RDONLY
returned from EXIM_DBOPEN: (nil)
ensuring TESTSUITE/spool/db/retry.lockfile is owned by exim
- failed to open DB file TESTSUITE/spool/db/retry.lockfile: No such file or directory
+ failed to open DB file TESTSUITE/spool/db/retry: No such file or directory
no retry data available
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering: userx@???