]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
totp: Add %c variable for the console name in the sendcommand
authorEric Bollengier <eric@baculasystems.com>
Fri, 3 Sep 2021 08:43:09 +0000 (10:43 +0200)
committerEric Bollengier <eric@baculasystems.com>
Fri, 30 Jun 2023 16:33:45 +0000 (18:33 +0200)
bacula/src/plugins/dir/totp/totp-dir.c

index dd7d9d02be9512d7f52468b6e7d9c9cf2427b1f8..08a6467e232b6dc25a156cb485082359915560cb 100644 (file)
@@ -345,8 +345,8 @@ public:
       bfree_and_null(sendcommand);
    };
 
-   POOLMEM *edit_codes(POOLMEM *&omsg, char *imsg, char *qrcode_file) {
-      char *p;
+   POOLMEM *edit_codes(POOLMEM *&omsg, const char *imsg, const char *name, const char *qrcode_file) {
+      const char *p;
       const char *str;
       char add[50];
       extern char my_name[];    /* From libbac */
@@ -364,6 +364,9 @@ public:
             case 'd':
                str = my_name;            /* Director's name */
                break;
+            case 'c':
+               str = name;               /* Console name */
+               break;
             case 'P':
                edit_uint64(getpid(), add);
                str = add;
@@ -543,7 +546,7 @@ public:
          goto bail_out;
       }
 
-      edit_codes(tmp.addr(), sendcommand, pngfile);
+      edit_codes(tmp.addr(), sendcommand, name, pngfile);
 
       if (run_program_full_output (tmp.c_str(), 10, *ret, NULL) != 0) {
          Dmsg1(0, "Unable to call the mail program to send the totp key %s\n", *ret);