From: Eric Bollengier Date: Fri, 3 Sep 2021 08:43:09 +0000 (+0200) Subject: totp: Add %c variable for the console name in the sendcommand X-Git-Tag: Beta-15.0.0~904 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baab942664d0aea9eb23c7a9919c4e8976eab54f;p=thirdparty%2Fbacula.git totp: Add %c variable for the console name in the sendcommand --- diff --git a/bacula/src/plugins/dir/totp/totp-dir.c b/bacula/src/plugins/dir/totp/totp-dir.c index dd7d9d02b..08a6467e2 100644 --- a/bacula/src/plugins/dir/totp/totp-dir.c +++ b/bacula/src/plugins/dir/totp/totp-dir.c @@ -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);