UAContext *ua;
memset(&rx, 0, sizeof(rx));
rx.bsr = new_bsr();
- rx.JobIds = "";
+ rx.JobIds = (char *)"";
rx.bsr->JobId = jcr->previous_jr.JobId;
ua = new_ua_context(jcr);
complete_bsr(ua, rx.bsr);
/* ua_acl.c */
-bool acl_access_ok(UAContext *ua, int acl, char *item);
-bool acl_access_ok(UAContext *ua, int acl, char *item, int len);
+bool acl_access_ok(UAContext *ua, int acl, const char *item);
+bool acl_access_ok(UAContext *ua, int acl, const char *item, int len);
/* ua_cmds.c */
int do_a_command(UAContext *ua, const char *cmd);
FILESET *select_fileset_resource(UAContext *ua);
int select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);
int select_media_dbr(UAContext *ua, MEDIA_DBR *mr);
-bool select_pool_dbr(UAContext *ua, POOL_DBR *pr, char *argk="pool");
+bool select_pool_dbr(UAContext *ua, POOL_DBR *pr, const char *argk="pool");
bool select_client_dbr(UAContext *ua, CLIENT_DBR *cr);
void start_prompt(UAContext *ua, const char *msg);
int get_storage_drive(UAContext *ua, STORE *store);
int get_storage_slot(UAContext *ua, STORE *store);
int get_media_type(UAContext *ua, char *MediaType, int max_media);
-bool get_pool_dbr(UAContext *ua, POOL_DBR *pr, char *argk="pool");
+bool get_pool_dbr(UAContext *ua, POOL_DBR *pr, const char *argk="pool");
bool get_client_dbr(UAContext *ua, CLIENT_DBR *cr);
POOL *get_pool_resource(UAContext *ua);
POOL *select_pool_resource(UAContext *ua);
-/*
- *
- * Bacula Director -- User Agent Access Control List (ACL) handling
- *
- * Kern Sibbald, January MMIV
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2004-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * Bacula Director -- User Agent Access Control List (ACL) handling
+ *
+ * Kern Sibbald, January MMIV
+ *
+ * Version $Id$
+ */
#include "bacula.h"
#include "dird.h"
/*
* Check if access is permitted to item in acl
*/
-bool acl_access_ok(UAContext *ua, int acl, char *item)
+bool acl_access_ok(UAContext *ua, int acl, const char *item)
{
return acl_access_ok(ua, acl, item, strlen(item));
}
/* This version expects the length of the item which we must check. */
-bool acl_access_ok(UAContext *ua, int acl, char *item, int len)
+bool acl_access_ok(UAContext *ua, int acl, const char *item, int len)
{
/* If no console resource => default console and all is permitted */
char *when, *verify_job_name, *catalog_name;
char *previous_job_name;
char *since;
- char *verify_list;
+ const char *verify_list;
JOB *job;
JOB *verify_job;
JOB *previous_job;
/* Forward referenced subroutines */
static void select_job_level(UAContext *ua, JCR *jcr);
static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job,
- char *verify_list, char *jid, const char *replace,
+ const char *verify_list, char *jid, const char *replace,
char *client_name);
static void select_where_regexp(UAContext *ua, JCR *jcr);
static bool scan_command_line_arguments(UAContext *ua, run_ctx &rc);
return;
}
-static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, char *verify_list,
+static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char *verify_list,
char *jid, const char *replace, char *client_name)
{
Dmsg1(800, "JobType=%c\n", jcr->JobType);
* returns: false on error
* true on success and fills in POOL_DBR
*/
-bool get_pool_dbr(UAContext *ua, POOL_DBR *pr, char *argk)
+bool get_pool_dbr(UAContext *ua, POOL_DBR *pr, const char *argk)
{
if (pr->Name[0]) { /* If name already supplied */
if (db_get_pool_record(ua->jcr, ua->db, pr) &&
* Select a Pool record from catalog
* argk can be pool, recyclepool, scratchpool etc..
*/
-bool select_pool_dbr(UAContext *ua, POOL_DBR *pr, char *argk)
+bool select_pool_dbr(UAContext *ua, POOL_DBR *pr, const char *argk)
{
POOL_DBR opr;
char name[MAX_NAME_LENGTH];
#include "bacula.h"
#include "filed.h"
-const int dbglvl = 3;
+const int dbglvl = 50;
static char OK_hello[] = "2000 OK Hello\n";
static char Dir_sorry[] = "2999 No go\n";
}
/* Respond to SD challenge */
- if (debug_level == 3) {
- Dmsg1(000, "sd_auth_key=%s\n", jcr->sd_auth_key);
- }
auth_success = cram_md5_respond(sd, jcr->sd_auth_key, &tls_remote_need, &compatible);
if (job_canceled(jcr)) {
auth_success = false; /* force quick exit */
goto auth_fatal;
}
}
- if (debug_level == 3) {
- Dmsg0(000, "FD->SD Auth OK\n");
- }
auth_fatal:
/* Destroy session key */
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
- if (debug_level == 3) {
- Dmsg0(000, "zap sd_auth_key\n");
- }
stop_bsock_timer(tid);
/* Single thread all failures to avoid DOS */
if (!auth_success) {
#include "bacula.h"
#include "stored.h"
-const int dbglvl = 3;
+const int dbglvl = 50;
static char Dir_sorry[] = "3999 No go\n";
static char OK_hello[] = "3000 OK Hello\n";
/* Timeout Hello after 5 mins */
btimer_t *tid = start_bsock_timer(fd, AUTH_TIMEOUT);
/* Challenge FD */
- if (debug_level == 3) {
- Pmsg1(000, "sd_auth_key=%s\n", jcr->sd_auth_key);
- }
auth_success = cram_md5_challenge(fd, jcr->sd_auth_key, tls_local_need, compatible);
if (auth_success) {
/* Respond to his challenge */
mt_stat->mt_fileno >= 0;
}
-static char *modes[] = {
+static const char *modes[] = {
"CREATE_READ_WRITE",
"OPEN_READ_WRITE",
"OPEN_READ_ONLY",
bsnprintf(seed, sizeof(seed), "%p%d", jcr, JobId);
make_session_key(auth_key, seed, 1);
dir->fsend(OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
- if (debug_level == 3) {
- Dmsg2(000, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg);
- }
Dmsg2(100, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg);
jcr->sd_auth_key = bstrdup(auth_key);
memset(auth_key, 0, sizeof(auth_key));
}
V(mutex);
- if (debug_level == 3) {
- Dmsg0(000, "Zap sd_auth_key\n");
- }
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
if (jcr->authenticated && !job_canceled(jcr)) {
/*
* Authenticate the File daemon
*/
- if (debug_level == 3) {
- Dmsg2(000, "jid=%u sd_auth_key=%s\n", (uint32_t)jcr->JobId, jcr->sd_auth_key);
- }
if (jcr->authenticated || !authenticate_filed(jcr)) {
Dmsg1(100, "Authentication failed Job %s\n", jcr->Job);
Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
- if (debug_level == 3) {
- Dmsg2(000, "**** Authentication failed jid=%u key=%s\n",
- (uint32_t)jcr->JobId, jcr->sd_auth_key);
- }
} else {
jcr->authenticated = true;
Dmsg2(110, "OK Authentication jid=%u Job %s\n", (uint32_t)jcr->JobId, jcr->Job);
Technical notes on version 2.3
General:
+27Sep07
+kes Add const char where needed (more to do). Remove temp debug code.
26Sep07
kes Setup SQLite busy handler before doing queries.
kes Don't overwrite error message in check_tables_version.