clean up changelog
[debian/amanda] / recover-src / amrecover.c
index fc4d36d6bb7252794ebcf11827b19a475e4ae0e5..c7dbc7e01f0483f8a0841ced4d5c303858bbc047 100644 (file)
@@ -62,6 +62,7 @@ char *server_line = NULL;
 char *dump_datestamp = NULL;           /* date we are restoring */
 char *dump_hostname;                   /* which machine we are restoring */
 char *disk_name = NULL;                        /* disk we are restoring */
+dle_t *dump_dle = NULL;
 char *mount_point = NULL;              /* where disk was mounted */
 char *disk_path = NULL;                        /* path relative to mount point */
 char dump_date[STR_SIZE];              /* date on which we are restoring */
@@ -135,6 +136,7 @@ get_line(void)
     server_line = newstralloc(server_line, mesg_buffer);
     amfree(mesg_buffer);
     mesg_buffer = newbuf;
+    amrecover_debug(1, "get: %s\n", mesg_buffer);
     return 0;
 }
 
@@ -336,14 +338,6 @@ main(
 
     dbopen(DBG_SUBDIR_CLIENT);
 
-#ifndef IGNORE_UID_CHECK
-    if (geteuid() != 0) {
-       erroutput_type |= ERR_SYSLOG;
-       error("amrecover must be run by root");
-       /*NOTREACHED*/
-    }
-#endif
-
     localhost = alloc(MAX_HOSTNAME_LENGTH+1);
     if (gethostname(localhost, MAX_HOSTNAME_LENGTH) != 0) {
        error(_("cannot determine local host name\n"));
@@ -354,6 +348,13 @@ main(
     /* load the base client configuration */
     config_init(CONFIG_INIT_CLIENT, NULL);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     /* treat amrecover-specific command line options as the equivalent
      * -o command-line options to set configuration values */
     cfg_ovr = new_config_overwrites(argc/2);
@@ -410,7 +411,7 @@ main(
 
     check_running_as(RUNNING_AS_ROOT);
 
-    dbrename(config_name, DBG_SUBDIR_CLIENT);
+    dbrename(get_config_name(), DBG_SUBDIR_CLIENT);
 
     our_features = am_init_feature_set();
     our_features_string = am_feature_to_string(our_features);
@@ -518,16 +519,6 @@ main(
        exit(1);
     }
 
-#if 0
-    /*
-     * We may need root privilege again later for a reserved port to
-     * the tape server, so we will drop down now but might have to
-     * come back later.
-     */
-    setegid(getgid());
-    seteuid(getuid());
-#endif
-
     /* get server's banner */
     if (grab_reply(1) == -1) {
         aclose(server_socket);
@@ -543,14 +534,18 @@ main(
     {
        char *their_feature_string = NULL;
 
+       indexsrv_features = NULL;
+
        line = vstrallocf("FEATURES %s", our_features_string);
        if(exchange(line) == 0) {
            their_feature_string = stralloc(server_line+13);
            indexsrv_features = am_string_to_feature(their_feature_string);
+           if (!indexsrv_features)
+               g_printf(_("Bad feature string from server: %s"), their_feature_string);
        }
-       else {
+       if (!indexsrv_features)
            indexsrv_features = am_set_default_feature_set();
-        }
+
        amfree(their_feature_string);
        amfree(line);
     }
@@ -571,7 +566,7 @@ main(
     }
     amfree(line);
 
-    line = vstrallocf("SCNF %s", config_name);
+    line = vstrallocf("SCNF %s", get_config_name());
     if (converse(line) == -1) {
         aclose(server_socket);
        exit(1);