index-files-created-as-root
authorDebian OpenLDAP Maintainers <pkg-openldap-devel@lists.alioth.debian.org>
Wed, 8 Feb 2023 01:56:12 +0000 (01:56 +0000)
committerRyan Tandy <ryan@nardis.ca>
Wed, 8 Feb 2023 01:56:12 +0000 (01:56 +0000)
Document in the man page that slapindex should be run as the same user
as slapd, and print a warning if it's run as root (since Debian defaults
to running slapd as openldap).

Not suitable for upstream in this form.  This patch needs to be reworked
to check the BerkeleyDB database ownership and only warn if running as
root with a database that's not owned by root.

Upstream ITS #5356 filed requesting better handling of this.  Current
upstream discussion leans towards putting the check into the database
backend and aborting if slapd is run as a different user than the database
owner, which is an even better fix.

Gbp-Pq: Name index-files-created-as-root

doc/man/man8/slapindex.8
servers/slapd/slapindex.c

index 9cadb64bb7c73c7201b3a0a4e0437dbfd8e8258f..991d6f1efaa693f3ae1f3bf552c98ace1506e30d 100644 (file)
@@ -148,6 +148,10 @@ Your
 should not be running (at least, not in read-write
 mode) when you do this to ensure consistency of the database.
 .LP
+slapindex ought to be run as the user specified for
+.BR slapd (8)
+to ensure correct database permissions.
+.LP
 This command provides ample opportunity for the user to obtain
 and drink their favorite beverage.
 .SH EXAMPLES
index 8400e82ef5d3ca6f5904dbb4b03e6e628000615e..ec13f36eb0c81bc180bd76dde02df5739785a84f 100644 (file)
@@ -34,6 +34,8 @@
 int
 slapindex( int argc, char **argv )
 {
+    if (geteuid() == 0)
+        fprintf( stderr, "\nWARNING!\nRunning as root!\nThere's a fair chance slapd will fail to start.\nCheck file permissions!\n\n");
        ID id;
        int rc = EXIT_SUCCESS;
        const char *progname = "slapindex";