From b25ef9f2850d93e5b8fd8f18878126b8336f7e3b Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 18 Dec 2004 10:27:32 +0000 Subject: [PATCH] - While using the rescue CDROM after my computer would not boot, I realized that it would be very useful to have a umount_disks. So, it is not implemented, along with updates to the READMEs and some minor tweaks. - Moved mounting the CDROM in the rescue boot from /cdrom to /mnt/cdrom (more standard location). - Reboot in CDROM rescue should now work -- requires -d option (no write) to work. - Hopefully fixed all the IPV6/4 problems and buffer problems with networking in lib. Bugs 190 and 204. Cleaned up a lot of #ifdefing problems by using routines in address_conf.c git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1763 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 9 ++++++- bacula/src/dird/verify.c | 2 +- bacula/src/lib/address_conf.c | 47 ++++++++++++++++++++++++++++++--- bacula/src/lib/address_conf.h | 8 ++++-- bacula/src/lib/bnet_server.c | 21 +++------------ bacula/src/stored/autochanger.c | 10 +++---- bacula/src/version.h | 4 +-- 7 files changed, 69 insertions(+), 32 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index ce2cc6e6d5..4d166b42ea 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -1,5 +1,5 @@ Kern's ToDo List - 08 December 2004 + 17 December 2004 Major development: Project Developer @@ -43,6 +43,9 @@ For 1.37: - Fix orphanned buffers: Orphaned buffer: 24 bytes allocated at line 808 of rufus-dir job.c Orphaned buffer: 40 bytes allocated at line 45 of rufus-dir alist.c +- Upgrade to MySQL 4.1.1 See: + http://dev.mysql.com/doc/mysql/en/Server_SQL_mode.html + Regression tests (Jo): - Add Pool/Storage override regression test. @@ -59,6 +62,10 @@ Regression tests (Jo): - Add database test to regression. Test each function like delete, purge, ... +- AntiVir can slow down backups on Win32 systems. +- Win32 systems with FAT32 can be much slower than NTFS for + more than 1000 files per directory. + 1.37 Possibilities: - Can one write tapes faster with 8192 byte block sizes? diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 5e02da4219..f239fa57b8 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -288,7 +288,7 @@ bool do_verify(JCR *jcr) level="disk_to_catalog"; break; default: - Jmsg2(jcr, M_FATAL, 0, _("Unimplemented save level %d(%c)\n"), jcr->JobLevel, + Jmsg2(jcr, M_FATAL, 0, _("Unimplemented Verify level %d(%c)\n"), jcr->JobLevel, jcr->JobLevel); goto bail_out; } diff --git a/bacula/src/lib/address_conf.c b/bacula/src/lib/address_conf.c index a1fe35a10c..9e655f380e 100644 --- a/bacula/src/lib/address_conf.c +++ b/bacula/src/lib/address_conf.c @@ -27,6 +27,12 @@ #include "bacula.h" +#ifdef HAVE_ARPA_NAMESER_H +#include +#endif +#ifdef HAVE_RESOLV_H +#include +#endif static int add_address(dlist **out, IPADDR::i_type type, unsigned short defaultport, int family, const char *hostname_str, const char *port_str, char **errstr); @@ -176,10 +182,14 @@ void IPADDR::set_addr6(struct in6_addr *ip6) const char *IPADDR::get_address(char *outputbuf, int outlen) { outputbuf[0] = '\0'; -#if defined(HAVE_INET_NTOP) && defined(HAVE_IPV6) +#ifdef HAVE_INET_NTOP +# ifdef HAVE_IPV6 inet_ntop(saddr->sa_family, saddr->sa_family == AF_INET ? (void*)&(saddr4->sin_addr) : (void*)&(saddr6->sin6_addr), outputbuf, outlen); +# else + inet_ntop(saddr->sa_family, (void*)&(saddr4->sin_addr), outputbuf, outlen); +# endif #else bstrncpy(outputbuf, inet_ntoa(saddr4->sin_addr), outlen); #endif @@ -538,17 +548,48 @@ int sockaddr_get_port_net_order(const struct sockaddr *client_addr) return -1; } -int sockaddr_to_ascii(const struct sockaddr *sa, char *buf, int len) +int sockaddr_get_port(const struct sockaddr *client_addr) +{ + if (client_addr->sa_family == AF_INET) { + return ntohs(((struct sockaddr_in *)client_addr)->sin_port); + } +#ifdef HAVE_IPV6 + else { + return ntohs(((struct sockaddr_in6 *)client_addr)->sin6_port); + } +#endif + return -1; +} + + +char *sockaddr_to_ascii(const struct sockaddr *sa, char *buf, int len) { #ifdef HAVE_INET_NTOP /* MA Bug 5 the problem was that i mixed up sockaddr and in_addr */ inet_ntop(sa->sa_family, +# ifdef HAVE_IPV6 sa->sa_family == AF_INET ? (void*)&(((struct sockaddr_in*)sa)->sin_addr) : (void*)&(((struct sockaddr_in6*)sa)->sin6_addr), +# else + (void*)&(((struct sockaddr_in*)sa)->sin_addr) : +# endif /* HAVE_IPV6 */ buf, len); #else bstrncpy(buf, inet_ntoa(((struct sockaddr_in *)sa)->sin_addr), len); #endif - return 1; + return buf; } + +#ifdef HAVE_OLD_SOCKOPT +int inet_aton(const char *cp, struct in_addr *inp) +{ + struct in_addr inaddr; + + if((inaddr.s_addr = inet_addr(cp)) != INADDR_NONE) { + inp->s_addr = inaddr.s_addr; + return 1; + } + return 0; +} +#endif diff --git a/bacula/src/lib/address_conf.h b/bacula/src/lib/address_conf.h index 9f618da1c5..42fe083d60 100644 --- a/bacula/src/lib/address_conf.h +++ b/bacula/src/lib/address_conf.h @@ -29,7 +29,7 @@ class IPADDR : public SMARTALLOC { public: typedef enum { R_SINGLE, R_SINGLE_PORT, R_SINGLE_ADDR, R_MULTIPLE, - R_DEFAULT, R_EMPTY + R_DEFAULT, R_EMPTY } i_type; IPADDR(int af); IPADDR(const IPADDR & src); @@ -87,4 +87,8 @@ extern int get_first_port_host_order(dlist * addrs); extern const char *build_addresses_str(dlist *addrs, char *buf, int blen); extern int sockaddr_get_port_net_order(const struct sockaddr *sa); -extern int sockaddr_to_ascii(const struct sockaddr *sa, char *buf, int len); +extern int sockaddr_get_port(const struct sockaddr *sa); +extern char *sockaddr_to_ascii(const struct sockaddr *sa, char *buf, int len); +#ifdef HAVE_OLD_SOCKOPT +extern int inet_aton(const char *cp, struct in_addr *inp); +#endif diff --git a/bacula/src/lib/bnet_server.c b/bacula/src/lib/bnet_server.c index 8d8cfbb15e..7a70051fa6 100644 --- a/bacula/src/lib/bnet_server.c +++ b/bacula/src/lib/bnet_server.c @@ -182,20 +182,10 @@ bnet_thread_server(dlist *addrs, int max_clients, workq_t *client_wq, fromhost(&request); if (!hosts_access(&request)) { V(mutex); -#ifndef HAVE_INET_NTOP Jmsg2(NULL, M_SECURITY, 0, _("Connection from %s:%d refused by hosts.access\n"), - inet_ntoa(((sockaddr_in *)&cli_addr)->sin_addr), - ntohs(((sockaddr_in *)&cli_addr)->sin_port)); -#else - Jmsg2(NULL, M_SECURITY, 0, - _("Connection from %s:%d refused by hosts.access\n"), - inet_ntop(clilen == sizeof(sockaddr_in) ? AF_INET : AF_INET6, - &clilen, buf, clilen), - ntohs(clilen == sizeof(sockaddr_in) ? - ((sockaddr_in *)&cli_addr)->sin_port : - ((sockaddr_in6 *)&cli_addr)->sin6_port)); -#endif + sockaddr_to_ascii(&cli_addr, buf, sizeof(buf)), + sockaddr_get_port(&cli_addr)); close(newsockfd); continue; } @@ -214,12 +204,7 @@ bnet_thread_server(dlist *addrs, int max_clients, workq_t *client_wq, /* see who client is. i.e. who connected to us. */ P(mutex); -#ifdef HAVE_INET_NTOP - inet_ntop(clilen == sizeof(sockaddr_in) ? AF_INET : AF_INET6, &clilen, - buf, sizeof(buf)); -#else - bstrncpy(buf, inet_ntoa(((sockaddr_in *)&cli_addr)->sin_addr), sizeof(buf)); /* NOT thread safe, use mutex */ -#endif + sockaddr_to_ascii(&cli_addr, buf, sizeof(buf)); V(mutex); BSOCK *bs; bs = init_bsock(NULL, newsockfd, "client", buf, fd_ptr->port, &cli_addr); diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 4c4aa2f90b..a9811c43e8 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -156,7 +156,7 @@ static int get_autochanger_loaded_slot(JCR *jcr) changer = edit_device_codes(jcr, changer, jcr->device->changer_command, "loaded"); status = run_program(changer, timeout, results); - Dmsg3(100, "run_prog: %s stat=%d result=%s\n", changer, status, results); + Dmsg3(50, "run_prog: %s stat=%d result=%s\n", changer, status, results); if (status == 0) { loaded = atoi(results); if (loaded > 0) { @@ -191,7 +191,7 @@ void invalid_slot_in_catalog(DCR *dcr) dcr->VolCatInfo.VolCatName, dcr->VolCatInfo.Slot); dcr->VolCatInfo.InChanger = false; dev->VolCatInfo.InChanger = false; - Dmsg0(100, "update vol info in mount\n"); + Dmsg0(400, "update vol info in mount\n"); dir_update_volume_info(dcr, true); /* set new status */ } @@ -291,7 +291,7 @@ char *edit_device_codes(JCR *jcr, char *omsg, const char *imsg, const char *cmd) char add[20]; *omsg = 0; - Dmsg1(400, "edit_device_codes: %s\n", imsg); + Dmsg1(800, "edit_device_codes: %s\n", imsg); for (p=imsg; *p; p++) { if (*p == '%') { switch (*++p) { @@ -341,9 +341,9 @@ char *edit_device_codes(JCR *jcr, char *omsg, const char *imsg, const char *cmd) add[1] = 0; str = add; } - Dmsg1(400, "add_str %s\n", str); + Dmsg1(900, "add_str %s\n", str); pm_strcat(&omsg, (char *)str); - Dmsg1(400, "omsg=%s\n", omsg); + Dmsg1(800, "omsg=%s\n", omsg); } return omsg; } diff --git a/bacula/src/version.h b/bacula/src/version.h index 10a0c89b5e..332a26409d 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #undef VERSION #define VERSION "1.37.1" -#define BDATE "17 December 2004" -#define LSMDATE "17Dec04" +#define BDATE "18 December 2004" +#define LSMDATE "18Dec04" /* Debug flags */ #undef DEBUG -- 2.39.5