X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=client-src%2Fcalcsize.c;h=f14fd17743bb819b0e9211582448cd5ff5b5dfc7;hb=fd48f3e498442f0cbff5f3606c7c403d0566150e;hp=1336d8d1e553c0296d04c3ec04444d9da719c3ab;hpb=96f35b20267e8b1a1c846d476f27fcd330e0b018;p=debian%2Famanda diff --git a/client-src/calcsize.c b/client-src/calcsize.c index 1336d8d..f14fd17 100644 --- a/client-src/calcsize.c +++ b/client-src/calcsize.c @@ -32,8 +32,9 @@ * argv[1] is the config name or NOCONFIG */ #include "amanda.h" +#include "match.h" +#include "conffile.h" #include "fsusage.h" -#include "version.h" #include "sl.h" #include "util.h" @@ -142,6 +143,7 @@ main( set_pname("calcsize"); dbopen(NULL); + config_init(CONFIG_INIT_CLIENT, NULL); /* Don't die when child closes pipe */ signal(SIGPIPE, SIG_IGN); @@ -169,23 +171,23 @@ main( char *amname=NULL, *qamname=NULL; char *filename=NULL, *qfilename = NULL; - /* drop root privileges; we'll regain them for the required operations */ -#ifdef WANT_SETUID_CLIENT - if (!set_root_privs(0)) { - error(_("calcsize must be run setuid root")); - } -#endif - safe_fd(-1, 0); safe_cd(); set_pname("calcsize"); dbopen(DBG_SUBDIR_CLIENT); - dbprintf(_("version %s\n"), version()); + config_init(CONFIG_INIT_CLIENT, NULL); + dbprintf(_("version %s\n"), VERSION); -#if 0 - erroutput_type = (ERR_INTERACTIVE|ERR_SYSLOG); + /* drop root privileges; we'll regain them for the required operations */ +#ifdef WANT_SETUID_CLIENT + check_running_as(RUNNING_AS_CLIENT_LOGIN | RUNNING_AS_UID_ONLY); + if (!set_root_privs(0)) { + error(_("calcsize must be run setuid root")); + } +#else + check_running_as(RUNNING_AS_CLIENT_LOGIN); #endif argc--, argv++; /* skip program name */ @@ -205,8 +207,6 @@ main( argc--; argv++; - check_running_as(RUNNING_AS_CLIENT_LOGIN); - /* parse backup program name */ if(strcmp(*argv, "DUMP") == 0) {