Blame SOURCES/0007-Issue-4973-update-snmp-to-use-run-dirsrv-for-PID-fil.patch

9f2552
From c26c463ac92682dcf01ddbdc11cc1109b183eb0a Mon Sep 17 00:00:00 2001
9f2552
From: Mark Reynolds <mreynolds@redhat.com>
9f2552
Date: Mon, 1 Nov 2021 16:04:28 -0400
9f2552
Subject: [PATCH 07/12] Issue 4973 - update snmp to use /run/dirsrv for PID
9f2552
 file
9f2552
9f2552
Description:  Previously SNMP would write the agent PID file directly
9f2552
              under /run (or /var/run), but this broke a CI test after
9f2552
              updating lib389/defaults.inf to use /run/dirsrv.
9f2552
9f2552
              Instead of hacking the CI test, I changed the path
9f2552
              snmp uses to:  /run/dirsrv/  Which is where it
9f2552
              should really be written anyway.
9f2552
9f2552
relates: https://github.com/389ds/389-ds-base/issues/4973
9f2552
9f2552
Reviewed by: vashirov(Thanks!)
9f2552
---
9f2552
 ldap/servers/snmp/main.c         | 4 ++--
9f2552
 wrappers/systemd-snmp.service.in | 6 +++---
9f2552
 2 files changed, 5 insertions(+), 5 deletions(-)
9f2552
9f2552
diff --git a/ldap/servers/snmp/main.c b/ldap/servers/snmp/main.c
9f2552
index e6271a8a9..d8eb918f6 100644
9f2552
--- a/ldap/servers/snmp/main.c
9f2552
+++ b/ldap/servers/snmp/main.c
9f2552
@@ -287,14 +287,14 @@ load_config(char *conf_path)
9f2552
     }
9f2552
 
9f2552
     /* set pidfile path */
9f2552
-    if ((pidfile = malloc(strlen(LOCALRUNDIR) + strlen("/") +
9f2552
+    if ((pidfile = malloc(strlen(LOCALRUNDIR) + strlen("/dirsrv/") +
9f2552
                           strlen(LDAP_AGENT_PIDFILE) + 1)) != NULL) {
9f2552
         strncpy(pidfile, LOCALRUNDIR, strlen(LOCALRUNDIR) + 1);
9f2552
         /* The above will likely not be NULL terminated, but we need to
9f2552
          * be sure that we're properly NULL terminated for the below
9f2552
          * strcat() to work properly. */
9f2552
         pidfile[strlen(LOCALRUNDIR)] = (char)0;
9f2552
-        strcat(pidfile, "/");
9f2552
+        strcat(pidfile, "/dirsrv/");
9f2552
         strcat(pidfile, LDAP_AGENT_PIDFILE);
9f2552
     } else {
9f2552
         printf("ldap-agent: malloc error processing config file\n");
9f2552
diff --git a/wrappers/systemd-snmp.service.in b/wrappers/systemd-snmp.service.in
9f2552
index 477bc623d..f18766cb4 100644
9f2552
--- a/wrappers/systemd-snmp.service.in
9f2552
+++ b/wrappers/systemd-snmp.service.in
9f2552
@@ -1,7 +1,7 @@
9f2552
 # do not edit this file in /lib/systemd/system - instead do the following:
9f2552
 # cp /lib/systemd/system/dirsrv-snmp.service /etc/systemd/system/
9f2552
 # edit /etc/systemd/system/dirsrv-snmp.service
9f2552
-# systemctl daemon-reload 
9f2552
+# systemctl daemon-reload
9f2552
 # systemctl (re)start dirsrv-snmp.service
9f2552
 [Unit]
9f2552
 Description=@capbrand@ Directory Server SNMP Subagent.
9f2552
@@ -9,8 +9,8 @@ After=network.target
9f2552
 
9f2552
 [Service]
9f2552
 Type=forking
9f2552
-PIDFile=/run/ldap-agent.pid
9f2552
-ExecStart=@sbindir@/ldap-agent @configdir@/ldap-agent.conf 
9f2552
+PIDFile=/run/dirsrv/ldap-agent.pid
9f2552
+ExecStart=@sbindir@/ldap-agent @configdir@/ldap-agent.conf
9f2552
 
9f2552
 [Install]
9f2552
 WantedBy=multi-user.target
9f2552
-- 
9f2552
2.31.1
9f2552