bool set_label_date;
};
+#define MAX_UNAME_LENGTH 256
+#define MAX_ESCAPE_UNAME_LENGTH MAX_UNAME_LENGTH*2+1
+
+#define MAX_PLUGIN_LENGTH 1024
+#define MAX_ESCAPE_PLUGIN_LENGTH MAX_PLUGIN_LENGTH*2+1
+
/* Client record -- same as the database */
struct CLIENT_DBR {
DBId_t ClientId; /* Unique Client id */
utime_t FileRetention;
utime_t JobRetention;
char Name[MAX_NAME_LENGTH]; /* Client name */
- char Uname[256]; /* Uname for client */
+ char Uname[MAX_UNAME_LENGTH]; /* Uname for client */
+ char Plugin[MAX_PLUGIN_LENGTH]; /* Plugin list for this client */
};
/* Counter record as in database */
ClientId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
Name TINYBLOB NOT NULL,
Uname TINYBLOB NOT NULL, /* full uname -a of client */
+ Plugin TINYBLOB DEFAULT '',
AutoPrune TINYINT DEFAULT 0,
FileRetention BIGINT UNSIGNED DEFAULT 0,
JobRetention BIGINT UNSIGNED DEFAULT 0,
clientid serial not null,
name text not null,
uname text not null,
+ plugin text default '',
autoprune smallint default 0,
fileretention bigint default 0,
jobretention bigint default 0,
{
bdb_lock();
if (type == VERT_LIST || type == JSON_LIST) {
- Mmsg(cmd, "SELECT ClientId,Name,Uname,AutoPrune,FileRetention,"
+ Mmsg(cmd, "SELECT ClientId,Name,Uname,Plugin,AutoPrune,FileRetention,"
"JobRetention "
"FROM Client %s ORDER BY ClientId", get_acls(DB_ACL_BIT(DB_ACL_RBCLIENT), true));
} else {
int stat;
char ed1[50], ed2[50];
char esc_name[MAX_ESCAPE_NAME_LENGTH];
- char esc_uname[MAX_ESCAPE_NAME_LENGTH];
+ char esc_uname[MAX_ESCAPE_UNAME_LENGTH];
+ char esc_plugin[MAX_ESCAPE_PLUGIN_LENGTH];
CLIENT_DBR tcr;
bdb_lock();
bdb_escape_string(jcr, esc_name, cr->Name, strlen(cr->Name));
bdb_escape_string(jcr, esc_uname, cr->Uname, strlen(cr->Uname));
+ bdb_escape_string(jcr, esc_plugin, cr->Plugin, strlen(cr->Plugin));
+
Mmsg(cmd,
"UPDATE Client SET AutoPrune=%d,FileRetention=%s,JobRetention=%s,"
-"Uname='%s' WHERE Name='%s'",
+"Uname='%s',Plugin='%s' WHERE Name='%s'",
cr->AutoPrune,
edit_uint64(cr->FileRetention, ed1),
edit_uint64(cr->JobRetention, ed2),
- esc_uname, esc_name);
+ esc_uname, esc_plugin, esc_name);
stat = UpdateDB(jcr, cmd, false);
bdb_unlock();
cr.AutoPrune = jcr->client->AutoPrune;
cr.FileRetention = jcr->client->FileRetention;
cr.JobRetention = jcr->client->JobRetention;
+
+ /* information about plugins can be found after the Uname */
+ char *pos = strchr(fd->msg+strlen(OKjob)+1, ';');
+ if (pos) {
+ *pos = 0;
+ bstrncpy(cr.Plugin, pos+1, sizeof(cr.Plugin));
+ }
bstrncpy(cr.Uname, fd->msg+strlen(OKjob)+1, sizeof(cr.Uname));
+
if (!db_update_client_record(jcr, jcr->db, &cr)) {
Jmsg(jcr, M_WARNING, 0, _("Error updating Client record. ERR=%s\n"),
db_strerror(jcr->db));
POOL_MEM msg(PM_FNAME);
pm_strcpy(msg, " Plugin: ");
foreach_alist(plugin, b_plugin_list) {
- len = pm_strcat(msg, plugin->file);
+ len = pm_strcat(msg, plugin->name);
if (len > 80) {
pm_strcat(msg, "\n ");
} else {
static char OKsession[] = "2000 OK session\n";
static char OKstore[] = "2000 OK storage\n";
static char OKstoreend[] = "2000 OK storage end\n";
-static char OKjob[] = "2000 OK Job %s (%s) %s,%s,%s";
+static char OKjob[] = "2000 OK Job %s (%s) %s,%s,%s;%s";
static char OKsetdebug[] = "2000 OK setdebug=%ld trace=%d hangup=%d"
" blowup=%d options=%s tags=%s\n";
static char BADjob[] = "2901 Bad Job\n";
Mmsg(jcr->errmsg, "JobId=%d Job=%s", jcr->JobId, jcr->Job);
new_plugins(jcr); /* instantiate plugins for this jcr */
generate_plugin_event(jcr, bEventJobStart, (void *)jcr->errmsg);
+
+ POOL_MEM msg;
+ if (b_plugin_list) {
+ bool first=true;
+ Plugin *plugin;
+ foreach_alist(plugin, b_plugin_list) {
+ if (!first) {
+ pm_strcat(msg, ",");
+ }
+ first = false;
+ pm_strcat(msg, plugin->name);
+ if (plugin->pinfo) {
+ pInfo *info = (pInfo *)plugin->pinfo;
+ pm_strcat(msg, "(");
+ pm_strcat(msg, NPRT(info->plugin_version));
+ pm_strcat(msg, ")");
+ }
+ }
+ }
+
#ifdef HAVE_WIN32
- return dir->fsend(OKjob, VERSION, LSMDATE, win_os, DISTNAME, DISTVER);
+ return dir->fsend(OKjob, VERSION, LSMDATE, win_os, DISTNAME, DISTVER, msg.c_str());
#else
- return dir->fsend(OKjob, VERSION, LSMDATE, HOST_OS, DISTNAME, DISTVER);
+ return dir->fsend(OKjob, VERSION, LSMDATE, HOST_OS, DISTNAME, DISTVER, msg.c_str());
#endif
}
int len, maxlen=80;
pm_strcpy(msg, " Plugin: ");
foreach_alist(plugin, b_plugin_list) {
- len = pm_strcat(msg, plugin->file);
- /* Print plugin version when debug activated */
+ len = pm_strcat(msg, plugin->name);
if (plugin->pinfo) {
pInfo *info = (pInfo *)plugin->pinfo;
pm_strcat(msg, "(");
if (i++ > 0) {
pm_strcat(tmp, ",");
}
- pm_strcat(tmp, plug->file);
+ pm_strcat(tmp, plug->name);
}
}
pm_strcat(tmp, separator_str);
plugin = new_plugin();
plugin->file = bstrdup(dname.c_str());
+ dname.c_str()[len-type_len] = 0;
+ plugin->name = bstrdup(dname.c_str());
plugin->file_len = strstr(plugin->file, type) - plugin->file;
plugin->pHandle = dlopen(fname.c_str(), RTLD_NOW);
if (!plugin->pHandle) {
if (plugin->file) {
free(plugin->file);
}
+ if (plugin->name) {
+ free(plugin->name);
+ }
free(plugin);
}
delete b_plugin_list;
class Plugin {
public:
char *file;
+ char *name;
int32_t file_len;
t_unloadPlugin unloadPlugin;
void *pinfo;
Plugin *plugin;
pm_strcpy(msg, " Plugin: ");
foreach_alist(plugin, b_plugin_list) {
- len = pm_strcat(msg, plugin->file);
- /* Print plugin version when debug activated */
- if (debug_level > 0 && plugin->pinfo) {
+ len = pm_strcat(msg, plugin->name);
+ if (plugin->pinfo) {
pm_strcat(msg, "(");
pm_strcat(msg, NPRT(sdplug_info(plugin)->plugin_version));
len = pm_strcat(msg, ")");