Merge commit 'upstream/3.1.0'
[debian/amanda] / common-src / local-security.c
index 29a946df5ae0d233619d397c0a0bbf6c03350d9c..6a8b8a4da617eabf41e6299444afc4ec82349940 100644 (file)
  */
 
 #include "amanda.h"
+#include "match.h"
 #include "util.h"
 #include "event.h"
 #include "packet.h"
-#include "queue.h"
 #include "security.h"
 #include "security-util.h"
 #include "stream.h"
-#include "version.h"
 
 /*
  * Number of seconds amandad has to start up
@@ -178,6 +177,7 @@ local_connect(
 
 error:
     (*fn)(arg, &rh->sech, S_ERROR);
+    amfree(rh->hostname);
 }
 
 /*
@@ -188,7 +188,7 @@ static int
 runlocal(
     struct tcp_conn *  rc,
     const char *       amandad_path,
-    const char *       client_username)
+    const char *       client_username G_GNUC_UNUSED)
 {
     int rpipe[2], wpipe[2];
     char *xamandad_path = (char *)amandad_path;
@@ -242,11 +242,13 @@ runlocal(
        return (0);
     }
 
+    /* drop root privs for good */
+    set_root_privs(-1);
+
     safe_fd(-1, 0);
 
     if(!xamandad_path || strlen(xamandad_path) <= 1) 
-       xamandad_path = vstralloc(amlibexecdir, "/", "amandad",
-                                versionsuffix(), NULL);
+       xamandad_path = vstralloc(amlibexecdir, "/", "amandad", NULL);
 
 #ifndef SINGLE_USERID
     if (uid != 0)