]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
[Bug 552] faxalter admin support and dialstring alteration
authorDarren Nickerson <darren.nickerson@ifax.com>
Mon, 21 Jun 2004 03:55:03 +0000 (03:55 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Mon, 21 Jun 2004 03:55:03 +0000 (03:55 +0000)
Adds the ability to 'faxalter' others jobs as admin, and also to alter
the destionation. Strangely, neither of these were previously possible.

Thanks to iFAX Solutions for this contribution.

CHANGES
faxalter/faxalter.c++
man/faxalter.1

diff --git a/CHANGES b/CHANGES
index 8716243b6123dec6e370aa4c6c3bcf7154ca07be..056e598544199199ac36f11bd9de75c2d3632c74 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog for HylaFAX 4.2.0
 
+* add admin option and dialstring alteration to faxalter (20 Jun 2004)
 * add -end option for xferfaxstats and recvstats (17 Jun 2004)
 * add DynamicLocalID config option (17 Jun 2004)
 * prevent CID values from acquiring data when unset (1 Jun 2004)
index 0c38c5dbc94b89300d93039511920077e5d37e24..ad6f5aa7801ef8c20290c14153bf06a27da2b8a4 100644 (file)
@@ -56,10 +56,14 @@ faxAlterApp::run(int argc, char** argv)
     time_t now = Sys::now();
     struct tm tts = *localtime(&now);
     struct tm when;
+    bool useadmin = false;
 
     int c;
-    while ((c = getopt(argc, argv, "a:h:k:m:n:P:t:DQRgpv")) != -1)
+    while ((c = getopt(argc, argv, "a:d:h:k:m:n:P:t:ADQRgpv")) != -1)
        switch (c) {
+       case 'A':                       // connect with administrative privileges
+           useadmin = true;
+           break;
        case 'D':                       // set notification to when done
         script.append(groups ? "JGPARM " : "JPARM ");
         script.append("NOTIFY DONE\n");
@@ -99,6 +103,16 @@ faxAlterApp::run(int argc, char** argv)
             script.append("SENDTIME NOW\n");
         }
            break;
+       case 'd':                       // destination number
+            script.append(groups ? "JGPARM " : "JPARM ");
+           script.append("EXTERNAL ");
+            script.append(optarg);
+            script.append("\n");
+            script.append(groups ? "JGPARM " : "JPARM ");
+           script.append("DIALSTRING ");
+            script.append(optarg);
+            script.append("\n");
+           break;
        case 'g':                       // apply to groups, not jobs
            groups = true;
            break;
@@ -173,7 +187,8 @@ faxAlterApp::run(int argc, char** argv)
     if (script == "")
        fxFatal("No job parameters specified for alteration.");
     if (callServer(emsg)) {
-       if (login(NULL, emsg)) {
+       if (login(NULL, emsg) &&
+           (!useadmin || admin(NULL, emsg))) {
            for (; optind < argc; optind++) {
                const char* jobid = argv[optind];
                if (setCurrentJob(jobid) && jobSuspend(jobid)) {
@@ -199,11 +214,13 @@ faxAlterApp::usage()
     fxFatal("usage: faxalter"
       " [-h server-host]"
       " [-a time]"
+      " [-d number]"
       " [-k time]"
       " [-m modem]"
       " [-n notify]"
       " [-P priority]"
       " [-t tries]"
+      " [-A]"
       " [-p]"
       " [-g]"
       " [-DQR]"
index 4d03c000c818dcdb5277deef0d0cebba07fdf10b..8e4be4d3d23e42783fffc82537f7967ee9467197 100644 (file)
@@ -51,7 +51,9 @@ that has been submitted to \*(Fx; these numbers are printed by
 when jobs are queued for transmission and can also be displayed with
 .IR faxstat (1).
 Unprivileged users can alter the parameters of jobs that they own; clients
-with administrative privileges on a server can manipulate any job.
+with administrative privileges on a server can manipulate any job (see the
+.B \-A
+option below).
 The user may be specified by the
 .B FAXUSER
 environment variable.  By default,
@@ -71,6 +73,10 @@ by
 (and
 .IR at (1)).
 .TP 10
+.BI \-d " destination"
+Change the destination number to 
+.IR destination .
+.TP 10
 .BI \-h " host"
 Force the server to be contacted on a specific
 .IR host .
@@ -92,6 +98,11 @@ If all of the above fails, then
 .I faxalter
 attempts to contact a server on the machine where it is run.
 .TP 10
+.BI \-A
+Use administrative privileges;
+.I faxalter
+will prompt for the password to set administrative privileges.
+.TP 10
 .BI \-k " time"
 Specify a new time to kill a job;
 the syntax is the same as used for the