lintian doesn't like orphan packages with uploaders...
[debian/amanda] / server-src / amindexd.c
index 6465685c38ff94d13b1e97e07d002296136af6bb..6f2e5179af7ed6cccbe529128f9da1f73a4859ff 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
  * Copyright (c) 1991-1998 University of Maryland at College Park
+ * Copyright (c) 2007-2012 Zmanda, Inc.  All Rights Reserved.
  * All Rights Reserved.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
@@ -282,9 +283,16 @@ uncompress_file(
 
        /* start the sort process */
        putenv(stralloc("LC_ALL=C"));
-       pid_sort = pipespawn(SORT_PATH, STDIN_PIPE|STDERR_PIPE, 0,
-                            &pipe_to_sort, &indexfd, &sort_errfd,
-                            SORT_PATH, NULL);
+       if (getconf_seen(CNF_TMPDIR)) {
+           gchar *tmpdir = getconf_str(CNF_TMPDIR);
+           pid_sort = pipespawn(SORT_PATH, STDIN_PIPE|STDERR_PIPE, 0,
+                                &pipe_to_sort, &indexfd, &sort_errfd,
+                                SORT_PATH, "-T", tmpdir, NULL);
+       } else {
+           pid_sort = pipespawn(SORT_PATH, STDIN_PIPE|STDERR_PIPE, 0,
+                                &pipe_to_sort, &indexfd, &sort_errfd,
+                                SORT_PATH, NULL);
+       }
        aclose(indexfd);
 
        /* start a subprocess */
@@ -640,7 +648,7 @@ is_disk_allowed(
     disk_t *disk)
 {
     dumptype_t *dt = disk->config;
-    recovery_limit_t *rl = NULL;
+    host_limit_t *rl = NULL;
     char *peer;
     char *dle_hostname;
     GSList *iter;
@@ -679,6 +687,19 @@ is_disk_allowed(
        }
     }
 
+    /* check server */
+    if (rl->server) {
+       char myhostname[MAX_HOSTNAME_LENGTH+1];
+       if (gethostname(myhostname, MAX_HOSTNAME_LENGTH) == 0) {
+           myhostname[MAX_HOSTNAME_LENGTH] = '\0';
+           g_debug("server hostname: %s", myhostname);
+           if (0 == g_ascii_strcasecmp(peer, myhostname)) {
+               g_debug("peer matched server ('%s')", myhostname);
+               return TRUE;
+           }
+       }
+    }
+
     /* check the match list */
     for (iter = rl->match_pats; iter; iter = iter->next) {
        char *pat = iter->data;
@@ -1278,6 +1299,11 @@ main(
     char his_hostname[MAX_HOSTNAME_LENGTH];
     char *cfg_opt = NULL;
 
+    if (argc > 1 && argv && argv[1] && g_str_equal(argv[1], "--version")) {
+       printf("amindexd-%s\n", VERSION);
+       return (0);
+    }
+
     /*
      * Configure program for internationalization:
      *   1) Only set the message locale for now.