From 0775eeb6e35b9ece7139971abbe11e174b814507 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 22 Jul 2005 20:30:00 +0000 Subject: [PATCH] - Correct compiler complaints in wx-console and tray-monitor. - Correct VSS problems recognizing c: - Add VSS before job status - Fix output of status from being one big line. - Change cd xx; make to cd xx && make as suggested by Phil. - Cleanup projects file - Remove unnecessary casting of FF_PKT in filed. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2236 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/Makefile.in | 40 ++++---- bacula/kes-1.37 | 7 ++ bacula/projects | 112 ++++------------------- bacula/src/Makefile.in | 6 +- bacula/src/filed/job.c | 23 +++-- bacula/src/filed/status.c | 91 +++++++++--------- bacula/src/findlib/find.c | 4 +- bacula/src/lib/winapi.c | 67 +++++++------- bacula/src/tray-monitor/tray-monitor.c | 4 +- bacula/src/win32/compat/compat.cpp | 10 +- bacula/src/win32/compat/vss.cpp | 11 +-- bacula/src/win32/compat/vss.h | 1 + bacula/src/win32/compat/vss_generic.cpp | 10 +- bacula/src/wx-console/console_thread.cpp | 13 ++- 14 files changed, 160 insertions(+), 239 deletions(-) diff --git a/bacula/Makefile.in b/bacula/Makefile.in index abc9c6f4b7..59442a576f 100755 --- a/bacula/Makefile.in +++ b/bacula/Makefile.in @@ -113,34 +113,34 @@ install-menu-consolehelper: gnomedirs ln -s $(DESTDIR)/usr/bin/consolehelper $(DESTDIR)/usr/bin/gnome-console install: installdirs - @for I in $(all_subdirs); do (cd $$I; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done + @for I in $(all_subdirs); do (cd $$I && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done uninstall: - @for I in $(all_subdirs); do (cd $$I; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done + @for I in $(all_subdirs); do (cd $$I && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done install-autostart: - (cd platforms; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) + (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) install-autostart-dir: - (cd platforms; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) + (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) install-autostart-fd: - (cd platforms; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) + (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) install-autostart-sd: - (cd platforms; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) + (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-autostart: - (cd platforms; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) + (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-autostart-dir: - (cd platforms; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) + (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-autostart-fd: - (cd platforms; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) + (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-autostart-sd: - (cd platforms; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) + (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-menu: rm -f $(DESTDIR)/usr/share/pixmaps/bacula.png @@ -188,10 +188,10 @@ clean: # clean for distribution distclean: - @for I in $(all_subdirs); do (cd $$I; $(MAKE) $@ || exit 1); done - @for I in $(all_subdirs); do (cd $$I; $(RMF) startit stopit btraceback); done - @(cd $(srcdir); $(RMF) *~ config.cache config.h config.log config.status config.out) - @(cd $(srcdir); $(RMF) Makefile autoconf/Make.common) + @for I in $(all_subdirs); do (cd $$I && $(MAKE) $@ || exit 1); done + @for I in $(all_subdirs); do (cd $$I && $(RMF) startit stopit btraceback); done + @(cd $(srcdir) && $(RMF) *~ config.cache config.h config.log config.status config.out) + @(cd $(srcdir) && $(RMF) Makefile autoconf/Make.common) @(cd platforms; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1) @$(RMF) bacula fd Makefile startmysql stopmysql startit stopit btraceback @$(RMF) bconsole gconsole @@ -200,10 +200,10 @@ distclean: @$(RMF) -rf txt diff src/python src/testprogs devclean: - @for I in $(all_subdirs); do (cd $$I; $(MAKE) $@ || exit 1); done - @for I in $(all_subdirs); do (cd $$I; $(RMF) startit stopit btraceback); done - @(cd $(srcdir); $(RMF) *~ config.cache config.h config.log config.status config.out) - @(cd $(srcdir); $(RMF) Makefile autoconf/Make.common) + @for I in $(all_subdirs); do (cd $$I && $(MAKE) $@ || exit 1); done + @for I in $(all_subdirs); do (cd $$I && $(RMF) startit stopit btraceback); done + @(cd $(srcdir) && $(RMF) *~ config.cache config.h config.log config.status config.out) + @(cd $(srcdir) && $(RMF) Makefile autoconf/Make.common) @(cd platforms; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1) @$(RMF) bacula fd Makefile startmysql stopmysql startit stopit btraceback @$(RMF) bconsole gconsole @@ -213,12 +213,12 @@ devclean: distdirs: mkdir ../$(VERNAME); mkdir ../$(VERNAME)/autoconf; - @for I in $(all_subdirs); do (cd $$I; $(MAKE) DESTDIR=$(DESTDIR) $@ || (echo "Failed to make distclean in $$I"; exit 0) ); done + @for I in $(all_subdirs); do (cd $$I && $(MAKE) DESTDIR=$(DESTDIR) $@ || (echo "Failed to make distclean in $$I"; exit 0) ); done distcopy: $(CP) -p $(DIST) ../$(VERNAME); $(CP) -p $(DIST_CFG) ../$(VERNAME)/autoconf; - @for I in $(all_subdirs); do (cd $$I; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done + @for I in $(all_subdirs); do (cd $$I && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done distrib: configure autoconf/config.h.in distdirs distcopy diff --git a/bacula/kes-1.37 b/bacula/kes-1.37 index bff462c366..4835db30b1 100644 --- a/bacula/kes-1.37 +++ b/bacula/kes-1.37 @@ -5,6 +5,13 @@ General: Changes to 1.37.31: 22Jul05 +- Correct compiler complaints in wx-console and tray-monitor. +- Correct VSS problems recognizing c: +- Add VSS before job status +- Fix output of status from being one big line. +- Change cd xx; make to cd xx && make as suggested by Phil. +- Cleanup projects file +- Remove unnecessary casting of FF_PKT in filed. - Apply Thorsten's bugfix for vss_generic.cpp - Add check for df path for dvd_freespace - Use df to get space used on DVD. diff --git a/bacula/projects b/bacula/projects index d1e71862a2..956569fd64 100644 --- a/bacula/projects +++ b/bacula/projects @@ -1,22 +1,9 @@ Projects: Bacula Projects Roadmap - 23 April 2005 + 22 July 2005 The following major projects are scheduled for 1.37: -#3 Migration (Move, Copy, Archive Jobs) -#4 Embedded Python Scripting (implemented in all Daemons) -#5 Events that call a Python program (Implemented in all - daemons, but more cleanup work to be done). -#6 Select one from among Multiple Storage Devices for Job. - This is already implemented in 1.37. -#7 Single Job Writing to Multiple Storage Devices. This is - currently implemented with a Clone feature. -#- Full multiple drive Autochanger support (mostly implemented). -#- We will have built in support for communications - encryption (TLS) done by Landon Fuller. -# We will most likely have support for Unicode characters - (via UTF-8) on Win32 machines thanks to Thorsten Engle. Below, you will find more information on those projects as @@ -91,95 +78,34 @@ Item 3: Implement a Migration job type that will move the job Highwater size (keep total size) Lowwater mark - -Item 4: Embedded Python Scripting (precursor to 5). - Status: Implemented in 1.37 in all 3 daemons. - - What: On a configuration parameter, embed the Python language in - Bacula. - - Why: The embedded Python scripting can be called to implement - Events such as "Volume Name needed", "End of Tape", - "Tape at x% of rated capacity", "Job started", - "Job Ended", "Job error", ... - - Notes: This needs Events. - - -Item 5: Implement Events that call the scripting language. - Status: Implemented in 1.37, but more events to complete and - more work to be done to cleanup the implementation. - - What: When a particular user defined Event occurs, call the - embedded Python interpreter. - - Why: This will provide the ultimate in user customization for - Bacula. Almost anything imaginable can be done if Events - are called at the appropriate place. - - Notes: There is a certain amount of work to be done on how - the user defines or "registers" events. - - -Item 6: Multiple Storage Devices for a Single Job - Status: This is already implemented in 1.37 (at least the - initial selection of one from a number of storage - devices. - - What: Allow any Job to specify a number of storage devices, - from which one will be used. - - Why: With two devices, for example, the second device could - have the next backup tape pre-mounted reducing operator - intervention in the middle of the night. - - -Item 7: Backup a Single Job Simultaneously to Multiple Storage Devices - Status: This will probably not be done in 1.37. However, version - 1.37 has a job Cloning feature, which permits essentially - the same thing. - - What: Make two copies of the backup data at the same time. - - Why: Large shops typically do this and then take one set of - backups off-site. Some design work it needed in how to - specify the type of backup (backup, archive, ...) for - each Device. - - - -Item 8: Break the one-to-one Relationship between a Job and a - Specific Storage Device (or Devices if #10 is implemented). - Status: Mostly done in 1.37. - - What: Allow a Job to simply specify one or more MediaType, and - the Storage daemon will select a device for it. In - fact, the user should be able to specify one or more - MediaType, Storage daemon, and/or device to be used. - - Why: To allow more flexibility in large shops that have multiple - drives and/or multiple drives of different types. - - Item 9: Implement data encryption (as opposed to communications encryption) - Status: Abel Menos expressed interest in this, but he is busy - at work. - + Status: Landon Fuller has agreed to work on this. + What: Currently the data that is stored on the Volume is not encrypted. For confidentiality, encryption of data at - the File daemon level is essential. Note, communications - encryption encrypts the data when leaving the File daemon, - then decrypts the data on entry to the Storage daemon. + the File daemon level is essential. Data encryption encrypts the data in the File daemon and decrypts the data in the File daemon during a restore. Why: Large sites require this. - Notes: The only algorithm that is needed is AES. - http://csrc.nist.gov/CryptoToolkit/aes/ - +Items completed for release 1.38.0: +#4 Embedded Python Scripting (implemented in all Daemons) +#5 Events that call a Python program (Implemented in all + daemons, but more cleanup work to be done). +#6 Select one from among Multiple Storage Devices for Job. + This is already implemented in 1.37. +#7 Single Job Writing to Multiple Storage Devices. This is + currently implemented with a Clone feature. +#- Full multiple drive Autochanger support (mostly implemented). +#- We will have built in support for communications + encryption (TLS) done by Landon Fuller. +# We will most likely have support for Unicode characters + (via UTF-8) on Win32 machines thanks to Thorsten Engle. +Item 8: Break the one-to-one Relationship between a Job and a + Specific Storage Device (or Devices if #10 is implemented). Completed items from last year's list: Item 1: Multiple simultaneous Jobs. (done) diff --git a/bacula/src/Makefile.in b/bacula/src/Makefile.in index c2c128a975..cee9c1fce1 100644 --- a/bacula/src/Makefile.in +++ b/bacula/src/Makefile.in @@ -43,20 +43,20 @@ clean: @$(RMF) AUTHORS ChangeLog Makefile.am NEWS README acconfig.h autogen.sh @$(RMF) configure.in stamp.h stamp-h.in @$(RMF) -r po - (cd gnome2-console; $(MAKE) clean) + (cd gnome2-console && $(MAKE) clean) realclean: clean @$(RMF) tags distclean: realclean if test $(srcdir) = .; then $(MAKE) realclean; fi - @(cd $(srcdir); $(RMF) Makefile) + @(cd $(srcdir) && $(RMF) Makefile) @$(RMF) config.h host.h @$(RMF) -r CVS devclean: realclean if test $(srcdir) = .; then $(MAKE) realclean; fi - @(cd $(srcdir); $(RMF) Makefile) + @(cd $(srcdir) && $(RMF) Makefile) @$(RMF) config.h host.h install: diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index dc3db1a422..c7683b1020 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -233,7 +233,7 @@ void *handle_client_request(void *dirp) bnet_sig(dir, BNET_TERMINATE); /* Clean up fileset */ - FF_PKT *ff = (FF_PKT *)jcr->ff; + FF_PKT *ff = jcr->ff; findFILESET *fileset = ff->fileset; if (fileset) { int i, j, k; @@ -287,7 +287,7 @@ void *handle_client_request(void *dirp) } ff->fileset = NULL; Dmsg0(100, "Calling term_find_files\n"); - term_find_files((FF_PKT *)jcr->ff); + term_find_files(jcr->ff); jcr->ff = NULL; Dmsg0(100, "Done with term_find_files\n"); free_jcr(jcr); /* destroy JCR record */ @@ -502,7 +502,7 @@ static bool init_fileset(JCR *jcr) if (!jcr->ff) { return false; } - ff = (FF_PKT *)jcr->ff; + ff = jcr->ff; if (ff->fileset) { return false; } @@ -602,7 +602,7 @@ static void add_file_to_fileset(JCR *jcr, const char *fname, findFILESET *filese static void add_fileset(JCR *jcr, const char *item) { - FF_PKT *ff = (FF_PKT *)jcr->ff; + FF_PKT *ff = jcr->ff; findFILESET *fileset = ff->fileset; int state = fileset->state; findFOPTS *current_opts; @@ -739,7 +739,7 @@ static void add_fileset(JCR *jcr, const char *item) static bool term_fileset(JCR *jcr) { - FF_PKT *ff = (FF_PKT *)jcr->ff; + FF_PKT *ff = jcr->ff; findFILESET *fileset = ff->fileset; int i, j, k; @@ -1164,7 +1164,7 @@ static int backup_cmd(JCR *jcr) set_jcr_job_status(jcr, JS_Blocked); jcr->JobType = JT_BACKUP; - Dmsg1(100, "begin backup ff=%p\n", (FF_PKT *)jcr->ff); + Dmsg1(100, "begin backup ff=%p\n", jcr->ff); if (sd == NULL) { Jmsg(jcr, M_FATAL, 0, _("Cannot contact Storage daemon\n")); @@ -1212,17 +1212,15 @@ static int backup_cmd(JCR *jcr) #ifdef WIN32_VSS /* START VSS ON WIN 32 */ - if (g_pVSSClient && enable_vss == 1) { + if (g_pVSSClient && enable_vss) { if (g_pVSSClient->InitializeForBackup()) { /* tell vss which drives to snapshot */ char szWinDriveLetters[27]; - if (get_win32_driveletters((FF_PKT *)jcr->ff, szWinDriveLetters)) { + if (get_win32_driveletters(jcr->ff, szWinDriveLetters)) { Jmsg(jcr, M_INFO, 0, _("Generate VSS snapshots. Driver=\"%s\", Drive(s)=\"%s\"\n"), g_pVSSClient->GetDriverName(), szWinDriveLetters); - if (!g_pVSSClient->CreateSnapshots(szWinDriveLetters)) { Jmsg(jcr, M_WARNING, 0, _("Generate VSS snapshots failed\n")); - } - else { + } else { /* tell user if snapshot creation of a specific drive failed */ size_t i; for (i=0; iGetWriterState(i) < 0) msg_type = M_WARNING; - Jmsg(jcr, msg_type, 0, _("VSS Writer: %s\n"), g_pVSSClient->GetWriterInfo(i)); } } + } else { + Jmsg(jcr, M_INFO, 0, _("No drive letters found for generating VSS snapshots.\n")); } } else { Jmsg(jcr, M_WARNING, 0, _("VSS was not initialized properly. VSS support is disabled.\n")); diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 275399949d..3e86e6e0c5 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -44,7 +44,9 @@ static char DotStatusJob[] = "JobId=%d JobStatus=%c JobErrors=%d\n"; static int privs = 0; #endif #ifdef WIN32_VSS +#include "vss.h" #define VSS " VSS" +extern VSSClient *g_pVSSClient; #else #define VSS "" #endif @@ -74,50 +76,43 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a if (!privs) { privs = enable_backup_privileges(NULL, 1); } - len = Mmsg(msg, - _(" Priv 0x%x\n APIs=%sOPT,%sATP,%sLPV,%sCFA,%sCFW,\n" - " %sWUL,%sWMKD,%sWOP,%sGFAA,%sGFAW,%sGFAEA,%sGFAEW,%sSFAA,%sSFAW,%sBR,%sBW,%sSPSP,\n" - " %sWC2MB,%sMB2WC,%sFFFA,%sFFFW,%sFNFA,%sFNFW,%sSCDA,%sSCDW,\n" - " %sGCDA,%sGCDW\n"), - privs, - p_OpenProcessToken?"":"!", - p_AdjustTokenPrivileges?"":"!", - p_LookupPrivilegeValue?"":"!", - - p_CreateFileA?"":"!", - p_CreateFileW?"":"!", - - p_wunlink?"":"!", - p_wmkdir?"":"!", - p_wopen?"":"!", - - p_GetFileAttributesA?"":"!", - p_GetFileAttributesW?"":"!", - - p_GetFileAttributesExA?"":"!", - p_GetFileAttributesExW?"":"!", - - p_SetFileAttributesA?"":"!", - p_SetFileAttributesW?"":"!", - p_BackupRead?"":"!", - p_BackupWrite?"":"!", - p_SetProcessShutdownParameters?"":"!", - - p_WideCharToMultiByte?"":"!", - p_MultiByteToWideChar?"":"!", - - p_FindFirstFileA?"":"!", - p_FindFirstFileW?"":"!", - - p_FindNextFileA?"":"!", - p_FindNextFileW?"":"!", - - p_SetCurrentDirectoryA?"":"!", - p_SetCurrentDirectoryW?"":"!", - - p_GetCurrentDirectoryA?"":"!", - p_GetCurrentDirectoryW?"":"!"); + len = Mmsg(msg, "Priv 0x%x\n", privs); + sendit(msg, len, arg); + len = Mmsg(msg, "APIs=%sOPT,%sATP,%sLPV,%sCFA,%sCFW,\n", + p_OpenProcessToken?"":"!", + p_AdjustTokenPrivileges?"":"!", + p_LookupPrivilegeValue?"":"!", + p_CreateFileA?"":"!", + p_CreateFileW?"":"!"); + sendit(msg, len, arg); + len = Mmsg(msg, " %sWUL,%sWMKD,%sWOP,%sGFAA,%sGFAW,%sGFAEA,%sGFAEW,%sSFAA,%sSFAW,%sBR,%sBW,%sSPSP,\n", + p_wunlink?"":"!", + p_wmkdir?"":"!", + p_wopen?"":"!", + p_GetFileAttributesA?"":"!", + p_GetFileAttributesW?"":"!", + p_GetFileAttributesExA?"":"!", + p_GetFileAttributesExW?"":"!", + p_SetFileAttributesA?"":"!", + p_SetFileAttributesW?"":"!", + p_BackupRead?"":"!", + p_BackupWrite?"":"!", + p_SetProcessShutdownParameters?"":"!"); sendit(msg, len, arg); + len = Mmsg(msg, " %sWC2MB,%sMB2WC,%sFFFA,%sFFFW,%sFNFA,%sFNFW,%sSCDA,%sSCDW,\n", + p_WideCharToMultiByte?"":"!", + p_MultiByteToWideChar?"":"!", + p_FindFirstFileA?"":"!", + p_FindFirstFileW?"":"!", + p_FindNextFileA?"":"!", + p_FindNextFileW?"":"!", + p_SetCurrentDirectoryA?"":"!", + p_SetCurrentDirectoryW?"":"!"); + sendit(msg, len, arg); + len = Mmsg(msg, " %sGCDA,%sGCDW\n", + p_GetCurrentDirectoryA?"":"!", + p_GetCurrentDirectoryW?"":"!"); + sendit(msg, len, arg); } #endif if (debug_level > 0) { @@ -140,6 +135,12 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a Dmsg0(1000, "Begin status jcr loop.\n"); len = Mmsg(msg, _("Running Jobs:\n")); sendit(msg, len, arg); + char *vss = ""; +#ifdef WIN32_VSS + if (g_pVSSClient && g_pVSSClient->IsInitialized()) { + vss = "VSS "; + } +#endif foreach_jcr(njcr) { bstrftime_nc(dt, sizeof(dt), njcr->start_time); if (njcr->JobId == 0) { @@ -148,8 +149,8 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a len = Mmsg(msg, _("JobId %d Job %s is running.\n"), njcr->JobId, njcr->Job); sendit(msg, len, arg); - len = Mmsg(msg, _(" %s Job started: %s\n"), - job_type_to_str(njcr->JobType), dt); + len = Mmsg(msg, _(" %s%s Job started: %s\n"), + vss, job_type_to_str(njcr->JobType), dt); } sendit(msg, len, arg); if (njcr->JobId == 0) { diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index 46530a62bf..5d1fda2925 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -121,8 +121,8 @@ get_win32_driveletters(FF_PKT *ff, char* szDrives) for (j=0; jname_list.size(); j++) { char *fname = (char *)incexe->name_list.get(j); /* fname should match x:/ */ - if (strlen (fname) > 3 && B_ISALPHA(fname[0]) - && fname[1] == ':' && fname[2] == '/') { + if (strlen(fname) >= 2 && B_ISALPHA(fname[0]) + && fname[1] == ':') { /* always add in uppercase */ char ch = toupper(fname[0]); diff --git a/bacula/src/lib/winapi.c b/bacula/src/lib/winapi.c index 976a33a24c..45d382ad9e 100644 --- a/bacula/src/lib/winapi.c +++ b/bacula/src/lib/winapi.c @@ -6,22 +6,17 @@ * Kern Sibbald MMIII */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2003-2005 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ @@ -39,35 +34,35 @@ DWORD g_platform_id = VER_PLATFORM_WIN32_WINDOWS; #ifdef WIN32_VSS /* preset VSSClient to NULL */ -VSSClient* g_pVSSClient = NULL; +VSSClient *g_pVSSClient = NULL; #endif /* API Pointers */ -t_OpenProcessToken p_OpenProcessToken = NULL; +t_OpenProcessToken p_OpenProcessToken = NULL; t_AdjustTokenPrivileges p_AdjustTokenPrivileges = NULL; -t_LookupPrivilegeValue p_LookupPrivilegeValue = NULL; +t_LookupPrivilegeValue p_LookupPrivilegeValue = NULL; t_SetProcessShutdownParameters p_SetProcessShutdownParameters = NULL; -t_CreateFileA p_CreateFileA = NULL; -t_CreateFileW p_CreateFileW = NULL; +t_CreateFileA p_CreateFileA = NULL; +t_CreateFileW p_CreateFileW = NULL; t_wunlink p_wunlink = NULL; t_wmkdir p_wmkdir = NULL; t_wopen p_wopen = NULL; -t_GetFileAttributesA p_GetFileAttributesA = NULL; -t_GetFileAttributesW p_GetFileAttributesW = NULL; +t_GetFileAttributesA p_GetFileAttributesA = NULL; +t_GetFileAttributesW p_GetFileAttributesW = NULL; -t_GetFileAttributesExA p_GetFileAttributesExA = NULL; -t_GetFileAttributesExW p_GetFileAttributesExW = NULL; +t_GetFileAttributesExA p_GetFileAttributesExA = NULL; +t_GetFileAttributesExW p_GetFileAttributesExW = NULL; -t_SetFileAttributesA p_SetFileAttributesA = NULL; -t_SetFileAttributesW p_SetFileAttributesW = NULL; -t_BackupRead p_BackupRead = NULL; -t_BackupWrite p_BackupWrite = NULL; +t_SetFileAttributesA p_SetFileAttributesA = NULL; +t_SetFileAttributesW p_SetFileAttributesW = NULL; +t_BackupRead p_BackupRead = NULL; +t_BackupWrite p_BackupWrite = NULL; t_WideCharToMultiByte p_WideCharToMultiByte = NULL; t_MultiByteToWideChar p_MultiByteToWideChar = NULL; @@ -162,7 +157,7 @@ InitWinAPIWrapper() /* wopen */ p_wopen = (t_wopen) GetProcAddress(hLib, "_wopen"); - + FreeLibrary(hLib); } @@ -197,12 +192,12 @@ InitWinAPIWrapper() p_BackupRead = NULL; p_BackupWrite = NULL; - p_CreateFileW = NULL; - p_GetFileAttributesW = NULL; + p_CreateFileW = NULL; + p_GetFileAttributesW = NULL; p_GetFileAttributesExW = NULL; - + p_SetFileAttributesW = NULL; - + p_FindFirstFileW = NULL; p_FindNextFileW = NULL; p_SetCurrentDirectoryW = NULL; @@ -217,15 +212,15 @@ InitWinAPIWrapper() #ifdef WIN32_VSS switch (dwMinorVersion) { case 1: - g_pVSSClient = new VSSClientXP(); - atexit(VSSCleanup); - break; + g_pVSSClient = new VSSClientXP(); + atexit(VSSCleanup); + break; case 2: - g_pVSSClient = new VSSClient2003(); - atexit(VSSCleanup); - break; + g_pVSSClient = new VSSClient2003(); + atexit(VSSCleanup); + break; } -#endif +#endif /* WIN32_VSS */ } #endif diff --git a/bacula/src/tray-monitor/tray-monitor.c b/bacula/src/tray-monitor/tray-monitor.c index 9abc40098f..3917beaea1 100644 --- a/bacula/src/tray-monitor/tray-monitor.c +++ b/bacula/src/tray-monitor/tray-monitor.c @@ -566,18 +566,16 @@ static int authenticate_daemon(monitoritem* item, JCR *jcr) { switch (item->type) { case R_DIRECTOR: return authenticate_director(jcr, monitor, (DIRRES*)item->resource); - break; case R_CLIENT: return authenticate_file_daemon(jcr, monitor, (CLIENT*)item->resource); - break; case R_STORAGE: return authenticate_storage_daemon(jcr, monitor, (STORE*)item->resource); - break; default: printf("Error, currentitem is not a Client or a Storage..\n"); gtk_main_quit(); return FALSE; } + return false; } static gboolean blink(gpointer data) { diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index 8bb55bb3df..285786826a 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -85,11 +85,11 @@ cygwin_conv_to_win32_path(const char *name, char *win32_name, DWORD dwSize) from c:\bacula\uninstall.exe */ if (g_pVSSClient && enable_vss == 1) { - POOLMEM* pszBuf = get_pool_memory (PM_FNAME); - pszBuf = check_pool_memory_size(pszBuf, dwSize); - bstrncpy (pszBuf, tname, strlen(tname)+1); - g_pVSSClient->GetShadowPath(pszBuf,tname,dwSize); - free_pool_memory(pszBuf); + POOLMEM *pszBuf = get_pool_memory (PM_FNAME); + pszBuf = check_pool_memory_size(pszBuf, dwSize); + bstrncpy(pszBuf, tname, strlen(tname)+1); + g_pVSSClient->GetShadowPath(pszBuf, tname, dwSize); + free_pool_memory(pszBuf); } #endif } diff --git a/bacula/src/win32/compat/vss.cpp b/bacula/src/win32/compat/vss.cpp index cd62b8864d..e59e5e5ea2 100644 --- a/bacula/src/win32/compat/vss.cpp +++ b/bacula/src/win32/compat/vss.cpp @@ -113,7 +113,7 @@ BOOL VSSClient::InitializeForBackup() -BOOL VSSClient::GetShadowPath (const char* szFilePath, char* szShadowPath, int nBuflen) +BOOL VSSClient::GetShadowPath (const char *szFilePath, char *szShadowPath, int nBuflen) { if (!m_bBackupIsInitialized) return FALSE; @@ -129,15 +129,14 @@ BOOL VSSClient::GetShadowPath (const char* szFilePath, char* szShadowPath, int n if (bIsValidName) { int nDriveIndex = toupper(szFilePath[0])-'A'; if (m_szShadowCopyName[nDriveIndex][0] != 0) { - strncpy (szShadowPath, m_szShadowCopyName[nDriveIndex], nBuflen); - nBuflen -= (int) strlen (m_szShadowCopyName[nDriveIndex]); - strncat (szShadowPath, szFilePath+2,nBuflen); - + strncpy(szShadowPath, m_szShadowCopyName[nDriveIndex], nBuflen); + nBuflen -= (int)strlen(m_szShadowCopyName[nDriveIndex]); + strncat(szShadowPath, szFilePath+2, nBuflen); return TRUE; } } - strncpy (szShadowPath, szFilePath, nBuflen); + strncpy(szShadowPath, szFilePath, nBuflen); return FALSE; } diff --git a/bacula/src/win32/compat/vss.h b/bacula/src/win32/compat/vss.h index 42916e8e10..9f8a4c0ebf 100644 --- a/bacula/src/win32/compat/vss.h +++ b/bacula/src/win32/compat/vss.h @@ -46,6 +46,7 @@ public: const size_t GetWriterCount(); const char* GetWriterInfo(size_t nIndex); const int GetWriterState(size_t nIndex); + const BOOL IsInitialized() { return m_bBackupIsInitialized; }; private: virtual BOOL Initialize(DWORD dwContext, BOOL bDuringRestore = FALSE) = 0; diff --git a/bacula/src/win32/compat/vss_generic.cpp b/bacula/src/win32/compat/vss_generic.cpp index bbefe7c43f..f412f1c7ad 100644 --- a/bacula/src/win32/compat/vss_generic.cpp +++ b/bacula/src/win32/compat/vss_generic.cpp @@ -272,8 +272,7 @@ void VSSClientGeneric::WaitAndCheckForAsyncOperation(IVssAsync* pAsync) hr = pAsync->QueryStatus(&hrReturned, NULL); // Check if the async operation succeeded... - if(FAILED(hrReturned)) - { + if(FAILED(hrReturned)) { PWCHAR pwszBuffer = NULL; DWORD dwRet = ::FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER @@ -284,10 +283,7 @@ void VSSClientGeneric::WaitAndCheckForAsyncOperation(IVssAsync* pAsync) (LPWSTR)&pwszBuffer, 0, NULL); // No message found for this error. Just return - if (dwRet != 0) - { - // Convert the message into wstring - + if (dwRet != 0) { LocalFree(pwszBuffer); } } @@ -304,7 +300,7 @@ BOOL VSSClientGeneric::CreateSnapshots(char* szDriveLetters) m_uidCurrentSnapshotSet = GUID_NULL; - IVssBackupComponents* pVss = (IVssBackupComponents*) m_pVssObject; + IVssBackupComponents *pVss = (IVssBackupComponents*)m_pVssObject; // 1. InitializeForBackup HRESULT hr = pVss->InitializeForBackup(); diff --git a/bacula/src/wx-console/console_thread.cpp b/bacula/src/wx-console/console_thread.cpp index 1d1fc76f08..2d31762679 100644 --- a/bacula/src/wx-console/console_thread.cpp +++ b/bacula/src/wx-console/console_thread.cpp @@ -474,23 +474,22 @@ void* console_thread::Entry() { return NULL; } -void console_thread::Write(const char* str) { +void console_thread::Write(const char* str) +{ if (UA_sock) { UA_sock->msglen = strlen(str); pm_strcpy(&UA_sock->msg, str); bnet_send(UA_sock); - } - else if (choosingdirector) { - + } else if (choosingdirector) { // wxString number = str; // number.RemoveLast(); /* Removes \n */ long val; // if (number.ToLong(&val)) { - if (val = atol(str)) { + val = atol(str); + if (val) { directorchoosen = (int)val; - } - else { + } else { directorchoosen = 0; } } -- 2.39.5