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

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