Debian Codegraph @

debian/patches/index-files-created-as-root

raw
1 Document in the man page that slapindex should be run as the same user
2 as slapd, and print a warning if it's run as root (since Debian defaults
3 to running slapd as openldap).
4
5 Not suitable for upstream in this form. This patch needs to be reworked
6 to check the BerkeleyDB database ownership and only warn if running as
7 root with a database that's not owned by root.
8
9 Upstream ITS #5356 filed requesting better handling of this. Current
10 upstream discussion leans towards putting the check into the database
11 backend and aborting if slapd is run as a different user than the database
12 owner, which is an even better fix.
13
14 Index: openldap/doc/man/man8/slapindex.8
15 ===================================================================
16 --- openldap.orig/doc/man/man8/slapindex.8 2022-05-20 17:36:11.609245615 -0400
17 +++ openldap/doc/man/man8/slapindex.8 2022-05-20 17:36:11.605245612 -0400
18 @@ -148,6 +148,10 @@
19 should not be running (at least, not in read-write
20 mode) when you do this to ensure consistency of the database.
21 .LP
22 +slapindex ought to be run as the user specified for
23 +.BR slapd (8)
24 +to ensure correct database permissions.
25 +.LP
26 This command provides ample opportunity for the user to obtain
27 and drink their favorite beverage.
28 .SH EXAMPLES
29 Index: openldap/servers/slapd/slapindex.c
30 ===================================================================
31 --- openldap.orig/servers/slapd/slapindex.c 2022-05-20 17:36:11.609245615 -0400
32 +++ openldap/servers/slapd/slapindex.c 2022-05-20 17:36:11.605245612 -0400
33 @@ -34,6 +34,8 @@
34 int
35 slapindex( int argc, char **argv )
36 {
37 + if (geteuid() == 0)
38 + fprintf( stderr, "\nWARNING!\nRunning as root!\nThere's a fair chance slapd will fail to start.\nCheck file permissions!\n\n");
39 ID id;
40 int rc = EXIT_SUCCESS;
41 const char *progname = "slapindex";