From fb2bd066c2f8b34addafe48d62550e3033a59431 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 21 Oct 2008 01:56:05 +0200 Subject: [PATCH] Imported Upstream version 2.6.0p2 --- ChangeLog | 232 +++ Makefile.in | 1 + NEWS | 7 + aclocal.m4 | 1 + amandad-src/Makefile.in | 1 + amandad-src/amandad.c | 39 +- amplot/Makefile.in | 1 + changer-src/Makefile.in | 1 + changer-src/chg-disk.sh | 2 +- changer-src/chg-lib.sh.in | 25 +- changer-src/chg-zd-mtx.sh | 2 +- client-src/Makefile.am | 3 - client-src/Makefile.in | 47 +- client-src/sendsize.c | 6 +- common-src/Makefile.in | 1 + common-src/amanda.h | 37 +- common-src/bsd-security.c | 5 +- common-src/bsdtcp-security.c | 4 +- common-src/bsdudp-security.c | 2 +- common-src/conffile.c | 13 +- common-src/debug.c | 14 + common-src/dgram.c | 24 +- common-src/dgram.h | 4 +- common-src/genversion.h | 2 +- common-src/krb5-security.c | 6 +- common-src/security-util.c | 63 +- common-src/security-util.h | 10 +- common-src/sockaddr-util.c | 111 +- common-src/sockaddr-util.h | 125 +- common-src/stream.c | 46 +- common-src/svn-info.h | 2 +- common-src/util.c | 26 +- common-src/util.h | 6 +- common-src/version.h | 4 - common-src/versuff.c | 6 +- config/Makefile.in | 9 +- config/amanda/debugging.m4 | 17 + config/amanda/devprefix.m4 | 6 +- config/amanda/file-list | 1 + config/amanda/s3-device.m4 | 15 - config/amanda/socklen_t_equiv.m4 | 48 + config/config.h.in | 14 +- configure | 557 ++++++- configure.in | 7 +- device-src/Makefile.in | 1 + device-src/device.c | 54 +- device-src/device.h | 2 +- device-src/queueing.c | 6 + device-src/rait-device.c | 241 ++- device-src/s3-device.c | 3 +- device-src/s3.c | 39 +- device-src/tape-aix.c | 4 +- device-src/tape-device.c | 159 +- device-src/tape-ops.h | 2 +- device-src/tape-posix.c | 11 +- device-src/tape-uware.c | 8 +- device-src/tape-xenix.c | 8 +- device-src/tests/Makefile.in | 1 + device-src/tests/semaphore-test.c | 10 +- device-src/tests/vfs_test.c | 3 +- device-src/vfs-device.c | 14 +- dumper-src/Makefile.in | 1 + example/Makefile.in | 1 + gnulib/Makefile.in | 1 + installcheck/Amanda_Config.pl | 8 +- installcheck/Makefile.in | 1 + installcheck/amgetconf.pl | 14 +- man/Makefile.am | 32 +- man/Makefile.in | 27 +- man/amaddclient.8 | 6 +- man/amadmin.8 | 29 +- man/amaespipe.8 | 8 +- man/amanda-client.conf.5 | 6 +- man/amanda.8 | 34 +- man/amanda.conf.5 | 49 +- man/amanda.css | 48 + man/amcheck.8 | 19 +- man/amcheckdb.8 | 12 +- man/amcheckdump.8 | 8 +- man/amcleanup.8 | 15 +- man/amcrypt-ossl-asym.8 | 14 +- man/amcrypt-ossl.8 | 10 +- man/amcrypt.8 | 11 +- man/amcryptsimple.8 | 6 +- man/amdd.8 | 6 +- man/amdevcheck.8 | 6 +- man/amdump.8 | 20 +- man/amfetchdump.8 | 6 +- man/amflush.8 | 19 +- man/amgetconf.8 | 6 +- man/amgpgcrypt.8 | 10 +- man/amlabel.8 | 12 +- man/ammt.8 | 6 +- man/amoverview.8 | 9 +- man/amplot.8 | 6 +- man/amrecover.8 | 24 +- man/amreport.8 | 17 +- man/amrestore.8 | 6 +- man/amrmtape.8 | 9 +- man/amserverconfig.8 | 6 +- man/amstatus.8 | 16 +- man/amtape.8 | 6 +- man/amtapetype.8 | 6 +- man/amtoc.8 | 18 +- man/amverify.8 | 6 +- man/amverifyrun.8 | 6 +- man/index.php | 4 + man/xml-source/amanda.conf.5.xml | 3 - man/xml-source/amcheck.8.xml | 8 + man/xml-source/amdump.8.xml | 12 + man/xml-source/amflush.8.xml | 11 + man/xml-source/amreport.8.xml | 12 + man/xml-source/amstatus.8.xml | 11 + man/xml-source/amtoc.8.xml | 18 +- man/xslt/html.xsl.in | 31 + man/xslt/{man.xsl => man.xsl.in} | 8 +- oldrecover-src/Makefile.in | 1 + packaging/Makefile.in | 1 + packaging/deb/amanda-backup-client.postrm | 3 - packaging/deb/amanda-backup-server.postrm | 3 - packaging/deb/buildpkg | 2 +- packaging/deb/control | 7 +- packaging/deb/postrm | 2 +- packaging/deb/rules | 9 +- packaging/rpm/amanda.spec | 40 +- packaging/rpm/amanda.spec.orig | 1788 --------------------- packaging/rpm/amanda.spec.rej | 17 - packaging/rpm/buildpkg | 4 +- packaging/rpm/buildpkg.orig | 50 - packaging/rpm/buildpkg.rej | 17 - perl/Amanda/Changer.pm | 2 + perl/Amanda/Cmdline.pm | 2 +- perl/Amanda/Cmdline.swg | 2 +- perl/Amanda/Config.pm | 42 +- perl/Amanda/Config.swg | 42 +- perl/Amanda/Device.pm | 4 +- perl/Amanda/Device.swg | 4 +- perl/Amanda/Logfile.pm | 5 +- perl/Amanda/Logfile.swg | 5 +- perl/Amanda/Tapefile.pm | 11 + perl/Amanda/Tapefile.swg | 12 + perl/Amanda/Util.pm | 51 +- perl/Amanda/Util.swg | 51 +- perl/Makefile.am | 20 + perl/Makefile.in | 19 +- perl/amglue/bigint.c | 1 + po/Makefile.in | 1 + recover-src/Makefile.in | 1 + restore-src/Makefile.in | 1 + restore-src/amidxtaped.c | 6 +- server-src/Makefile.in | 1 + server-src/amadmin.c | 76 +- server-src/amindexd.c | 6 +- server-src/chunker.c | 2 +- server-src/driver.c | 49 +- server-src/reporter.c | 74 +- server-src/tapefile.c | 46 + server-src/tapefile.h | 1 + server-src/taper.c | 210 ++- tape-src/Makefile.in | 1 + 160 files changed, 2465 insertions(+), 3050 deletions(-) create mode 100644 config/amanda/socklen_t_equiv.m4 create mode 100644 man/amanda.css create mode 100644 man/index.php create mode 100644 man/xslt/html.xsl.in rename man/xslt/{man.xsl => man.xsl.in} (88%) delete mode 100644 packaging/rpm/amanda.spec.orig delete mode 100644 packaging/rpm/amanda.spec.rej delete mode 100755 packaging/rpm/buildpkg.orig delete mode 100644 packaging/rpm/buildpkg.rej diff --git a/ChangeLog b/ChangeLog index 42929cf..e671971 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,235 @@ +2008-08-22 Jean-Louis Martineau + * configure.in, packaging/deb/rules, + packaging/deb/buildpkg, packaging/rpm/buildpkg, + packaging/rpm/amanda.spec: Change release to 2.6.0p2 + * NEWS: News in 2.6.0p2 + +2008-08-22 Dustin J. Mitchell + * perl/amglue/bigint.c: add #include "stdint.h" + +2008-08-22 Jean-Louis Martineau + * server-src/amadmin.c (tape): Correctly print next tape to use. + * server-src/tapefile.c (print_new_tapes): New function to print new + tapes. + * server-src/tapefile.h (print_new_tapes): Prototype. + * server-src/reporter.c: Correctly print next tape to use. + +2008-08-22 Dustin J. Mitchell + Thanks to Stefan G. Weichinger + * server-src/taper.c: check errors from device, and handle them by + either requesting a new tape or just using the next tape in the + changer + +2008-08-22 Olivier Nicole + * changer-src/chg-disk.sh: replace == with = + +2008-08-22 Dustin J. Mitchell + * changer-src/chg-lib.sh.in: fix sed invocation for BSD's sed + +2008-08-22 Jean-Louis Martineau + * server-src/reporter.c: Fix computation of compression ratio. + +2008-08-21 Jean-Louis Martineau + * common-src/krb5-security.c: Fix security_seterror use. + +2008-08-21 Jean-Louis Martineau + * device-src/queueing.c: Fix compiler warning. + +2008-08-19 Dustin J. Mitchell + * configure.in: check for getgrgid_r and getpwuid_r + * common-src/security-util.c: conditionalize on checks + +2008-08-18 Dustin J. Mitchell + * common-src/version.h: remove #include of config.h + * device-src/vfs-device.c: #include amanda.h first + +2008-08-15 Dustin J. Mitchell + * common-src/debug.c: include backtraces on fatal errors + * config/amanda/debugging.m4: look for glibc's backtrace support + * configure.in: ditto + +2008-08-05 Dan Locks + * packaging/rpm/amanda.spec: Merged fixes from trunk .spec for + parsing redhat-release for fedora versions correctly. + +2008-08-04 Dan Locks + * packaging/rpm/amanda.spec: add %{tarver} macro and set the correct + minimum version per distro (Thanks to Jesse Angell for the rhel4 tip) + +2008-07-30 Dustin J. Mitchell + * perl/Amanda/Changer.pm perl/Amanda/Cmdline.swg + perl/Amanda/Config.swg perl/Amanda/DB/Catalog.pm + perl/Amanda/Device.swg perl/Amanda/Logfile.swg + perl/Amanda/Util.swg: POD cleanup + * perl/Makefile.am: new files, rules to make HTML + * perl/amperl.css: CSS file for online POD + * perl/make_html.pl: make online POD + +2008-07-30 Dustin J. Mitchell + * man/Makefile.am man/amanda.css man/index.php man/xslt/html.xsl.in: + new files for HTML output + * man/xslt/man.xsl.in: substitute XSLT_VERS + * man/xml-source/amanda-devices.7.xml: tweaks + * man/xml-source/amanda.8.xml: tweaks + * man/xml-source/amanda.conf.5.xml: tweaks + * man/xml-source/amgetconf.8.xml: tweaks + * man/xml-source/amtoc.8.xml: tweaks + +2008-07-30 Dan Locks + * packaging/rpm/amanda.spec: removed activate-devpay from %files section + +2008-07-30 Dan Locks + * device-src/s3.c: Merged changes from 968 to work around a libcurl bug. + * config/amanda/s3-device.m4: Same + +2008-07-30 Dustin J. Mitchell + * installcheck/Amanda_Config.pl: add + to avoid perl-5.6.0 parsing bug + * installcheck/amgetconf.pl: ditto + +2008-07-28 Dustin J. Mitchell + * client-src/sendsize.c: remove cruft causing compile errors on HP/UX + +2008-07-28 Dustin J. Mitchell + * device-src/tests/semaphore-test.c: move function call out of + variable initialization + +2008-07-25 Dan Locks + * packaging/deb/control: added alternative dependency of libssl0.9.8 for + Ubuntu 8.x builds. Added build dependencies for debhelper, fakeroot, + libcurl-dev, libssl-dev. Updated server and client dependency for curl + to libcurl3 + +2008-07-23 Dustin J. Mitchell + * common-src/conffile.c: fix handling for config overwrites of + non-string parameters + +2008-07-17 Jean-Louis Martineau + * amandad-src/amandad.c: amandad must be run by root for krb5 auth. + +200i-07-14 Dan Locks + * packaging/rpm/amanda.spec: fix distribution detection, add + activate-devpay to server files list + +2008-07-11 Dustin J. Mitchell + * device-src/rait-device.c: fix RAIT file numbers; don't pass + block-size-related properties down to child devices (we set the block + size in find_block_size); don't use union_robust for checking whether + labels changed, as it causes spurious failures + +2008-07-11 Dustin J. Mitchell + Thanks to Stefan G. Weichinger + * device-src/tape-*.c: return DEVICE_ERROR|VOLUME_MISSING on EIO while + checking tape_is_tape_device + * changer-src/chg-lib.sh.in: keep waiting for a device if it *might* + be busy or offline + +2008-07-09 Dustin J. Mitchell + * device-src/rait-device.c: rewrite g_ptr_array_union_robust to + correctly detect and handle child device failures + +2008-07-09 Dustin J. Mitchell + * perl/Amanda/Logfile.swg: POD tweaks + +2008-07-06 Dan Locks + * packaging/deb/amanda-backup-server.postrm + packaging/deb/amanda-backup-client.postrm: removed unused + code + * packaging/deb/postrm: fixed typo in deluser command + * packaging/deb/rules: added specific preinst and postrm scripts for + client and server. + +2008-07-04 Dan Locks + * packaging/rpm/buildpkg: add lines to copy rpms to root of the build dir. + +2008-06-30 Ian Turner + * device-src/rait-device.c: Fix a memory corruption issue on the last + block of a file. + * device-src/rait-device.c: Track file numbers properly when child + devices change them (that is, in rait_device_start_file() and + rait_device_seek_file()). + +2008-06-27 Ian Turner + * device-src/rait-device.c (rait_device_start): Check for consistent + volume label on all child devices, otherwise fail + +2008-06-27 Ian Turner + * device-src/rait-device.c: Silence a compiler warning. + +2008-06-27 Dustin J. Mitchell + * device-src/rait-device.c: hack around glib bug in versions <2.10.2 + +2008-06-09 Dustin J. Mitchell + * common-src/conffile.c: don't complain about a missing client conf + file, as the complaint interferes with the network communication + ("invalid size: could not open conf file") + +2008-06-06 Dustin J. Mitchell + * device-src/*: bugfixes backported from trunk r1087 + - device_read_block returns an int, not a gboolean, and sets in_file + = FALSE on EOF + - tape device only requires a label in READ and APPEND modes + - tape device isn't opened until start or read_label + - rait sets self->file correctly in start + - rait compares child devices' labels and times correctly + - vfs correctly chains up in property_get + - vfs sets self->file correctly in start with ACCESS_APPEND + +2008-06-03 Jean-Louis Martineau + * man/xml-source/amdump.8.xml, man/xml-source/amreport.8.xml, + man/xml-source/amcheck.8.xml, man/xml-source/amflush.8.xml, + man/xml-source/amstatus.8.xml: Add "EXIT CODE" section". + +2008-05-30 Jean-Louis Martineau + * common-src/security-util.c: Remove unneeded pointer cast. + * common-src/stream.c: Fix compiler error. + +2008-05-30 Dustin J. Mitchell + * common-src/amanda.h, common-src/bsd-security.c, + common-src/bsdtcp-security.c, common-src/bsdudp-security.c, + common-src/dgram.c, common-src/dgram.h, common-src/krb5-security.c, + common-src/security-util.c, common-src/security-util.h, + common-src/sockaddr-util.c, common-src/sockaddr-util.h, + common-src/stream.c, common-src/util.c, common-src/util.h, + restore-src/amidxtaped.c, server-src/amindexd.c: add sockaddr_union, + change all relevant functions to use it, to avoid aliasing violations + +2008-05-29 Orion Poplawski + * device-src/tests/semaphore-test.c: fix call to amanda_thread_init + * device-src/tests/vfs_test.c: fix call to amanda_thread_init + * server-src/chunker.c: fix buffer overrun + +2008-05-29 Jean-Louis Martineau + * common-src/conffile.c (client_keytab): Remove "DEVICE-PROPERTY". + +2008-05-28 Dustin J. Mitchell + * device-src/rait-device.c: rait-device returns correct size when + blocksize is too small + +2008-05-25 Jean-Louis Martineau + * changer-src/chg-zd-mtx.sh: Fix logging. + +2008-05-25 Jean-Louis Martineau + * packaging/rpm/amanda.spec: Fix output message. + +2008-05-21 Jean-Louis Martineau + * server-src/driver.c: Fix quoting of diskname. + +2008-05-20 Dustin J. Mitchell + * configure.in config/amanda/socklen_t_equiv.m4: detect the type (not + necessarily socklen_t used by getpeername et al. + * amandad-src/amandad.c server-src/amindexd.c restore-src/amidxtaped.c + common-src/util.c common-src/bsdtcp-security.c common-src/amanda.h + common-src/krb5-security.c common-src/dgram.c common-src/stream.c: + use the type instead of socklen_t + +2008-05-14 Dustin J. Mitchell + * client-src/amhpfixdevs.sh client-src/Makefile.am + client-src/amsinixfixdevs.sh config/amanda/devprefix.m4: + permanently remove amsinixfixdevs and amhpfixdevs + +2008-05-16 Jean-Louis Martineau + * common-src/conffile.c: Fix conf_parserror use. + 2008-05-13 Dan Locks * packaging/deb/buildpkg: modified build script to create unsigned packages diff --git a/Makefile.in b/Makefile.in index 7119e18..ac65c5e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -83,6 +83,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/NEWS b/NEWS index 88b0c32..a039ad8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +Changes in release 2.6.0p2 + + * Bugs fix only: + o Various device-api fix + o Compilation on various platform + o others small fixes. + Changes in release 2.6.0p1 * Bugs fix only: diff --git a/aclocal.m4 b/aclocal.m4 index 89cd353..09703f0 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1287,6 +1287,7 @@ m4_include([config/amanda/readline.m4]) m4_include([config/amanda/rsh-security.m4]) m4_include([config/amanda/s3-device.m4]) m4_include([config/amanda/shmem.m4]) +m4_include([config/amanda/socklen_t_equiv.m4]) m4_include([config/amanda/ssh-security.m4]) m4_include([config/amanda/summary.m4]) m4_include([config/amanda/swig.m4]) diff --git a/amandad-src/Makefile.in b/amandad-src/Makefile.in index 3959987..489ef14 100644 --- a/amandad-src/Makefile.in +++ b/amandad-src/Makefile.in @@ -125,6 +125,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/amandad-src/amandad.c b/amandad-src/amandad.c index ca3bde9..430f2b7 100644 --- a/amandad-src/amandad.c +++ b/amandad-src/amandad.c @@ -218,7 +218,15 @@ main( config_init(CONFIG_INIT_CLIENT, NULL); - check_running_as(RUNNING_AS_CLIENT_LOGIN); + if (geteuid() == 0) { + check_running_as(RUNNING_AS_ROOT); + initgroups(CLIENT_LOGIN, get_client_gid()); + setgid(get_client_gid()); + setegid(get_client_gid()); + seteuid(get_client_uid()); + } else { + check_running_as(RUNNING_AS_CLIENT_LOGIN); + } erroutput_type = (ERR_INTERACTIVE|ERR_SYSLOG); @@ -290,7 +298,7 @@ main( } #ifdef USE_REUSEADDR r = setsockopt(in, SOL_SOCKET, SO_REUSEADDR, - (void *)&on, (socklen_t)sizeof(on)); + (void *)&on, (socklen_t_equiv)sizeof(on)); if (r < 0) { dbprintf(_("amandad: setsockopt(SO_REUSEADDR) failed: %s\n"), strerror(errno)); @@ -306,7 +314,7 @@ main( sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = (in_port_t)htons((in_port_t)atoi(argv[i])); #endif - if (bind(in, (struct sockaddr *)&sin, (socklen_t)sizeof(sin)) < 0) { + if (bind(in, (struct sockaddr *)&sin, (socklen_t_equiv)sizeof(sin)) < 0) { error(_("can't bind to port %d: %s\n"), atoi(argv[i]), strerror(errno)); /*NOTREACHED*/ @@ -322,7 +330,7 @@ main( struct sockaddr_in sin; #endif int sock; - socklen_t n; + socklen_t_equiv n; argv[i] += strlen("-tcp="); #ifdef WORKING_IPV6 @@ -336,7 +344,7 @@ main( } #ifdef USE_REUSEADDR r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (void *)&on, (socklen_t)sizeof(on)); + (void *)&on, (socklen_t_equiv)sizeof(on)); if (r < 0) { dbprintf(_("amandad: setsockopt(SO_REUSEADDR) failed: %s\n"), strerror(errno)); @@ -351,13 +359,13 @@ main( sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = (in_port_t)htons((in_port_t)atoi(argv[i])); #endif - if (bind(sock, (struct sockaddr *)&sin, (socklen_t)sizeof(sin)) < 0) { + if (bind(sock, (struct sockaddr *)&sin, (socklen_t_equiv)sizeof(sin)) < 0) { error(_("can't bind to port %d: %s\n"), atoi(argv[i]), strerror(errno)); /*NOTREACHED*/ } listen(sock, 10); - n = (socklen_t)sizeof(sin); + n = (socklen_t_equiv)sizeof(sin); in = out = accept(sock, (struct sockaddr *)&sin, &n); } /* @@ -409,6 +417,18 @@ main( exit_on_qlength = 1; } + if (getuid() == 0) { + if (strcasecmp(auth, "krb5") != 0) { + error(_("Amanda must be run as user '%s' when using '%s' authetication"), + CLIENT_LOGIN, auth); + } + } else { + if (strcasecmp(auth, "krb5") == 0) { + error(_("Amanda must be run as user 'root' when using 'krb5' authetication")); + } + } + + /* initialize */ startclock(); @@ -422,6 +442,11 @@ main( dbprintf(_("WARNING: argv[0] not defined: check inetd.conf\n")); } + /* krb5 require the euid to be 0 */ + if (strcasecmp(auth, "krb5") == 0) { + seteuid((uid_t)0); + } + /* * Schedule to call protocol_accept() when new security handles * are created on stdin. diff --git a/amplot/Makefile.in b/amplot/Makefile.in index cf7bc5e..f2e6b09 100644 --- a/amplot/Makefile.in +++ b/amplot/Makefile.in @@ -206,6 +206,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/changer-src/Makefile.in b/changer-src/Makefile.in index 65dad19..fb70087 100644 --- a/changer-src/Makefile.in +++ b/changer-src/Makefile.in @@ -218,6 +218,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/changer-src/chg-disk.sh b/changer-src/chg-disk.sh index d876584..bdce74a 100644 --- a/changer-src/chg-disk.sh +++ b/changer-src/chg-disk.sh @@ -83,7 +83,7 @@ fi MYNAME=$0 TAPE=`amgetconf$SUF tapedev` -if test X"$TAPE" == X""; then +if test X"$TAPE" = X""; then echo `_ ' tapedev not specified in amanda.conf.'` exit 2 fi diff --git a/changer-src/chg-lib.sh.in b/changer-src/chg-lib.sh.in index 7ed4e5a..791154c 100644 --- a/changer-src/chg-lib.sh.in +++ b/changer-src/chg-lib.sh.in @@ -95,15 +95,24 @@ tape_device_filename() { # on device status, since some devices can't differentiate between device # problems and an unlabeled volume. amdevcheck_status() { - amdevcheck_config_dir=`pwd` - amdevcheck_config_name=`basename $amdevcheck_config_dir` - amdevcheck_output=`amdevcheck $amdevcheck_config_name $@` - - if test $? -eq 0 || \ - echo $amdevcheck_output | grep UNLABELED > /dev/null; then - return 0 + amdevcheck_message= + local amdevcheck_config_dir=`pwd` + local amdevcheck_config_name=`basename $amdevcheck_config_dir` + local amdevcheck_output=`amdevcheck $amdevcheck_config_name $@` + local amdevcheck_status=$? + + test "$amdevcheck_status" -ne 0 && return 0 + + # extract any messages + amdevcheck_message=`echo "$amdevcheck_output" | sed '/^MESSAGE /{s/^MESSAGE //;p;}; d'` + + # Return 1 if it's possible that the device is offline or busy; if the device cannot + # distinguish this state from an error condition, then our caller will just have to + # time out + if echo "$amdevcheck_output" | $EGREP "VOLUME_MISSING" > /dev/null; then + return 1 else - return 1 + return 0 fi } diff --git a/changer-src/chg-zd-mtx.sh b/changer-src/chg-zd-mtx.sh index 1588c2e..464c075 100644 --- a/changer-src/chg-zd-mtx.sh +++ b/changer-src/chg-zd-mtx.sh @@ -385,7 +385,7 @@ Exit() { ### Run() { - Log `_ 'Running: %s' "$@"` + Log `_ 'Running: %s' "$*"` rm -f $stdout $stderr "$@" > $stdout 2> $stderr exitcode=$? diff --git a/client-src/Makefile.am b/client-src/Makefile.am index fa768ce..e21b7bb 100644 --- a/client-src/Makefile.am +++ b/client-src/Makefile.am @@ -20,9 +20,6 @@ amlib_LTLIBRARIES = libamclient.la amlibexec_PROGRAMS = noop calcsize killpgrp rundump runtar selfcheck sendbackup sendsize versionsuffix -sbin_SCRIPTS = @CLIENT_SCRIPTS_OPT@ -EXTRA_SCRIPTS = amhpfixdevs amsinixfixdevs - amlibexec_SCRIPTS = patch-system CHECK_PERL = $(sbin_SCRIPTS) diff --git a/client-src/Makefile.in b/client-src/Makefile.in index 4864f2b..e830366 100644 --- a/client-src/Makefile.in +++ b/client-src/Makefile.in @@ -217,6 +217,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ @@ -294,7 +295,7 @@ am__vpath_adj = case $$p in \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)" \ - "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(sbindir)" + "$(DESTDIR)$(amlibexecdir)" amlibLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(amlib_LTLIBRARIES) libamclient_la_DEPENDENCIES = ../common-src/libamanda.la @@ -372,8 +373,7 @@ versionsuffix_DEPENDENCIES = ../common-src/libamanda.la libamclient.la \ ../amandad-src/libamandad.la ../common-src/libamanda.la \ ../gnulib/libgnu.la amlibexecSCRIPT_INSTALL = $(INSTALL_SCRIPT) -sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(amlibexec_SCRIPTS) $(sbin_SCRIPTS) +SCRIPTS = $(amlibexec_SCRIPTS) DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles @@ -825,8 +825,6 @@ AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS) LINT = $(AMLINT) LINTFLAGS = $(AMLINTFLAGS) amlib_LTLIBRARIES = libamclient.la -sbin_SCRIPTS = @CLIENT_SCRIPTS_OPT@ -EXTRA_SCRIPTS = amhpfixdevs amsinixfixdevs amlibexec_SCRIPTS = patch-system CHECK_PERL = $(sbin_SCRIPTS) SCRIPTS_PERL = $(CHECK_PERL) @@ -1004,25 +1002,6 @@ uninstall-amlibexecSCRIPTS: echo " rm -f '$(DESTDIR)$(amlibexecdir)/$$f'"; \ rm -f "$(DESTDIR)$(amlibexecdir)/$$f"; \ done -install-sbinSCRIPTS: $(sbin_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" - @list='$(sbin_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ - $(sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \ - else :; fi; \ - done - -uninstall-sbinSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(sbin_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ - rm -f "$(DESTDIR)$(sbindir)/$$f"; \ - done mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -1158,7 +1137,7 @@ check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(sbindir)"; do \ + for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(amlibexecdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -1220,8 +1199,7 @@ install-data-am: install-amlibLTLIBRARIES install-dvi: install-dvi-am -install-exec-am: install-amlibexecPROGRAMS install-amlibexecSCRIPTS \ - install-sbinSCRIPTS +install-exec-am: install-amlibexecPROGRAMS install-amlibexecSCRIPTS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook @@ -1256,7 +1234,7 @@ ps: ps-am ps-am: uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \ - uninstall-amlibexecSCRIPTS uninstall-sbinSCRIPTS + uninstall-amlibexecSCRIPTS .MAKE: install-am install-data-am install-exec-am install-strip @@ -1270,13 +1248,12 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \ install-data-hook install-dvi install-dvi-am install-exec \ install-exec-am install-exec-hook install-html install-html-am \ install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-sbinSCRIPTS \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \ - uninstall-amlibexecSCRIPTS uninstall-sbinSCRIPTS + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-amlibLTLIBRARIES \ + uninstall-amlibexecPROGRAMS uninstall-amlibexecSCRIPTS # Perl diff --git a/client-src/sendsize.c b/client-src/sendsize.c index 97b2857..4a335b7 100644 --- a/client-src/sendsize.c +++ b/client-src/sendsize.c @@ -1087,7 +1087,7 @@ getsize_dump( char *disk, char *amdevice, int level, - option_t *options, + option_t *options G_GNUC_UNUSED, char **errmsg) { int pipefd[2], nullfd, stdoutfd, killctl[2]; @@ -1112,10 +1112,6 @@ getsize_dump( int is_rundump = 1; #endif - (void)options; /* Quiet unused parameter warning */ - - (void)getsize_smbtar; /* Quiet unused parameter warning */ - g_snprintf(level_str, SIZEOF(level_str), "%d", level); device = amname_to_devname(amdevice); diff --git a/common-src/Makefile.in b/common-src/Makefile.in index 4e5b8a9..b88a973 100644 --- a/common-src/Makefile.in +++ b/common-src/Makefile.in @@ -224,6 +224,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/common-src/amanda.h b/common-src/amanda.h index 886e115..9aa3d6a 100644 --- a/common-src/amanda.h +++ b/common-src/amanda.h @@ -302,12 +302,6 @@ struct iovec { #include #endif -/* Support for missing IPv6 components */ -#ifndef HAVE_SOCKADDR_STORAGE -# define sockaddr_storage sockaddr_in -# define ss_family sin_family -#endif - #ifdef WORKING_IPV6 #define INET6 #endif @@ -420,6 +414,21 @@ extern int errno; #define MAX_TAPE_LABEL_BUF (MAX_TAPE_LABEL_LEN+1) #define MAX_TAPE_LABEL_FMT "%10240s" +/* Unfortunately, the system-level sockaddr_storage definition can lead to + * C aliasing errors (where the optimizer doesn't notice that two operations + * affect the same datum). We define our own similar type as a union. + */ +typedef union sockaddr_union { + struct sockaddr sa; + struct sockaddr_in sin; +#ifdef WORKING_IPV6 + struct sockaddr_in6 sin6; +#endif +#ifdef HAVE_SOCKADDR_STORAGE + struct sockaddr_storage ss; /* not used; just here to make the union full-size */ +#endif +} sockaddr_union; + #include "debug.h" #include "file.h" @@ -712,7 +721,7 @@ time_t unctime(char *timestr); /* from old bsd-security.c */ extern int debug; -extern int check_security(struct sockaddr_storage *, char *, unsigned long, char **); +extern int check_security(sockaddr_union *, char *, unsigned long, char **); /* * Handle functions which are not always declared on all systems. This @@ -721,7 +730,7 @@ extern int check_security(struct sockaddr_storage *, char *, unsigned long, char /* AIX #defines accept, and provides a prototype for the alternate name */ #if !defined(HAVE_ACCEPT_DECL) && !defined(accept) -extern int accept(int s, struct sockaddr *addr, socklen_t *addrlen); +extern int accept(int s, struct sockaddr *addr, socklen_t_equiv *addrlen); #endif #ifndef HAVE_ATOF_DECL @@ -737,7 +746,7 @@ extern void bcopy(const void *s1, void *s2, size_t n); #endif #ifndef HAVE_BIND_DECL -extern int bind(int s, const struct sockaddr *name, socklen_t namelen); +extern int bind(int s, const struct sockaddr *name, socklen_t_equiv namelen); #endif #ifndef HAVE_BZERO @@ -753,7 +762,7 @@ extern void closelog(void); #endif #ifndef HAVE_CONNECT_DECL -extern int connect(int s, struct sockaddr *name, socklen_t namelen); +extern int connect(int s, struct sockaddr *name, socklen_t_equiv namelen); #endif #ifndef HAVE_FCLOSE_DECL @@ -800,17 +809,17 @@ extern int getopt(int argc, char * const *argv, const char *optstring); /* AIX #defines getpeername, and provides a prototype for the alternate name */ #if !defined(HAVE_GETPEERNAME_DECL) && !defined(getpeername) -extern int getpeername(int s, struct sockaddr *name, socklen_t *namelen); +extern int getpeername(int s, struct sockaddr *name, socklen_t_equiv *namelen); #endif /* AIX #defines getsockname, and provides a prototype for the alternate name */ #if !defined(HAVE_GETSOCKNAME_DECL) && !defined(getsockname) -extern int getsockname(int s, struct sockaddr *name, socklen_t *namelen); +extern int getsockname(int s, struct sockaddr *name, socklen_t_equiv *namelen); #endif #ifndef HAVE_GETSOCKOPT_DECL extern int getsockopt(int s, int level, int optname, char *optval, - socklen_t *optlen); + socklen_t_equiv *optlen); #endif #ifndef HAVE_INITGROUPS @@ -898,7 +907,7 @@ extern void *realloc(void *ptr, size_t size); /* AIX #defines recvfrom, and provides a prototype for the alternate name */ #if !defined(HAVE_RECVFROM_DECL) && !defined(recvfrom) extern int recvfrom(int s, char *buf, int len, int flags, - struct sockaddr *from, socklen_t *fromlen); + struct sockaddr *from, socklen_t_equiv *fromlen); #endif #ifndef HAVE_REMOVE_DECL diff --git a/common-src/bsd-security.c b/common-src/bsd-security.c index 8953f1f..4be7948 100644 --- a/common-src/bsd-security.c +++ b/common-src/bsd-security.c @@ -37,6 +37,7 @@ #include "packet.h" #include "security.h" #include "security-util.h" +#include "sockaddr-util.h" #include "stream.h" #include "version.h" @@ -277,7 +278,7 @@ bsd_connect( handle=alloc(15); g_snprintf(handle, 14, "000-%08x", (unsigned)newhandle++); if (udp_inithandle(bh->udp, bh, canonname, - (struct sockaddr_storage *)res_addr->ai_addr, port, handle, sequence) < 0) { + (sockaddr_union *)res_addr->ai_addr, port, handle, sequence) < 0) { (*fn)(arg, &bh->sech, S_ERROR); amfree(bh->hostname); amfree(bh); @@ -387,7 +388,7 @@ bsd_stream_server( bs = alloc(SIZEOF(*bs)); security_streaminit(&bs->secstr, &bsd_security_driver); - bs->socket = stream_server(bh->udp->peer.ss_family, &bs->port, + bs->socket = stream_server(SU_GET_FAMILY(&bh->udp->peer), &bs->port, (size_t)STREAM_BUFSIZE, (size_t)STREAM_BUFSIZE, 0); if (bs->socket < 0) { diff --git a/common-src/bsdtcp-security.c b/common-src/bsdtcp-security.c index 3c2e84b..50985d9 100644 --- a/common-src/bsdtcp-security.c +++ b/common-src/bsdtcp-security.c @@ -197,8 +197,8 @@ bsdtcp_accept( void (*fn)(security_handle_t *, pkt_t *), void *datap) { - struct sockaddr_storage sin; - socklen_t len; + sockaddr_union sin; + socklen_t_equiv len; struct tcp_conn *rc; char hostname[NI_MAXHOST]; int result; diff --git a/common-src/bsdudp-security.c b/common-src/bsdudp-security.c index 2ae9e4e..d424320 100644 --- a/common-src/bsdudp-security.c +++ b/common-src/bsdudp-security.c @@ -261,7 +261,7 @@ bsdudp_connect( handle=alloc(15); g_snprintf(handle,14,"000-%08x", newhandle++); if (udp_inithandle(bh->udp, bh, canonname, - (struct sockaddr_storage *)res_addr->ai_addr, port, + (sockaddr_union *)res_addr->ai_addr, port, handle, sequence) < 0) { (*fn)(arg, &bh->sech, S_ERROR); amfree(bh->hostname); diff --git a/common-src/conffile.c b/common-src/conffile.c index b254845..18afa9e 100644 --- a/common-src/conffile.c +++ b/common-src/conffile.c @@ -582,7 +582,6 @@ keytab_t client_keytab[] = { { "INDEX_SERVER", CONF_INDEX_SERVER }, { "TAPE_SERVER", CONF_TAPE_SERVER }, { "TAPEDEV", CONF_TAPEDEV }, - { "DEVICE-PROPERTY", CONF_DEVICE_PROPERTY }, { "AUTH", CONF_AUTH }, { "SSH_KEYS", CONF_SSH_KEYS }, { "AMANDAD_PATH", CONF_AMANDAD_PATH }, @@ -1388,8 +1387,14 @@ read_conffile( current_filename = config_dir_relative(filename); if ((current_file = fopen(current_filename, "r")) == NULL) { - g_fprintf(stderr, _("could not open conf file \"%s\": %s\n"), current_filename, + /* client conf files are optional, and this fprintf ends up sending this message back + * to the server without proper auth encapsulation, leading to "invalid size: could not + * open .." This is fixed in TRUNK by completely rewriting this module's error-handling + * code. */ + if (!is_client) { + g_fprintf(stderr, _("could not open conf file \"%s\": %s\n"), current_filename, strerror(errno)); + } got_parserror = TRUE; goto finish; } @@ -1573,7 +1578,7 @@ read_block( if(np->token == tok) break; if(np->token == CONF_UNKNOWN) - conf_parserror(errormsg); + conf_parserror("%s", errormsg); else { np->read_function(np, &valarray[np->parm]); if(np->validate_function) @@ -3962,7 +3967,7 @@ apply_config_overwrites( if (key_parm->type == CONFTYPE_STR) { current_line = vstralloc("\"", value, "\"", NULL); } else { - current_line = stralloc(""); + current_line = stralloc(value); } current_char = current_line; diff --git a/common-src/debug.c b/common-src/debug.c index a6de415..ed036e4 100644 --- a/common-src/debug.c +++ b/common-src/debug.c @@ -37,6 +37,10 @@ #include "timestamp.h" #include "conffile.h" +#ifdef HAVE_GLIBC_BACKTRACE +#include +#endif + /* Minimum file descriptor on which to keep the debug file. This is intended * to keep the descriptor "out of the way" of other processing. It's not clear * that this is required any longer, but it doesn't hurt anything. @@ -159,6 +163,16 @@ debug_logging_handler(const gchar *log_domain G_GNUC_UNUSED, fflush(stderr); } +#ifdef HAVE_GLIBC_BACKTRACE + /* try logging a traceback to the debug log */ + if (db_fd != -1) { + void *stack[32]; + int naddrs; + naddrs = backtrace(stack, sizeof(stack)/sizeof(*stack)); + backtrace_symbols_fd(stack, naddrs, db_fd); + } +#endif + /* we're done */ if (log_level & G_LOG_LEVEL_CRITICAL) exit(error_exit_status); diff --git a/common-src/dgram.c b/common-src/dgram.c index 338baa8..7fbabb0 100644 --- a/common-src/dgram.c +++ b/common-src/dgram.c @@ -57,8 +57,8 @@ dgram_bind( in_port_t * portp) { int s, retries; - socklen_t len; - struct sockaddr_storage name; + socklen_t_equiv len; + sockaddr_union name; int save_errno; int *portrange; @@ -79,8 +79,8 @@ dgram_bind( return -1; } - SS_INIT(&name, family); - SS_SET_INADDR_ANY(&name); + SU_INIT(&name, family); + SU_SET_INADDR_ANY(&name); /* * If a port range was specified, we try to get a port in that @@ -117,7 +117,7 @@ dgram_bind( out: /* find out what name was actually used */ - len = (socklen_t)sizeof(name); + len = (socklen_t_equiv)sizeof(name); if(getsockname(s, (struct sockaddr *)&name, &len) == -1) { save_errno = errno; dbprintf(_("dgram_bind: getsockname() failed: %s\n"), strerror(save_errno)); @@ -125,7 +125,7 @@ out: aclose(s); return -1; } - *portp = SS_GET_PORT(&name); + *portp = SU_GET_PORT(&name); dgram->socket = s; dbprintf(_("dgram_bind: socket %d bound to %s\n"), @@ -136,7 +136,7 @@ out: int dgram_send_addr( - struct sockaddr_storage *addr, + sockaddr_union *addr, dgram_t * dgram) { int s, rc; @@ -158,7 +158,7 @@ dgram_send_addr( s = dgram->socket; socket_opened = 0; } else { - if((s = socket(addr->ss_family, SOCK_DGRAM, 0)) == -1) { + if((s = socket(SU_GET_FAMILY(addr), SOCK_DGRAM, 0)) == -1) { save_errno = errno; dbprintf(_("dgram_send_addr: socket() failed: %s\n"), strerror(save_errno)); @@ -168,7 +168,7 @@ dgram_send_addr( socket_opened = 1; #ifdef USE_REUSEADDR r = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, - (void *)&on, (socklen_t)sizeof(on)); + (void *)&on, (socklen_t_equiv)sizeof(on)); if (r < 0) { dbprintf(_("dgram_send_addr: setsockopt(SO_REUSEADDR) failed: %s\n"), strerror(errno)); @@ -241,13 +241,13 @@ ssize_t dgram_recv( dgram_t * dgram, int timeout, - struct sockaddr_storage *fromaddr) + sockaddr_union *fromaddr) { SELECT_ARG_TYPE ready; struct timeval to; ssize_t size; int sock; - socklen_t addrlen; + socklen_t_equiv addrlen; ssize_t nfound; int save_errno; @@ -287,7 +287,7 @@ dgram_recv( return nfound; } - addrlen = (socklen_t)sizeof(struct sockaddr_storage); + addrlen = (socklen_t_equiv)sizeof(sockaddr_union); size = recvfrom(sock, dgram->data, (size_t)MAX_DGRAM, 0, (struct sockaddr *)fromaddr, &addrlen); if(size == -1) { diff --git a/common-src/dgram.h b/common-src/dgram.h index 442fee8..84277b8 100644 --- a/common-src/dgram.h +++ b/common-src/dgram.h @@ -50,9 +50,9 @@ typedef struct dgram_s { int dgram_bind(dgram_t *dgram, sa_family_t family, in_port_t *portp); void dgram_socket(dgram_t *dgram, int sock); -int dgram_send_addr(struct sockaddr_storage *addr, dgram_t *dgram); +int dgram_send_addr(sockaddr_union *addr, dgram_t *dgram); ssize_t dgram_recv(dgram_t *dgram, int timeout, - struct sockaddr_storage *fromaddr); + sockaddr_union *fromaddr); void dgram_zero(dgram_t *dgram); int dgram_cat(dgram_t *dgram, const char *fmt, ...) G_GNUC_PRINTF(2,3); diff --git a/common-src/genversion.h b/common-src/genversion.h index b663563..316c245 100644 --- a/common-src/genversion.h +++ b/common-src/genversion.h @@ -1,3 +1,3 @@ #define CC "gcc" -#define BUILT_DATE "Wed May 14 17:05:51 EDT 2008" +#define BUILT_DATE "Fri Aug 22 14:21:05 EDT 2008" #define BUILT_MACH "x86_64-unknown-linux-gnu" diff --git a/common-src/krb5-security.c b/common-src/krb5-security.c index dc70b31..6c6572b 100644 --- a/common-src/krb5-security.c +++ b/common-src/krb5-security.c @@ -331,8 +331,8 @@ krb5_accept( void (*fn)(security_handle_t *, pkt_t *), void *datap) { - struct sockaddr_storage sin; - socklen_t len; + sockaddr_union sin; + socklen_t_equiv len; struct tcp_conn *rc; char hostname[NI_MAXHOST]; int result; @@ -511,7 +511,7 @@ gss_client( * Send back the response */ if (send_tok.length != 0 && tcpm_send_token(rc, rc->write, rs->handle, &errmsg, send_tok.value, send_tok.length) < 0) { - security_seterror(&rh->sech, rc->errmsg); + security_seterror(&rh->sech, "%s", rc->errmsg); gss_release_buffer(&min_stat, &send_tok); goto done; } diff --git a/common-src/security-util.c b/common-src/security-util.c index 7ecb443..77e5d0c 100644 --- a/common-src/security-util.c +++ b/common-src/security-util.c @@ -764,7 +764,7 @@ tcp1_stream_server( rh->rc = sec_tcp_conn_get(rh->hostname, 1); rh->rc->driver = rh->sech.driver; rs->rc = rh->rc; - rs->socket = stream_server(rh->udp->peer.ss_family, &rs->port, + rs->socket = stream_server(SU_GET_FAMILY(&rh->udp->peer), &rs->port, STREAM_BUFSIZE, STREAM_BUFSIZE, 0); if (rs->socket < 0) { security_seterror(&rh->sech, @@ -963,7 +963,7 @@ bsd_recv_security_ok( /* * Request packets must come from a reserved port */ - port = SS_GET_PORT(&rh->peer); + port = SU_GET_PORT(&rh->peer); if (port >= IPPORT_RESERVED) { security_seterror(&rh->sech, _("host %s: port %u not secure"), rh->hostname, @@ -1274,7 +1274,7 @@ udp_inithandle( udp_handle_t * udp, struct sec_handle * rh, char * hostname, - struct sockaddr_storage *addr, + sockaddr_union *addr, in_port_t port, char * handle, int sequence) @@ -1288,7 +1288,7 @@ udp_inithandle( rh->hostname = stralloc(hostname); copy_sockaddr(&rh->peer, addr); - SS_SET_PORT(&rh->peer, port); + SU_SET_PORT(&rh->peer, port); rh->prev = udp->bh_last; @@ -1395,7 +1395,7 @@ udp_netfd_read_callback( return; } - port = SS_GET_PORT(&udp->peer); + port = SU_GET_PORT(&udp->peer); a = udp_inithandle(udp, rh, hostname, &udp->peer, @@ -2077,7 +2077,7 @@ check_user_ruserok( char * check_user_amandahosts( const char * host, - struct sockaddr_storage *addr, + sockaddr_union *addr, struct passwd * pwd, const char * remoteuser, const char * service) @@ -2160,12 +2160,12 @@ check_user_amandahosts( (strcasecmp(filehost, "localhost")== 0 || strcasecmp(filehost, "localhost.localdomain")== 0)) { #ifdef WORKING_IPV6 - if (addr->ss_family == (sa_family_t)AF_INET6) - inet_ntop(AF_INET6, &((struct sockaddr_in6 *)addr)->sin6_addr, + if (SU_GET_FAMILY(addr) == (sa_family_t)AF_INET6) + inet_ntop(AF_INET6, &addr->sin6.sin6_addr, ipstr, sizeof(ipstr)); else #endif - inet_ntop(AF_INET, &((struct sockaddr_in *)addr)->sin_addr, + inet_ntop(AF_INET, &addr->sin.sin_addr, ipstr, sizeof(ipstr)); if (strcmp(ipstr, "127.0.0.1") == 0 || strcmp(ipstr, "::1") == 0) @@ -2260,7 +2260,7 @@ common_exit: /* return 1 on success, 0 on failure */ int check_security( - struct sockaddr_storage *addr, + sockaddr_union *addr, char * str, unsigned long cksum, char ** errstr) @@ -2304,7 +2304,7 @@ check_security( /* next, make sure the remote port is a "reserved" one */ - port = SS_GET_PORT(addr); + port = SU_GET_PORT(addr); if (port >= IPPORT_RESERVED) { *errstr = vstrallocf(_("[host %s: port %u not secure]"), remotehost, (unsigned int)port); @@ -2504,14 +2504,14 @@ show_stat_info( { char *name = vstralloc(a, b, NULL); struct stat sbuf; - struct passwd *pwptr; - struct passwd pw; + struct passwd *pwptr G_GNUC_UNUSED; + struct passwd pw G_GNUC_UNUSED; char *owner; - struct group *grptr; - struct group gr; + struct group *grptr G_GNUC_UNUSED; + struct group gr G_GNUC_UNUSED; char *group; - int buflen; - char *buf; + int buflen G_GNUC_UNUSED; + char *buf G_GNUC_UNUSED; if (stat(name, &sbuf) != 0) { auth_debug(1, _("bsd: cannot stat %s: %s\n"), name, strerror(errno)); @@ -2528,20 +2528,27 @@ show_stat_info( #endif buf = malloc(buflen); - if (getpwuid_r(sbuf.st_uid, &pw, buf, buflen, &pwptr) != 0 || - pwptr == NULL) { +#ifdef HAVE_GETPWUID_R + if (getpwuid_r(sbuf.st_uid, &pw, buf, buflen, &pwptr) == 0 && + pwptr != NULL) { + owner = stralloc(pwptr->pw_name); + } else +#endif + { owner = alloc(NUM_STR_SIZE + 1); g_snprintf(owner, NUM_STR_SIZE, "%ld", (long)sbuf.st_uid); - } else { - owner = stralloc(pwptr->pw_name); } - if (getgrgid_r(sbuf.st_gid, &gr, buf, buflen, &grptr) != 0 || - grptr == NULL) { +#ifdef HAVE_GETGRGID_R + if (getgrgid_r(sbuf.st_gid, &gr, buf, buflen, &grptr) == 0 && + grptr != NULL) { + group = stralloc(grptr->gr_name); + } else +#endif + { group = alloc(NUM_STR_SIZE + 1); g_snprintf(group, NUM_STR_SIZE, "%ld", (long)sbuf.st_gid); - } else { - group = stralloc(grptr->gr_name); } + auth_debug(1, _("bsd: processing file: %s\n"), name); auth_debug(1, _("bsd: owner=%s group=%s mode=%03o\n"), owner, group, @@ -2588,7 +2595,7 @@ check_name_give_sockaddr( } for(res1=res; res1 != NULL; res1 = res1->ai_next) { - if (cmp_sockaddr((struct sockaddr_storage *)res1->ai_addr, (struct sockaddr_storage *)addr, 1) == 0) { + if (cmp_sockaddr((sockaddr_union *)res1->ai_addr, (sockaddr_union *)addr, 1) == 0) { freeaddrinfo(res); amfree(canonname); return 0; @@ -2596,10 +2603,10 @@ check_name_give_sockaddr( } dbprintf(_("%s doesn't resolve to %s"), - hostname, str_sockaddr((struct sockaddr_storage *)addr)); + hostname, str_sockaddr((sockaddr_union *)addr)); *errstr = newvstrallocf(*errstr, "%s doesn't resolve to %s", - hostname, str_sockaddr((struct sockaddr_storage *)addr)); + hostname, str_sockaddr((sockaddr_union *)addr)); error: if (res) freeaddrinfo(res); amfree(canonname); diff --git a/common-src/security-util.h b/common-src/security-util.h index dd1e3cc..22accfc 100644 --- a/common-src/security-util.h +++ b/common-src/security-util.h @@ -76,7 +76,7 @@ struct tcp_conn { int refcnt; /* number of handles using */ int handle; /* last proto handle read */ void (*accept_fn)(security_handle_t *, pkt_t *); - struct sockaddr_storage peer; + sockaddr_union peer; TAILQ_ENTRY(tcp_conn) tq; /* queue handle */ int (*recv_security_ok)(struct sec_handle *, pkt_t *); char * (*prefix_packet)(void *, pkt_t *); @@ -109,7 +109,7 @@ struct sec_handle { } fn; void * arg; /* argument to pass function */ event_handle_t * ev_timeout; /* timeout handle for recv */ - struct sockaddr_storage peer; + sockaddr_union peer; int sequence; event_id_t event_id; char * proto_handle; @@ -165,7 +165,7 @@ extern struct connq_s connq; typedef struct udp_handle { const struct security_driver *driver; /* MUST be first */ dgram_t dgram; /* datagram to read/write from */ - struct sockaddr_storage peer; /* who sent it to us */ + sockaddr_union peer; /* who sent it to us */ pkt_t pkt; /* parsed form of dgram */ char *handle; /* handle from recvd packet */ int sequence; /* seq no of packet */ @@ -255,7 +255,7 @@ void udp_recvpkt_cancel(void *); void udp_recvpkt_callback(void *); void udp_recvpkt_timeout(void *); int udp_inithandle(udp_handle_t *, struct sec_handle *, char *hostname, - struct sockaddr_storage *, in_port_t, char *, int); + sockaddr_union *, in_port_t, char *, int); void udp_netfd_read_callback(void *); struct tcp_conn *sec_tcp_conn_get(const char *, int); @@ -270,7 +270,7 @@ char * check_user_ruserok (const char *host, struct passwd *pwd, const char *user); char * check_user_amandahosts(const char *host, - struct sockaddr_storage *addr, + sockaddr_union *addr, struct passwd *pwd, const char *user, const char *service); diff --git a/common-src/sockaddr-util.c b/common-src/sockaddr-util.c index 77fd54a..ffc6ca2 100644 --- a/common-src/sockaddr-util.c +++ b/common-src/sockaddr-util.c @@ -27,7 +27,7 @@ void dump_sockaddr( - struct sockaddr_storage *sa) + sockaddr_union *sa) { #ifdef WORKING_IPV6 char ipstr[INET6_ADDRSTRLEN]; @@ -36,24 +36,22 @@ dump_sockaddr( #endif int port; - port = SS_GET_PORT(sa); + port = SU_GET_PORT(sa); #ifdef WORKING_IPV6 - if (sa->ss_family == (sa_family_t)AF_INET6) { - inet_ntop(AF_INET6, &((struct sockaddr_in6 *)sa)->sin6_addr, - ipstr, sizeof(ipstr)); + if (SU_GET_FAMILY(sa) == AF_INET6) { + inet_ntop(AF_INET6, &sa->sin6.sin6_addr, ipstr, sizeof(ipstr)); dbprintf("(sockaddr_in6 *)%p = { %d, %d, %s }\n", sa, - ((struct sockaddr_in6 *)sa)->sin6_family, + SU_GET_FAMILY(sa), port, ipstr); } else #endif { - inet_ntop(AF_INET, &((struct sockaddr_in *)sa)->sin_addr, ipstr, - sizeof(ipstr)); + inet_ntop(AF_INET, &sa->sin.sin_addr.s_addr, ipstr, sizeof(ipstr)); dbprintf("(sockaddr_in *)%p = { %d, %d, %s }\n", sa, - ((struct sockaddr_in *)sa)->sin_family, + SU_GET_FAMILY(sa), port, ipstr); } @@ -68,7 +66,7 @@ static char mystr_sockaddr[INET_ADDRSTRLEN + 20]; char * str_sockaddr( - struct sockaddr_storage *sa) + sockaddr_union *sa) { #ifdef WORKING_IPV6 char ipstr[INET6_ADDRSTRLEN]; @@ -77,77 +75,80 @@ str_sockaddr( #endif int port; - port = SS_GET_PORT(sa); + port = SU_GET_PORT(sa); #ifdef WORKING_IPV6 - if ( sa->ss_family == (sa_family_t)AF_INET6) { - inet_ntop(AF_INET6, &((struct sockaddr_in6 *)sa)->sin6_addr, - ipstr, sizeof(ipstr)); + if ( SU_GET_FAMILY(sa) == AF_INET6) { + inet_ntop(AF_INET6, &sa->sin6.sin6_addr, ipstr, sizeof(ipstr)); } else #endif { - inet_ntop(AF_INET, &((struct sockaddr_in *)sa)->sin_addr, ipstr, - sizeof(ipstr)); + inet_ntop(AF_INET, &sa->sin.sin_addr.s_addr, ipstr, sizeof(ipstr)); } g_snprintf(mystr_sockaddr,sizeof(mystr_sockaddr),"%s.%d", ipstr, port); + mystr_sockaddr[sizeof(mystr_sockaddr)-1] = '\0'; + return mystr_sockaddr; } -int -cmp_sockaddr( - struct sockaddr_storage *ss1, - struct sockaddr_storage *ss2, - int addr_only) +/* Unmap a V4MAPPED IPv6 address into its equivalent IPv4 address. The location + * TMP is used to store the rewritten address, if necessary. Returns a pointer + * to the unmapped address. + */ +#if defined(WORKING_IPV6) && defined(IN6_IS_ADDR_V4MAPPED) +static sockaddr_union * +unmap_v4mapped( + sockaddr_union *sa, + sockaddr_union *tmp) { - /* if addresses are v4mapped, "unmap" them */ -#ifdef WORKING_IPV6 -#ifdef IN6_IS_ADDR_V4MAPPED - struct sockaddr_in ss1_v4; - struct sockaddr_in ss2_v4; - - if (ss1->ss_family == AF_INET6 && - IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)ss1)->sin6_addr)) { - memset(&ss1_v4, 0, sizeof(struct sockaddr_in)); - memcpy(&ss1_v4.sin_addr.s_addr, - &(((struct sockaddr_in6 *)ss1)->sin6_addr.s6_addr[12]), + if (SU_GET_FAMILY(sa) == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&sa->sin6.sin6_addr)) { + SU_INIT(tmp, AF_INET); + SU_SET_PORT(tmp, SU_GET_PORT(sa)); + /* extract the v4 address from byte 12 of the v6 address */ + memcpy(&tmp->sin.sin_addr.s_addr, + &sa->sin6.sin6_addr.s6_addr[12], sizeof(struct in_addr)); - ss1_v4.sin_family = AF_INET; - SS_SET_PORT((struct sockaddr_storage *)&ss1_v4, SS_GET_PORT(ss1)); - ss1 = (struct sockaddr_storage *)&ss1_v4; + return tmp; } - if (ss2->ss_family == AF_INET6 && - IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)ss2)->sin6_addr)) { - memset(&ss2_v4, 0, sizeof(struct sockaddr_in)); - memcpy(&ss2_v4.sin_addr.s_addr, - &(((struct sockaddr_in6 *)ss2)->sin6_addr.s6_addr[12]), - sizeof(struct in_addr)); - ss2_v4.sin_family = AF_INET; - SS_SET_PORT((struct sockaddr_storage *)&ss2_v4, SS_GET_PORT(ss2)); - ss2 = (struct sockaddr_storage *)&ss2_v4; - } -#endif + return sa; +} +#else +/* nothing to do if no IPv6 */ +#define unmap_v4mapped(sa, tmp) ((void)tmp, sa) #endif - if (ss1->ss_family == ss2->ss_family) { +int +cmp_sockaddr( + sockaddr_union *ss1, + sockaddr_union *ss2, + int addr_only) +{ + sockaddr_union tmp1, tmp2; + + /* if addresses are v4mapped, "unmap" them */ + ss1 = unmap_v4mapped(ss1, &tmp1); + ss2 = unmap_v4mapped(ss2, &tmp2); + + if (SU_GET_FAMILY(ss1) == SU_GET_FAMILY(ss2)) { if (addr_only) { #ifdef WORKING_IPV6 - if(ss1->ss_family == (sa_family_t)AF_INET6) + if(SU_GET_FAMILY(ss1) == AF_INET6) return memcmp( - &((struct sockaddr_in6 *)ss1)->sin6_addr, - &((struct sockaddr_in6 *)ss2)->sin6_addr, - sizeof(((struct sockaddr_in6 *)ss1)->sin6_addr)); + &ss1->sin6.sin6_addr, + &ss2->sin6.sin6_addr, + sizeof(ss1->sin6.sin6_addr)); else #endif return memcmp( - &((struct sockaddr_in *)ss1)->sin_addr, - &((struct sockaddr_in *)ss2)->sin_addr, - sizeof(((struct sockaddr_in *)ss1)->sin_addr)); + &ss1->sin.sin_addr, + &ss2->sin.sin_addr, + sizeof(ss1->sin.sin_addr)); } else { return memcmp(ss1, ss2, SS_LEN(ss1)); } } else { /* compare families to give a total order */ - if (ss1->ss_family < ss2->ss_family) + if (SU_GET_FAMILY(ss1) < SU_GET_FAMILY(ss2)) return -1; else return 1; diff --git a/common-src/sockaddr-util.h b/common-src/sockaddr-util.h index 849dd2a..977c4f9 100644 --- a/common-src/sockaddr-util.h +++ b/common-src/sockaddr-util.h @@ -23,36 +23,36 @@ * Utility routines for handling sockaddrs */ -#ifndef SOCKADDR_H -#define SOCKADDR_H +#ifndef SOCKADDR_UTIL_H +#define SOCKADDR_UTIL_H #include "amanda.h" -/* Dump a sockaddr_storage using dbprintf +/* Dump a sockaddr_union using dbprintf * * @param sa: the sockaddr to dump */ -void dump_sockaddr(struct sockaddr_storage * sa); +void dump_sockaddr(sockaddr_union * sa); -/* Convert a sockaddr_storage to a string. +/* Convert a sockaddr_union to a string. * * NOTE: this function is not threadsafe! * - * @param sa: the sockaddr_storage to dump + * @param sa: the sockaddr_union to dump * @returns: pointer to statically allocated string */ -char * str_sockaddr(struct sockaddr_storage *sa); +char * str_sockaddr(sockaddr_union *sa); -/* Compare two sockaddr_storage objects, optionally comparing +/* Compare two sockaddr_union objects, optionally comparing * only the address (and thus ignoring port, flow info, etc.). * - * @param ss1: one sockaddr_storage to compare - * @param ss2: the other sockaddr_storage to compare + * @param su1: one sockaddr_union to compare + * @param su2: the other sockaddr_union to compare * @param addr_only: if true, ignore port, flow info, etc. * @returns: -1, 0, or 1 for <, ==, >, respectively */ -int cmp_sockaddr(struct sockaddr_storage *ss1, - struct sockaddr_storage *ss2, +int cmp_sockaddr(sockaddr_union *su1, + sockaddr_union *su2, int addr_only); /* Copy a sockaddr object. @@ -62,100 +62,101 @@ int cmp_sockaddr(struct sockaddr_storage *ss1, */ #define copy_sockaddr(dest, src) memcpy((dest), (src), SS_LEN((src))) -/* Calculate the length of the data in a struct sockaddr_storage. - * - * @param ss: the sockaddr_storage to examine - * @returns: length of the data in the object +/* The "best" address family we support. */ -/* SS_LEN(ss) */ +/* AF_NATIVE */ #ifdef WORKING_IPV6 -# define SS_LEN(ss) (((struct sockaddr *)(ss))->sa_family==AF_INET6?sizeof(struct sockaddr_in6):sizeof(struct sockaddr_in)) +#define AF_NATIVE AF_INET6 #else -# define SS_LEN(ss) (sizeof(struct sockaddr_in)) +#define AF_NATIVE AF_INET #endif -/* The "best" address family we support. +/* Get the family for a sockaddr_union. + * + * @param su: the sockaddr_union to examine */ -/* AF_NATIVE */ +#define SU_GET_FAMILY(su) ((su)->sa.sa_family) +/* Calculate the length of the data in a sockaddr_union. + * + * @param su: the sockaddr_union to examine + * @returns: length of the data in the object + */ +/* SS_LEN(su) */ #ifdef WORKING_IPV6 -#define AF_NATIVE AF_INET6 +# define SS_LEN(su) (SU_GET_FAMILY(su)==AF_INET6? sizeof(struct sockaddr_in6):sizeof(struct sockaddr_in)) #else -#define AF_NATIVE AF_INET +# define SS_LEN(su) (sizeof(struct sockaddr_in)) #endif -/* Initialize a sockaddr_storage to all zeroes (as directed by RFC), - * and set its ss_family as specified +/* Initialize a sockaddr_union to all zeroes (as directed by RFC), + * and set its address family as specified * - * @param ss: sockaddr_storage object to initialize + * @param su: sockaddr_union object to initialize * @param family: an AF_* constant */ -/* SS_INIT(ss, family) */ -#define SS_INIT(ss, family) do { \ - memset((ss), 0, sizeof(*(ss))); \ - (ss)->ss_family = (family); \ +/* SU_INIT(su, family) */ +#define SU_INIT(su, family) do { \ + memset((su), 0, sizeof(*(su))); \ + (su)->sa.sa_family = (family); \ } while (0); -/* set a sockaddr_storage to the family-appropriate equivalent of - * INADDR_ANY -- a wildcard address and port. Call SS_INIT(ss) +/* set a sockaddr_union to the family-appropriate equivalent of + * INADDR_ANY -- a wildcard address and port. Call SU_INIT(su) * first to initialize the object and set the family. * - * @param ss: the sockaddr_storage to set + * @param su: the sockaddr_union to set */ -/* SS_SET_INADDR_ANY(ss) */ +/* SU_SET_INADDR_ANY(su) */ #ifdef WORKING_IPV6 -#define SS_SET_INADDR_ANY(ss) do { \ - switch ((ss)->ss_family) { \ +#define SU_SET_INADDR_ANY(su) do { \ + switch (SU_GET_FAMILY(su)) { \ case AF_INET6: \ - ((struct sockaddr_in6 *)(ss))->sin6_flowinfo = 0; \ - ((struct sockaddr_in6 *)(ss))->sin6_addr = in6addr_any; \ + (su)->sin6.sin6_flowinfo = 0; \ + (su)->sin6.sin6_addr = in6addr_any; \ break; \ case AF_INET: \ - ((struct sockaddr_in *)(ss))->sin_addr.s_addr = INADDR_ANY; \ + (su)->sin.sin_addr.s_addr = INADDR_ANY; \ break; \ } \ } while (0); #else -#define SS_SET_INADDR_ANY(ss) do { \ - ((struct sockaddr_in *)(ss))->sin_addr.s_addr = INADDR_ANY; \ +#define SU_SET_INADDR_ANY(su) do { \ + (su)->sin.sin_addr.s_addr = INADDR_ANY; \ } while (0); #endif -/* Set the port in a sockaddr_storage that already has an family +/* Set the port in a sockaddr_union that already has an family * - * @param ss: the sockaddr_storage to manipulate - * @param port: the port to insert + * @param su: the sockaddr_union to manipulate + * @param port: the port to insert (in host byte order) */ -/* SS_SET_PORT(ss, port) */ +/* SU_SET_PORT(su, port) */ #ifdef WORKING_IPV6 -#define SS_SET_PORT(ss, port) \ -switch ((ss)->ss_family) { \ +#define SU_SET_PORT(su, port) \ +switch (SU_GET_FAMILY(su)) { \ case AF_INET: \ - ((struct sockaddr_in *)(ss))->sin_port = (in_port_t)htons((port)); \ + (su)->sin.sin_port = (in_port_t)htons((port)); \ break; \ case AF_INET6: \ - ((struct sockaddr_in6 *)(ss))->sin6_port = (in_port_t)htons((port)); \ + (su)->sin6.sin6_port = (in_port_t)htons((port)); \ break; \ default: assert(0); \ } #else -#define SS_SET_PORT(ss, port) \ - ((struct sockaddr_in *)(ss))->sin_port = (in_port_t)htons((port)); +#define SU_SET_PORT(su, port) \ + (su)->sin.sin_port = (in_port_t)htons((port)); #endif -/* Get the port in a sockaddr_storage object +/* Get the port in a sockaddr_union object * - * @param ss: the sockaddr_storage to manipulate + * @param su: the sockaddr_union to manipulate + * @return: the port, in host byte horder */ -/* SS_GET_PORT(ss) */ +/* SU_GET_PORT(su) */ #ifdef WORKING_IPV6 -#define SS_GET_PORT(ss) (ntohs( \ - (ss)->ss_family == AF_INET6? \ - ((struct sockaddr_in6 *)(ss))->sin6_port \ - :((struct sockaddr_in *)(ss))->sin_port)) +#define SU_GET_PORT(su) (ntohs(SU_GET_FAMILY(su) == AF_INET6? (su)->sin6.sin6_port:(su)->sin.sin_port)) #else -#define SS_GET_PORT(ss) (ntohs( \ - ((struct sockaddr_in *)(ss))->sin_port)) +#define SU_GET_PORT(su) (ntohs((su)->sin.sin_port)) #endif -#endif /* SOCKADDR_H */ - +#endif /* SOCKADDR_UTIL_H */ diff --git a/common-src/stream.c b/common-src/stream.c index 789de4a..d9504fc 100644 --- a/common-src/stream.c +++ b/common-src/stream.c @@ -52,15 +52,15 @@ stream_server( int priv) { int server_socket, retries; - socklen_t len; + socklen_t_equiv len; #if defined(SO_KEEPALIVE) || defined(USE_REUSEADDR) const int on = 1; int r; #endif - struct sockaddr_storage server; + sockaddr_union server; int save_errno; int *portrange; - socklen_t socklen; + socklen_t_equiv socklen; int socket_family; *portp = USHRT_MAX; /* in case we error exit */ @@ -95,12 +95,12 @@ stream_server( return -1; } - SS_INIT(&server, socket_family); - SS_SET_INADDR_ANY(&server); + SU_INIT(&server, socket_family); + SU_SET_INADDR_ANY(&server); #ifdef USE_REUSEADDR r = setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, - (void *)&on, (socklen_t)sizeof(on)); + (void *)&on, (socklen_t_equiv)sizeof(on)); if (r < 0) { dbprintf(_("stream_server: setsockopt(SO_REUSEADDR) failed: %s\n"), strerror(errno)); @@ -174,7 +174,7 @@ out: #ifdef SO_KEEPALIVE r = setsockopt(server_socket, SOL_SOCKET, SO_KEEPALIVE, - (void *)&on, (socklen_t)sizeof(on)); + (void *)&on, (socklen_t_equiv)sizeof(on)); if(r == -1) { save_errno = errno; dbprintf(_("stream_server: setsockopt(SO_KEEPALIVE) failed: %s\n"), @@ -185,7 +185,7 @@ out: } #endif - *portp = SS_GET_PORT(&server); + *portp = SU_GET_PORT(&server); dbprintf(_("stream_server: waiting for connection: %s\n"), str_sockaddr(&server)); return server_socket; @@ -201,7 +201,7 @@ stream_client_internal( int nonblock, int priv) { - struct sockaddr_storage svaddr, claddr; + sockaddr_union svaddr, claddr; int save_errno; char *f; int client_socket; @@ -225,11 +225,11 @@ stream_client_internal( for (res_addr = res; res_addr != NULL; res_addr = res_addr->ai_next) { /* copy the first (preferred) address we found */ - copy_sockaddr(&svaddr, res_addr->ai_addr); - SS_SET_PORT(&svaddr, port); + copy_sockaddr(&svaddr, (sockaddr_union *)res_addr->ai_addr); + SU_SET_PORT(&svaddr, port); - SS_INIT(&claddr, svaddr.ss_family); - SS_SET_INADDR_ANY(&claddr); + SU_INIT(&claddr, SU_GET_FAMILY(&svaddr)); + SU_SET_INADDR_ANY(&claddr); /* * If a privileged port range was requested, we try to get a port in @@ -269,7 +269,7 @@ out: try_socksize(client_socket, SO_SNDBUF, sendsize); try_socksize(client_socket, SO_RCVBUF, recvsize); if (localport != NULL) - *localport = SS_GET_PORT(&claddr); + *localport = SU_GET_PORT(&claddr); return client_socket; } @@ -310,8 +310,8 @@ stream_client( } /* don't care about these values */ -static struct sockaddr_storage addr; -static socklen_t addrlen; +static sockaddr_union addr; +static socklen_t_equiv addrlen; int stream_accept( @@ -369,7 +369,7 @@ stream_accept( } while (nfound <= 0); while(1) { - addrlen = (socklen_t)sizeof(struct sockaddr_storage); + addrlen = (socklen_t_equiv)sizeof(sockaddr_union); connected_socket = accept(server_socket, (struct sockaddr *)&addr, &addrlen); @@ -382,12 +382,12 @@ stream_accept( * Make certain we got an inet connection and that it is not * from port 20 (a favorite unauthorized entry tool). */ - if (addr.ss_family == (sa_family_t)AF_INET + if (SU_GET_FAMILY(&addr) == AF_INET #ifdef WORKING_IPV6 - || addr.ss_family == (sa_family_t)AF_INET6 + || SU_GET_FAMILY(&addr) == AF_INET6 #endif ){ - port = SS_GET_PORT(&addr); + port = SU_GET_PORT(&addr); if (port != (in_port_t)20) { try_socksize(connected_socket, SO_SNDBUF, sendsize); try_socksize(connected_socket, SO_RCVBUF, recvsize); @@ -400,12 +400,12 @@ stream_accept( #ifdef WORKING_IPV6 dbprintf(_("family is %d instead of %d(AF_INET)" " or %d(AF_INET6): ignored\n"), - addr.ss_family, + SU_GET_FAMILY(&addr), AF_INET, AF_INET6); #else dbprintf(_("family is %d instead of %d(AF_INET)" ": ignored\n"), - addr.ss_family, + SU_GET_FAMILY(&addr), AF_INET); #endif } @@ -436,7 +436,7 @@ try_socksize( /* keep trying, get as big a buffer as possible */ while((isize > 1024) && (setsockopt(sock, SOL_SOCKET, - which, (void *) &isize, (socklen_t)sizeof(isize)) < 0)) { + which, (void *) &isize, (socklen_t_equiv)sizeof(isize)) < 0)) { isize -= 1024; } if(isize > 1024) { diff --git a/common-src/svn-info.h b/common-src/svn-info.h index 415f16f..5357aaf 100644 --- a/common-src/svn-info.h +++ b/common-src/svn-info.h @@ -1,2 +1,2 @@ -#define BUILT_REV "1023" +#define BUILT_REV "1266" #define BUILT_BRANCH "amanda-260" diff --git a/common-src/util.c b/common-src/util.c index 06c4de2..c1ba9d5 100644 --- a/common-src/util.c +++ b/common-src/util.c @@ -40,8 +40,8 @@ #endif static int make_socket(sa_family_t family); -static int connect_port(struct sockaddr_storage *addrp, in_port_t port, char *proto, - struct sockaddr_storage *svaddr, int nonblock); +static int connect_port(sockaddr_union *addrp, in_port_t port, char *proto, + sockaddr_union *svaddr, int nonblock); /* * Keep calling read() until we've read buflen's worth of data, or EOF, @@ -161,11 +161,11 @@ make_socket( /* return -1 on failure */ int connect_portrange( - struct sockaddr_storage *addrp, + sockaddr_union *addrp, in_port_t first_port, in_port_t last_port, char * proto, - struct sockaddr_storage *svaddr, + sockaddr_union *svaddr, int nonblock) { int s; @@ -216,16 +216,16 @@ connect_portrange( /* return >0: this is the connected socket */ int connect_port( - struct sockaddr_storage *addrp, + sockaddr_union *addrp, in_port_t port, char * proto, - struct sockaddr_storage *svaddr, + sockaddr_union *svaddr, int nonblock) { int save_errno; struct servent * servPort; - socklen_t len; - socklen_t socklen; + socklen_t_equiv len; + socklen_t_equiv socklen; int s; servPort = getservbyport((int)htons(port), proto); @@ -236,9 +236,9 @@ connect_port( return -1; } - if ((s = make_socket(addrp->ss_family)) == -1) return -2; + if ((s = make_socket(SU_GET_FAMILY(addrp))) == -1) return -2; - SS_SET_PORT(addrp, port); + SU_SET_PORT(addrp, port); socklen = SS_LEN(addrp); if (bind(s, (struct sockaddr *)addrp, socklen) != 0) { save_errno = errno; @@ -315,14 +315,14 @@ connect_port( int bind_portrange( int s, - struct sockaddr_storage *addrp, + sockaddr_union *addrp, in_port_t first_port, in_port_t last_port, char * proto) { in_port_t port; in_port_t cnt; - socklen_t socklen; + socklen_t_equiv socklen; struct servent *servPort; const in_port_t num_ports = (in_port_t)(last_port - first_port + 1); int save_errno = EAGAIN; @@ -343,7 +343,7 @@ bind_portrange( for (cnt = 0; cnt < num_ports; cnt++) { servPort = getservbyport((int)htons(port), proto); if ((servPort == NULL) || strstr(servPort->s_name, "amanda")) { - SS_SET_PORT(addrp, port); + SU_SET_PORT(addrp, port); socklen = SS_LEN(addrp); if (bind(s, (struct sockaddr *)addrp, socklen) >= 0) { if (servPort == NULL) { diff --git a/common-src/util.h b/common-src/util.h index cab9d8d..3a9efe7 100644 --- a/common-src/util.h +++ b/common-src/util.h @@ -48,9 +48,9 @@ ssize_t fullread(int, void *, size_t); ssize_t fullwrite(int, const void *, size_t); -int connect_portrange(struct sockaddr_storage *, in_port_t, in_port_t, char *, - struct sockaddr_storage *, int); -int bind_portrange(int, struct sockaddr_storage *, in_port_t, in_port_t, +int connect_portrange(sockaddr_union *, in_port_t, in_port_t, char *, + sockaddr_union *, int); +int bind_portrange(int, sockaddr_union *, in_port_t, in_port_t, char *); char * construct_datestamp(time_t *t); diff --git a/common-src/version.h b/common-src/version.h index 1ee7cf9..f5b7871 100644 --- a/common-src/version.h +++ b/common-src/version.h @@ -40,10 +40,6 @@ #ifndef VERSION_H #define VERSION_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - extern const int VERSION_MAJOR; extern const int VERSION_MINOR; extern const int VERSION_PATCH; diff --git a/common-src/versuff.c b/common-src/versuff.c index 044fe69..3504b30 100644 --- a/common-src/versuff.c +++ b/common-src/versuff.c @@ -34,13 +34,13 @@ const int VERSION_MAJOR = 2; const int VERSION_MINOR = 6; const int VERSION_PATCH = 0; -const char *const VERSION_COMMENT = "p1"; +const char *const VERSION_COMMENT = "p2"; const char * versionsuffix(void) { #ifdef USE_VERSION_SUFFIXES - return "-2.6.0p1"; + return "-2.6.0p2"; #else return ""; #endif @@ -49,5 +49,5 @@ versionsuffix(void) const char * version(void) { - return "2.6.0p1"; + return "2.6.0p2"; } diff --git a/config/Makefile.in b/config/Makefile.in index 9a0b855..7f0a293 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -80,6 +80,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ @@ -565,10 +566,10 @@ EXTRA_DIST = config.guess config.sub install-sh libtool.m4 ltmain.sh \ amanda/ipv6.m4 amanda/krb4-security.m4 amanda/krb5-security.m4 \ amanda/lfs.m4 amanda/libs.m4 amanda/net.m4 amanda/progs.m4 \ amanda/readdir.m4 amanda/readline.m4 amanda/rsh-security.m4 \ - amanda/s3-device.m4 amanda/shmem.m4 amanda/ssh-security.m4 \ - amanda/summary.m4 amanda/swig.m4 amanda/syshacks.m4 \ - amanda/tape.m4 amanda/types.m4 amanda/userid.m4 \ - amanda/version.m4 gettext-macros/codeset.m4 \ + amanda/s3-device.m4 amanda/shmem.m4 amanda/socklen_t_equiv.m4 \ + amanda/ssh-security.m4 amanda/summary.m4 amanda/swig.m4 \ + amanda/syshacks.m4 amanda/tape.m4 amanda/types.m4 \ + amanda/userid.m4 amanda/version.m4 gettext-macros/codeset.m4 \ gettext-macros/gettext.m4 gettext-macros/glibc21.m4 \ gettext-macros/glibc2.m4 gettext-macros/iconv.m4 \ gettext-macros/intdiv0.m4 gettext-macros/intmax.m4 \ diff --git a/config/amanda/debugging.m4 b/config/amanda/debugging.m4 index 6793c8f..4a499dc 100644 --- a/config/amanda/debugging.m4 +++ b/config/amanda/debugging.m4 @@ -56,6 +56,23 @@ AC_DEFUN([AMANDA_WITH_DEBUGGING], [Location of Amanda directories and files. ]) ]) +# SYNOPSIS +# +# AMANDA_GLIBC_BACKTRACE +# +# OVERVIEW +# +# Check for glibc's backtrace support, and define HAVE_GLIBC_BACKTRACE if it is present. +AC_DEFUN([AMANDA_GLIBC_BACKTRACE], +[ + AC_CHECK_HEADER([execinfo.h], [ + AC_CHECK_FUNC([backtrace_symbols_fd], [ + AC_DEFINE(HAVE_GLIBC_BACKTRACE, 1, + [Define this if glibc's backtrace functionality (execinfo.h) is present]) + ]) + ]) +]) + # SYNOPSIS # # AMANDA_WITH_DEBUG_DAYS diff --git a/config/amanda/devprefix.m4 b/config/amanda/devprefix.m4 index 7359d74..6231dbf 100644 --- a/config/amanda/devprefix.m4 +++ b/config/amanda/devprefix.m4 @@ -4,11 +4,7 @@ # # DESCRIPTION # -# Check for the prefixes used for particular devices. If the prefixes -# are broken on this system (Sinix and HPUX), suggest how to fix them. -# -# Substitutes CLIENT_SCRIPTS_OPT with the name of the script used to fix -# broken systems. +# Check for the prefixes used for particular devices. # # Defines DEV_PREFIX and RDEV_PREFIX to the appropriate prefixes. # diff --git a/config/amanda/file-list b/config/amanda/file-list index a370d2a..7e929ac 100644 --- a/config/amanda/file-list +++ b/config/amanda/file-list @@ -30,6 +30,7 @@ EXTRA_DIST += amanda/readline.m4 EXTRA_DIST += amanda/rsh-security.m4 EXTRA_DIST += amanda/s3-device.m4 EXTRA_DIST += amanda/shmem.m4 +EXTRA_DIST += amanda/socklen_t_equiv.m4 EXTRA_DIST += amanda/ssh-security.m4 EXTRA_DIST += amanda/summary.m4 EXTRA_DIST += amanda/swig.m4 diff --git a/config/amanda/s3-device.m4 b/config/amanda/s3-device.m4 index 9883d20..1aa37cb 100644 --- a/config/amanda/s3-device.m4 +++ b/config/amanda/s3-device.m4 @@ -14,13 +14,6 @@ AC_DEFUN([AMANDA_S3_DEVICE], [ AC_REQUIRE([AMANDA_CHECK_LIBCURL]) AC_REQUIRE([AMANDA_CHECK_HMAC]) - if test "$libcurl_feature_SSL" != "yes" || - test "$libcurl_protocol_HTTPS" != "yes"; then - s3_ssl=no - else - s3_ssl=yes - fi - AC_ARG_ENABLE([s3-device], AS_HELP_STRING([--disable-s3-device], [disable the S3 device]), @@ -49,9 +42,6 @@ AC_DEFUN([AMANDA_S3_DEVICE], [ # Now handle any setup for S3, if we want it. if test x"$WANT_S3_DEVICE" = x"yes"; then AC_DEFINE(WANT_S3_DEVICE, [], [Compile Amazon S3 driver]) - if test x"$s3_ssl" = x"no"; then - AMANDA_MSG_WARN([Encryption support is not available for S3; requests will be sent in plaintext.]) - fi fi @@ -67,11 +57,6 @@ AC_DEFUN([AMANDA_S3_DEVICE], [ AC_MSG_ERROR([DevPay support requires the S3 device (--enable-s3-device)]) fi - if test "$s3_ssl" != "yes"; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([Cannot use devpay without HTTPS/SSL support in libcurl.]) - fi - AC_DEFINE([WANT_DEVPAY], [], [Compile Amazon DevPay support]) fi AC_MSG_RESULT($WANT_DEVPAY) diff --git a/config/amanda/socklen_t_equiv.m4 b/config/amanda/socklen_t_equiv.m4 new file mode 100644 index 0000000..1d95d3b --- /dev/null +++ b/config/amanda/socklen_t_equiv.m4 @@ -0,0 +1,48 @@ +# SYNOPSIS +# +# AMANDA_SOCKLEN_T_EQUIV +# +# OVERVIEW +# +# Find a type which will work like socklen_t should. Unfortunately, +# HP/UX systems define socklen_t, but use int * as the result parameter +# for socket functions returning a socket length. +# +# This check defines a type socklen_t_equiv which is of the appropriate +# size to be used with socket functions. +# +AC_DEFUN([AMANDA_SOCKLEN_T_EQUIV], +[ + ## lifted from config/gnulib/socklen.m4 + AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([gl_cv_socklen_t_equiv], + [# Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + gl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in socklen_t int size_t "unsigned int" "long int" "unsigned long int"; do + AC_TRY_COMPILE( + [#include + #include + + int getpeername (int, $arg2 *, $t *);], + [$t len; + getpeername (0, 0, &len);], + [gl_cv_socklen_t_equiv="$t"]) + test "$gl_cv_socklen_t_equiv" != "" && break + done + test "$gl_cv_socklen_t_equiv" != "" && break + done + ]) + ## end lifting from config/gnulib/socklen.m4 + # fallback if the check fails + if test "$gl_cv_socklen_t_equiv" = ""; then + gl_cv_socklen_t_equiv=socklen_t + fi + AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) + + AC_DEFINE_UNQUOTED([socklen_t_equiv], [$gl_cv_socklen_t_equiv], + [type to use for socket length parameters; use instead of socklen_t]) +]) + diff --git a/config/config.h.in b/config/config.h.in index 74e8169..5c2d004 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -361,6 +361,9 @@ /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO +/* Define to 1 if you have the `getgrgid_r' function. */ +#undef HAVE_GETGRGID_R + /* Define to 1 if you have the `gethostbyname' function. */ #undef HAVE_GETHOSTBYNAME @@ -385,6 +388,9 @@ /* Define if getpeername is declared. */ #undef HAVE_GETPEERNAME_DECL +/* Define to 1 if you have the `getpwuid_r' function. */ +#undef HAVE_GETPWUID_R + /* Define to 1 if you have the `getsockname' function. */ #undef HAVE_GETSOCKNAME @@ -406,6 +412,9 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY +/* Define this if glibc's backtrace functionality (execinfo.h) is present */ +#undef HAVE_GLIBC_BACKTRACE + /* Define to 1 if you have the header file. */ #undef HAVE_GRP_H @@ -1689,9 +1698,12 @@ /* Define to `unsigned int' if does not define. */ #undef size_t -/* Type for socklen_t, if it is not defined by the system */ +/* type to use in place of socklen_t if not defined */ #undef socklen_t +/* type to use for socket length parameters; use instead of socklen_t */ +#undef socklen_t_equiv + /* Define as a signed type of the same size as size_t. */ #undef ssize_t diff --git a/configure b/configure index a48f35d..49ddd55 100755 --- a/configure +++ b/configure @@ -2950,7 +2950,7 @@ fi # Define the identity of the package. PACKAGE=amanda - VERSION="2.6.0p1" + VERSION="2.6.0p2" cat >>confdefs.h <<_ACEOF @@ -27790,13 +27790,6 @@ done - if test "$libcurl_feature_SSL" != "yes" || - test "$libcurl_protocol_HTTPS" != "yes"; then - s3_ssl=no - else - s3_ssl=yes - fi - # Check whether --enable-s3-device was given. if test "${enable_s3_device+set}" = set; then enableval=$enable_s3_device; WANT_S3_DEVICE=$enableval @@ -27844,18 +27837,6 @@ cat >>confdefs.h <<\_ACEOF #define WANT_S3_DEVICE _ACEOF - if test x"$s3_ssl" = x"no"; then - - { echo "$as_me:$LINENO: WARNING: Encryption support is not available for S3; requests will be sent in plaintext." >&5 -echo "$as_me: WARNING: Encryption support is not available for S3; requests will be sent in plaintext." >&2;} - - - cat <>config.warnings -Encryption support is not available for S3; requests will be sent in plaintext. -AAW_EOF - - - fi fi @@ -27875,14 +27856,6 @@ echo $ECHO_N "checking whether to include the Amazon S3 device's DevPay support. echo "${ECHO_T}no" >&6; } { { echo "$as_me:$LINENO: error: DevPay support requires the S3 device (--enable-s3-device)" >&5 echo "$as_me: error: DevPay support requires the S3 device (--enable-s3-device)" >&2;} - { (exit 1); exit 1; }; } - fi - - if test "$s3_ssl" != "yes"; then - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - { { echo "$as_me:$LINENO: error: Cannot use devpay without HTTPS/SSL support in libcurl." >&5 -echo "$as_me: error: Cannot use devpay without HTTPS/SSL support in libcurl." >&2;} { (exit 1); exit 1; }; } fi @@ -32928,7 +32901,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 32931 "configure"' > conftest.$ac_ext + echo '#line 32904 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -35215,11 +35188,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:35218: $lt_compile\"" >&5) + (eval echo "\"\$as_me:35191: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:35222: \$? = $ac_status" >&5 + echo "$as_me:35195: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -35477,11 +35450,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:35480: $lt_compile\"" >&5) + (eval echo "\"\$as_me:35453: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:35484: \$? = $ac_status" >&5 + echo "$as_me:35457: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -35539,11 +35512,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:35542: $lt_compile\"" >&5) + (eval echo "\"\$as_me:35515: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:35546: \$? = $ac_status" >&5 + echo "$as_me:35519: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -37768,7 +37741,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:40141: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:40172: \$? = $ac_status" >&5 + echo "$as_me:40145: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -40227,11 +40200,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:40230: $lt_compile\"" >&5) + (eval echo "\"\$as_me:40203: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:40234: \$? = $ac_status" >&5 + echo "$as_me:40207: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -41579,7 +41552,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:42538: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:42569: \$? = $ac_status" >&5 + echo "$as_me:42542: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -42624,11 +42597,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:42627: $lt_compile\"" >&5) + (eval echo "\"\$as_me:42600: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:42631: \$? = $ac_status" >&5 + echo "$as_me:42604: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -44771,11 +44744,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:44774: $lt_compile\"" >&5) + (eval echo "\"\$as_me:44747: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:44778: \$? = $ac_status" >&5 + echo "$as_me:44751: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -45033,11 +45006,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:45036: $lt_compile\"" >&5) + (eval echo "\"\$as_me:45009: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:45040: \$? = $ac_status" >&5 + echo "$as_me:45013: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -45095,11 +45068,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:45098: $lt_compile\"" >&5) + (eval echo "\"\$as_me:45071: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:45102: \$? = $ac_status" >&5 + echo "$as_me:45075: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -47324,7 +47297,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 -echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } -if test "${ac_cv_type_socklen_t+set}" = set; then + ## lifted from config/gnulib/socklen.m4 + { echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5 +echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6; } + if test "${gl_cv_socklen_t_equiv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + gl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in socklen_t int size_t "unsigned int" "long int" "unsigned long int"; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include + #include -#ifdef STDC_HEADERS -#include -#include -#endif -#include - - - -typedef socklen_t ac__type_new_; + int getpeername (int, $arg2 *, $t *); int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +$t len; + getpeername (0, 0, &len); ; return 0; } @@ -52621,29 +52591,34 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_socklen_t=yes + gl_cv_socklen_t_equiv="$t" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_socklen_t=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 -echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; } -if test $ac_cv_type_socklen_t = yes; then - : -else + test "$gl_cv_socklen_t_equiv" != "" && break + done + test "$gl_cv_socklen_t_equiv" != "" && break + done +fi -cat >>confdefs.h <<\_ACEOF -#define socklen_t int -_ACEOF + ## end lifting from config/gnulib/socklen.m4 + # fallback if the check fails + if test "$gl_cv_socklen_t_equiv" = ""; then + gl_cv_socklen_t_equiv=socklen_t + fi + { echo "$as_me:$LINENO: result: $gl_cv_socklen_t_equiv" >&5 +echo "${ECHO_T}$gl_cv_socklen_t_equiv" >&6; } -fi +cat >>confdefs.h <<_ACEOF +#define socklen_t_equiv $gl_cv_socklen_t_equiv +_ACEOF @@ -54723,6 +54698,230 @@ _ACEOF fi + if test "${ac_cv_header_execinfo_h+set}" = set; then + { echo "$as_me:$LINENO: checking for execinfo.h" >&5 +echo $ECHO_N "checking for execinfo.h... $ECHO_C" >&6; } +if test "${ac_cv_header_execinfo_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5 +echo "${ECHO_T}$ac_cv_header_execinfo_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking execinfo.h usability" >&5 +echo $ECHO_N "checking execinfo.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking execinfo.h presence" >&5 +echo $ECHO_N "checking execinfo.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: execinfo.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: execinfo.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: execinfo.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: execinfo.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: execinfo.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: execinfo.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: execinfo.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: execinfo.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: execinfo.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: execinfo.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: execinfo.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: execinfo.h: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for execinfo.h" >&5 +echo $ECHO_N "checking for execinfo.h... $ECHO_C" >&6; } +if test "${ac_cv_header_execinfo_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_execinfo_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5 +echo "${ECHO_T}$ac_cv_header_execinfo_h" >&6; } + +fi +if test $ac_cv_header_execinfo_h = yes; then + + { echo "$as_me:$LINENO: checking for backtrace_symbols_fd" >&5 +echo $ECHO_N "checking for backtrace_symbols_fd... $ECHO_C" >&6; } +if test "${ac_cv_func_backtrace_symbols_fd+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define backtrace_symbols_fd to an innocuous variant, in case declares backtrace_symbols_fd. + For example, HP-UX 11i declares gettimeofday. */ +#define backtrace_symbols_fd innocuous_backtrace_symbols_fd + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char backtrace_symbols_fd (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef backtrace_symbols_fd + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char backtrace_symbols_fd (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_backtrace_symbols_fd || defined __stub___backtrace_symbols_fd +choke me +#endif + +int +main () +{ +return backtrace_symbols_fd (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_backtrace_symbols_fd=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_backtrace_symbols_fd=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_backtrace_symbols_fd" >&5 +echo "${ECHO_T}$ac_cv_func_backtrace_symbols_fd" >&6; } +if test $ac_cv_func_backtrace_symbols_fd = yes; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GLIBC_BACKTRACE 1 +_ACEOF + + +fi + + +fi + + + + # # Declarations # @@ -58392,6 +58591,194 @@ fi fi +for ac_func in getgrgid_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in getpwuid_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + ice_have_gethostname=no for ac_func in gethostname diff --git a/configure.in b/configure.in index 74bae5f..b5eee29 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ AC_CANONICAL_TARGET([]) PACKAGE=amanda AC_SUBST(PACKAGE) -AM_INIT_AUTOMAKE(amanda, "2.6.0p1") +AM_INIT_AUTOMAKE(amanda, "2.6.0p2") AC_CONFIG_HEADERS([config/config.h]) dnl Minimum Autoconf version required. @@ -233,7 +233,7 @@ AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_SIGNAL AC_STRUCT_TM -AMANDA_CHECK_TYPE(socklen_t, int, sys/socket.h) +AMANDA_SOCKLEN_T_EQUIV AMANDA_CHECK_TYPE(sa_family_t, unsigned short, sys/socket.h) AMANDA_CHECK_TYPE(in_port_t, unsigned short, netinet/in.h) CF_WAIT @@ -249,6 +249,7 @@ AMANDA_CHECK_NET_LIBS AMANDA_CHECK_GLIB AMANDA_CHECK_READLINE AC_CHECK_LIB(m,modf) +AMANDA_GLIBC_BACKTRACE # # Declarations @@ -282,6 +283,8 @@ ICE_CHECK_DECL(fputs,stdio.h) ICE_CHECK_DECL(fread,stdio.h stdlib.h) ICE_CHECK_DECL(fseek,stdio.h) ICE_CHECK_DECL(fwrite,stdio.h stdlib.h) +AC_CHECK_FUNCS(getgrgid_r) +AC_CHECK_FUNCS(getpwuid_r) ICE_CHECK_DECL(gethostname,unistd.h) ICE_CHECK_DECL(getopt,stdlib.h unistd.h libc.h) ICE_CHECK_DECL(getpeername,sys/types.h sys/socket.h) diff --git a/device-src/Makefile.in b/device-src/Makefile.in index e23935b..70898dd 100644 --- a/device-src/Makefile.in +++ b/device-src/Makefile.in @@ -96,6 +96,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/device-src/device.c b/device-src/device.c index bf8cbd4..001db2a 100644 --- a/device-src/device.c +++ b/device-src/device.c @@ -651,6 +651,7 @@ static gboolean default_device_start (Device * self, DeviceAccessMode mode, char * label, char * timestamp) { if (mode != ACCESS_WRITE && self->volume_label == NULL) { + g_debug("default_device_start calling device_read_label with mode %d", mode); if (device_read_label(self) != READ_LABEL_STATUS_SUCCESS) return FALSE; } else if (mode == ACCESS_WRITE) { @@ -773,18 +774,52 @@ default_device_property_get(Device * self, DevicePropertyId ID, static gboolean default_device_read_to_fd(Device *self, int fd) { - return do_consumer_producer_queue(device_read_producer, - self, - fd_write_consumer, - GINT_TO_POINTER(fd)); + GValue val; + StreamingRequirement streaming_mode; + + /* Get the device's parameters */ + bzero(&val, sizeof(val)); + if (!device_property_get(self, PROPERTY_STREAMING, &val) + || !G_VALUE_HOLDS(&val, STREAMING_REQUIREMENT_TYPE)) { + streaming_mode = STREAMING_REQUIREMENT_REQUIRED; + } else { + streaming_mode = g_value_get_enum(&val); + } + + return QUEUE_SUCCESS == + do_consumer_producer_queue_full( + device_read_producer, + self, + fd_write_consumer, + GINT_TO_POINTER(fd), + device_read_max_size(self), + DEFAULT_MAX_BUFFER_MEMORY, + streaming_mode); } static gboolean default_device_write_from_fd(Device *self, int fd) { - return do_consumer_producer_queue(fd_read_producer, - GINT_TO_POINTER(fd), - device_write_consumer, - self); + GValue val; + StreamingRequirement streaming_mode; + + /* Get the device's parameters */ + bzero(&val, sizeof(val)); + if (!device_property_get(self, PROPERTY_STREAMING, &val) + || !G_VALUE_HOLDS(&val, STREAMING_REQUIREMENT_TYPE)) { + streaming_mode = STREAMING_REQUIREMENT_REQUIRED; + } else { + streaming_mode = g_value_get_enum(&val); + } + + return QUEUE_SUCCESS == + do_consumer_producer_queue_full( + fd_read_producer, + GINT_TO_POINTER(fd), + device_write_consumer, + self, + device_write_max_size(self), + DEFAULT_MAX_BUFFER_MEMORY, + streaming_mode); } /* XXX WARNING XXX @@ -810,6 +845,7 @@ device_open_device (Device * self, char * device_name) ReadLabelStatusFlags device_read_label(Device * self) { DeviceClass * klass; + g_debug("device_read_label; mode = %d", self->access_mode); g_return_val_if_fail(self != NULL, FALSE); g_return_val_if_fail(IS_DEVICE(self), FALSE); g_return_val_if_fail(self->access_mode == ACCESS_NULL, FALSE); @@ -849,6 +885,7 @@ device_start (Device * self, DeviceAccessMode mode, { DeviceClass *klass; + g_debug("device_start mode = %d", mode); g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (IS_DEVICE (self), FALSE); g_return_val_if_fail (mode != ACCESS_NULL, FALSE); @@ -869,6 +906,7 @@ device_start (Device * self, DeviceAccessMode mode, rv = (*klass->start)(self, mode, label, timestamp); amfree(local_timestamp); + g_debug("device_start done; dev->access_mode = %d, result %d", self->access_mode, rv); return rv; } else { return FALSE; diff --git a/device-src/device.h b/device-src/device.h index e01efdc..262be39 100644 --- a/device-src/device.h +++ b/device-src/device.h @@ -144,7 +144,7 @@ struct _DeviceClass { gboolean (* finish_file) (Device * self); dumpfile_t* (* seek_file) (Device * self, guint file); gboolean (* seek_block) (Device * self, guint64 block); - gboolean (* read_block) (Device * self, gpointer buf, int * size); + int (* read_block) (Device * self, gpointer buf, int * size); gboolean (* read_to_fd) (Device * self, int fd); gboolean (* property_get) (Device * self, DevicePropertyId id, GValue * val); diff --git a/device-src/queueing.c b/device-src/queueing.c index 504102f..2ec0e8c 100644 --- a/device-src/queueing.c +++ b/device-src/queueing.c @@ -440,12 +440,18 @@ producer_result_t device_read_producer(gpointer devicep, int device_write_consumer(gpointer devicep, queue_buffer_t *buffer) { Device* device; unsigned int write_size; + static gboolean wrote_blocksize = FALSE; device = (Device*) devicep; g_assert(IS_DEVICE(device)); write_size = MIN(buffer->data_size, device_write_max_size(device)); + if (!wrote_blocksize) { + wrote_blocksize = TRUE; + dbprintf("USING BLOCKSIZE %d bytes\n", write_size); + } + if (device_write_block(device, write_size, buffer->data + buffer->offset, buffer->data_size < diff --git a/device-src/rait-device.c b/device-src/rait-device.c index b38bf8d..72f7c6d 100644 --- a/device-src/rait-device.c +++ b/device-src/rait-device.c @@ -24,7 +24,7 @@ #include "rait-device.h" #include #include "property.h" -#include +#include "util.h" typedef enum { RAIT_STATUS_COMPLETE, /* All subdevices OK. */ @@ -168,6 +168,18 @@ rait_device_class_init (RaitDeviceClass * c G_GNUC_UNUSED) g_object_class->finalize = rait_device_finalize; + /* Versions of glib before 2.10.2 crash if + * g_thread_pool_set_max_unused_threads is called before the first + * invocation of g_thread_pool_new. So we make up a thread pool, but don't + * start any threads in it, and free it */ + +#if !GLIB_CHECK_VERSION(2,10,2) + { + GThreadPool *pool = g_thread_pool_new((GFunc)-1, NULL, -1, FALSE, NULL); + g_thread_pool_free(pool, TRUE, FALSE); + } +#endif + g_thread_pool_set_max_unused_threads(-1); } @@ -358,7 +370,7 @@ static void register_rait_properties(RaitDevice * self) { } static void property_hash_union(GHashTable * properties, - DeviceProperty * prop) { + const DeviceProperty * prop) { PropertyAccessFlags before, after; gpointer tmp; gboolean found; @@ -415,7 +427,7 @@ static void register_properties(RaitDevice * self) { device_property_list = device_property_get_list(child); for (i = 0; device_property_list[i].base != NULL; i ++) { - property_hash_union(properties, (gpointer)&(device_property_list[i])); + property_hash_union(properties, &(device_property_list[i])); } } @@ -481,6 +493,23 @@ static gboolean g_ptr_array_and(GPtrArray * array, return TRUE; } +/* Calls extractor on each element of the array, and returns + TRUE if at least one of the calls to extractor return TRUE. +*/ +static gboolean g_ptr_array_or(GPtrArray * array, + BooleanExtractor extractor) { + guint i; + if (array == NULL || array->len <= 0) + return FALSE; + + for (i = 0; i < array->len; i ++) { + if (extractor(g_ptr_array_index(array, i))) + return TRUE; + } + + return FALSE; +} + /* Takes a RaitDevice, and makes a GPtrArray of GenericOp. */ static GPtrArray * make_generic_boolean_op_array(RaitDevice* self) { GPtrArray * rval; @@ -504,37 +533,37 @@ static GPtrArray * make_generic_boolean_op_array(RaitDevice* self) { occured. */ static gboolean g_ptr_array_union_robust(RaitDevice * self, GPtrArray * ops, BooleanExtractor extractor) { - gboolean success; - gpointer isolated_op = NULL; + int nfailed; + guint i; - for (;;) { - success = g_ptr_array_and(ops, extractor); - - if (success || self->private->status != RAIT_STATUS_COMPLETE) { - break; - } else { - guint i; - /* First device failure, note the device and march on. */ - self->private->status = RAIT_STATUS_DEGRADED; - for (i = 0; i < ops->len; i ++) { - GenericOp * op = g_ptr_array_index(ops, i); - if (!(op->result)) { - isolated_op = g_ptr_array_remove_index_fast(ops, i); - self->private->failed = op->child_index; - g_fprintf(stderr, "RAIT array %s Isolated device %s.\n", - DEVICE(self)->device_name, - op->child->device_name); - break; - } - } - } + /* We found one or more failed elements. See which elements failed, and + * isolate them*/ + nfailed = 0; + for (i = 0; i < ops->len; i ++) { + GenericOp * op = g_ptr_array_index(ops, i); + if (!extractor(op)) { + self->private->failed = op->child_index; + g_fprintf(stderr, "RAIT array %s isolated device %s\n", + DEVICE(self)->device_name, + op->child->device_name); + nfailed++; + } } - /* Return isolated op so any data members can be freed. */ - if (isolated_op != NULL) { - g_ptr_array_add(ops, isolated_op); + /* no failures? great! */ + if (nfailed == 0) + return TRUE; + + /* a single failure in COMPLETE just puts us in DEGRADED mode */ + if (self->private->status == RAIT_STATUS_COMPLETE && nfailed == 1) { + self->private->status = RAIT_STATUS_DEGRADED; + g_fprintf(stderr, "RAIT array %s DEGRADED\n", DEVICE(self)->device_name); + return TRUE; + } else { + self->private->status = RAIT_STATUS_FAILED; + g_fprintf(stderr, "RAIT array %s FAILED\n", DEVICE(self)->device_name); + return FALSE; } - return success; } typedef struct { @@ -553,13 +582,8 @@ static void open_device_do_op(gpointer data, /* Returns TRUE if and only if the volume label and time are equal. */ static gboolean compare_volume_results(Device * a, Device * b) { - if (a->volume_time != b->volume_time) - return FALSE; - if (a->volume_label == NULL && b->volume_label == NULL) - return TRUE; - if (a->volume_label == NULL || b->volume_label == NULL) - return FALSE; - return 0 == strcmp(a->volume_label, b->volume_label); + return (0 == compare_possibly_null_strings(a->volume_time, b->volume_time) + && 0 == compare_possibly_null_strings(a->volume_label, b->volume_label)); } static gboolean @@ -739,10 +763,14 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label, guint i; gboolean success; RaitDevice * self; + char * label_from_device = NULL; self = RAIT_DEVICE(dself); g_return_val_if_fail(self != NULL, FALSE); + amfree(dself->volume_label); + amfree(dself->volume_time); + ops = g_ptr_array_sized_new(self->private->children->len); for (i = 0; i < self->private->children->len; i ++) { StartOp * op; @@ -758,6 +786,45 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label, success = g_ptr_array_and(ops, extract_boolean_generic_op); + /* check that all of the volume labels agree */ + if (success) { + for (i = 0; i < self->private->children->len; i ++) { + Device *child = g_ptr_array_index(self->private->children, i); + + if (child->volume_label != NULL && child->volume_time != NULL) { + if (dself->volume_label != NULL && dself->volume_time != NULL) { + if (strcmp(child->volume_label, dself->volume_label) != 0 || + strcmp(child->volume_time, dself->volume_time) != 0) { + /* Mismatch! (Two devices provided different labels) */ + g_fprintf(stderr, "%s: Label (%s/%s) is different " + "from label (%s/%s) found at " + "device %s", + child->device_name, + child->volume_label, + child->volume_time, + dself->volume_label, + dself->volume_time, + label_from_device); + success = FALSE; + } + } else { + /* First device with a volume. */ + dself->volume_label = g_strdup(child->volume_label); + dself->volume_time = g_strdup(child->volume_time); + label_from_device = g_strdup(child->device_name); + } + } else { + /* Device problem, it says it succeeded but sets no label? */ + g_fprintf(stderr, "%s: %s", + child->device_name, + "Says label read, but device->volume_label " + " is NULL."); + success = FALSE; + } + } + } + + amfree(label_from_device); g_ptr_array_free_full(ops); if (!success) { @@ -772,6 +839,7 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label, typedef struct { GenericOp base; const dumpfile_t * info; /* IN */ + int fileno; } StartFileOp; /* a GFunc */ @@ -779,6 +847,10 @@ static void start_file_do_op(gpointer data, gpointer user_data G_GNUC_UNUSED) { StartFileOp * op = data; op->base.result = GINT_TO_POINTER(device_start_file(op->base.child, op->info)); + op->fileno = op->base.child->file; + if (op->fileno < 1) { + op->base.result = FALSE; + } } static gboolean @@ -787,6 +859,7 @@ rait_device_start_file (Device * dself, const dumpfile_t * info) { guint i; gboolean success; RaitDevice * self; + int actual_file = -1; self = RAIT_DEVICE(dself); g_return_val_if_fail(self != NULL, FALSE); @@ -803,10 +876,37 @@ rait_device_start_file (Device * dself, const dumpfile_t * info) { do_rait_child_ops(start_file_do_op, ops, NULL); success = g_ptr_array_and(ops, extract_boolean_generic_op); + + for (i = 0; i < self->private->children->len && success; i ++) { + StartFileOp * op = g_ptr_array_index(ops, i); + if (!op->base.result) + continue; + g_assert(op->fileno >= 1); + if (actual_file < 1) { + actual_file = op->fileno; + } + if (actual_file != op->fileno) { + /* File number mismatch! Aah, my hair is on fire! */ + g_fprintf(stderr, "File number mismatch in " + "rait_device_start_file(): " + "Child %s reported file number " + "%d, another child reported " + "file number %d.", + op->base.child->device_name, + op->fileno, actual_file); + success = FALSE; + op->base.result = FALSE; + } + } g_ptr_array_free_full(ops); + g_assert(actual_file >= 1); + dself->file = actual_file - 1; /* chain-up, below, will re-increment this */ + dself->in_file = TRUE; + if (!success) { + g_fprintf(stderr, _("One or more devices failed to start_file")); return FALSE; } else if (parent_class->start_file) { return parent_class->start_file(dself, info); @@ -963,10 +1063,6 @@ rait_device_write_block (Device * dself, guint size, gpointer data, g_ptr_array_add(ops, op); } - if (last_block) { - amfree(data); - } - do_rait_child_ops(write_block_do_op, ops, NULL); success = g_ptr_array_and(ops, extract_boolean_generic_op); @@ -977,9 +1073,20 @@ rait_device_write_block (Device * dself, guint size, gpointer data, free(op->data); } + if (last_block) { + amfree(data); + } + g_ptr_array_free_full(ops); if (!success) { + /* TODO be more specific here */ + /* TODO: handle EOF here -- if one or more (or two or more??) + * children have is_eof* set, then reflect that in our error + * status, and finish_file all of the non-EOF children. What's + * more fun is when one device fails and must be isolated at + * the same time another hits EOF. */ + g_fprintf(stderr, "One or more devices failed to write_block"); return FALSE; } else { /* We don't chain up here because we must handle finish_file @@ -1180,6 +1287,7 @@ static gboolean extract_boolean_read_block_op_eof(gpointer data) { return op->base.child->is_eof; } +/* Counts the number of elements in an array matching a given proposition. */ static int g_ptr_array_count(GPtrArray * array, BooleanExtractor filter) { int rval; unsigned int i; @@ -1192,7 +1300,7 @@ static int g_ptr_array_count(GPtrArray * array, BooleanExtractor filter) { } static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops, - gpointer buf) { + gpointer buf, size_t bufsize) { guint num_children, data_children; int blocksize, child_blocksize; guint i; @@ -1216,6 +1324,7 @@ static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops, if ((int)(op->base.child_index) == parity_child) { parity_block = op->buffer; } else { + g_assert(child_blocksize * (op->base.child_index+1) <= bufsize); memcpy((char *)buf + child_blocksize * op->base.child_index, op->buffer, child_blocksize); } @@ -1250,6 +1359,7 @@ static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops, amfree(constructed_parity); } else { /* do nothing. */ } } else if (self->private->status == RAIT_STATUS_DEGRADED) { + g_assert(self->private->failed >= 0 && self->private->failed < (int)num_children); /* We are in degraded mode. What's missing? */ if (self->private->failed == parity_child) { /* do nothing. */ @@ -1290,6 +1400,7 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) { gboolean success; guint num_children, data_children; int blocksize; + gsize child_blocksize; RaitDevice * self = RAIT_DEVICE(dself); g_return_val_if_fail(self != NULL, -1); @@ -1297,9 +1408,16 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) { find_simple_params(self, &num_children, &data_children, &blocksize); + /* tell caller they haven't given us a big enough buffer */ + if (blocksize < *size) { + *size = blocksize; + return 0; + } + g_return_val_if_fail(*size >= (int)device_write_min_size(dself), -1); - g_assert(blocksize % data_children == 0); /* If not we are screwed */ + g_assert(blocksize % data_children == 0); /* If not we are screwed */ + child_blocksize = blocksize / data_children; ops = g_ptr_array_sized_new(num_children); for (i = 0; i < num_children; i ++) { @@ -1309,7 +1427,7 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) { op = malloc(sizeof(*op)); op->base.child = g_ptr_array_index(self->private->children, i); op->base.child_index = i; - op->buffer = malloc(blocksize / data_children); + op->buffer = malloc(child_blocksize); op->desired_read_size = op->read_size = blocksize / data_children; g_ptr_array_add(ops, op); } @@ -1317,12 +1435,14 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) { do_rait_child_ops(read_block_do_op, ops, NULL); if (g_ptr_array_count(ops, extract_boolean_read_block_op_data)) { - success = - g_ptr_array_union_robust(RAIT_DEVICE(self), + if (!g_ptr_array_union_robust(RAIT_DEVICE(self), ops, - extract_boolean_read_block_op_data) && - raid_block_reconstruction(RAIT_DEVICE(self), - ops, buf); + extract_boolean_read_block_op_data)) { + success = FALSE; + } else { + success = raid_block_reconstruction(RAIT_DEVICE(self), + ops, buf, (size_t)*size); + } } else { success = FALSE; if (g_ptr_array_union_robust(RAIT_DEVICE(self), @@ -1330,7 +1450,10 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) { extract_boolean_read_block_op_eof)) { /* We hit EOF. */ dself->is_eof = TRUE; - } + dself->in_file = FALSE; + } else { + g_fprintf(stderr, _("All child devices failed to read, but not all are at eof")); + } } for (i = 0; i < ops->len; i ++) { @@ -1342,6 +1465,7 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) { if (success) { if (parent_class->read_block) parent_class->read_block(dself, buf, size); + *size = blocksize; return blocksize; } else { return -1; @@ -1607,7 +1731,9 @@ rait_device_property_get (Device * dself, DevicePropertyId id, GValue * val) { !g_value_compare(&result, &(op->value))) { success = FALSE; } - g_value_unset(&(op->value)); + /* free the GValue if the child call succeeded */ + if (GPOINTER_TO_INT(op->base.result)) + g_value_unset(&(op->value)); } if (success) { @@ -1656,14 +1782,21 @@ rait_device_property_set (Device * d_self, DevicePropertyId id, GValue * val) { self = RAIT_DEVICE(d_self); g_return_val_if_fail(self != NULL, FALSE); + /* it doesn't make sense to hand these properties down to our child devices, + * so we'll just pretend we set them. This is a 2.6.0 hack -- the device gets + * this right in 2.6.1. */ + if (id == PROPERTY_BLOCK_SIZE + || id == PROPERTY_MIN_BLOCK_SIZE + || id == PROPERTY_MAX_BLOCK_SIZE) { + return TRUE; /* lies! */ + } + ops = make_property_op_array(self, id, val); do_rait_child_ops(property_set_do_op, ops, NULL); success = g_ptr_array_union_robust(self, ops, extract_boolean_generic_op); - label_changed = - g_ptr_array_union_robust(self, ops, - extract_label_changed_property_op); + label_changed = g_ptr_array_or(ops, extract_label_changed_property_op); g_ptr_array_free_full(ops); if (label_changed) { diff --git a/device-src/s3-device.c b/device-src/s3-device.c index ca83d52..bebb6ef 100644 --- a/device-src/s3-device.c +++ b/device-src/s3-device.c @@ -197,7 +197,7 @@ static gboolean s3_device_seek_block(Device *pself, guint64 block); -static gboolean +static int s3_device_read_block(Device * pself, gpointer data, int *size_req); @@ -1144,6 +1144,7 @@ s3_device_read_block (Device * pself, gpointer data, int *size_req) { /* if it's an expected error (not found), just return -1 */ if (response_code == 404 && s3_error_code == S3_ERROR_NoSuchKey) { pself->is_eof = TRUE; + pself->in_file = FALSE; return -1; } diff --git a/device-src/s3.c b/device-src/s3.c index 161ff4e..dfd29dc 100644 --- a/device-src/s3.c +++ b/device-src/s3.c @@ -70,12 +70,6 @@ * (*excluding* null terminator) */ #define S3_MAX_KEY_LENGTH 1024 -#if defined(LIBCURL_FEATURE_SSL) && defined(LIBCURL_PROTOCOL_HTTPS) -# define S3_URL "https://s3.amazonaws.com" -#else -# define S3_URL "http://s3.amazonaws.com" -#endif - #define AMAZON_SECURITY_HEADER "x-amz-security-token" /* parameters for exponential backoff in the face of retriable errors */ @@ -159,6 +153,13 @@ s3_error_code_from_name(char *s3_error_name); static const char * s3_error_name_from_code(s3_error_code_t s3_error_code); +/* Does this install of curl support SSL? + * + * @returns: boolean + */ +static gboolean +s3_curl_supports_ssl(void); + /* * result handling */ @@ -321,6 +322,28 @@ s3_error_name_from_code(s3_error_code_t s3_error_code) } /* }}} */ +/* {{{ s3_curl_supports_ssl */ +static gboolean +s3_curl_supports_ssl(void) +{ + static int supported = -1; + + if (supported == -1) { +#if defined(CURL_VERSION_SSL) + curl_version_info_data *info = curl_version_info(CURLVERSION_NOW); + if (info->features & CURL_VERSION_SSL) + supported = 1; + else + supported = 0; +#else + supported = 0; +#endif + } + + return supported; +} +/* }}} */ + /* {{{ lookup_result */ static s3_result_t lookup_result(const result_handling_t *result_handling, @@ -660,6 +683,7 @@ perform_request(S3Handle *hdl, guint preallocate_response_size, const result_handling_t *result_handling) { + const char *baseurl; char *url = NULL; s3_result_t result = S3_RESULT_FAIL; /* assume the worst.. */ CURLcode curl_code = CURLE_OK; @@ -675,7 +699,8 @@ perform_request(S3Handle *hdl, s3_reset(hdl); - url = g_strconcat(S3_URL, uri, NULL); + baseurl = s3_curl_supports_ssl()? "https://s3.amazonaws.com":"http://s3.amazonaws.com"; + url = g_strconcat(baseurl, uri, NULL); if (!url) goto cleanup; if (preallocate_response_size) { diff --git a/device-src/tape-aix.c b/device-src/tape-aix.c index b5701a1..a9665a7 100644 --- a/device-src/tape-aix.c +++ b/device-src/tape-aix.c @@ -91,9 +91,9 @@ gboolean tape_setcompression(int fd, gboolean on) { return FALSE; } -TapeCheckResult tape_is_tape_device(int fd) { +ReadLabelStatusFlags tape_is_tape_device(int fd) { /* AIX doesn't have a no-op. */ - return TAPE_CHECK_UNKNOWN; + return READ_LABEL_STATUS_SUCCESS; } TapeCheckResult tape_is_ready(int fd) { diff --git a/device-src/tape-device.c b/device-src/tape-device.c index ca629bf..1274fcd 100644 --- a/device-src/tape-device.c +++ b/device-src/tape-device.c @@ -56,7 +56,7 @@ static gboolean tape_device_open_device (Device * self, char * device_name); static ReadLabelStatusFlags tape_device_read_label(Device * self); static gboolean tape_device_write_block(Device * self, guint size, gpointer data, gboolean short_block); -static gboolean tape_device_read_block(Device * self, gpointer buf, +static int tape_device_read_block(Device * self, gpointer buf, int * size_req); static gboolean tape_device_start (Device * self, DeviceAccessMode mode, char * label, char * timestamp); @@ -228,48 +228,84 @@ void tape_device_register(void) { register_device(tape_device_factory, device_prefix_list); } -#ifdef O_NONBLOCK /* Open the tape device, trying various combinations of O_RDWR and - O_NONBLOCK. */ -static int try_open_tape_device(TapeDevice * self, char * device_name) { - int rval; - rval = robust_open(device_name, O_RDWR | O_NONBLOCK, 0); - if (rval < 0 && (errno == EWOULDBLOCK || errno == EINVAL)) { + O_NONBLOCK. Returns -1 and sets status_result for errors */ +static int try_open_tape_device(TapeDevice * self, char * device_filename, + ReadLabelStatusFlags *status_result) { + int fd; + int save_errno; + ReadLabelStatusFlags new_status; + TapeCheckResult tcr; + *status_result = READ_LABEL_STATUS_SUCCESS; + +#ifdef O_NONBLOCK + fd = robust_open(device_filename, O_RDWR | O_NONBLOCK, 0); + save_errno = errno; + if (fd < 0 && (save_errno == EWOULDBLOCK || save_errno == EINVAL)) { /* Maybe we don't support O_NONBLOCK for tape devices. */ - rval = robust_open(device_name, O_RDWR, 0); + fd = robust_open(device_filename, O_RDWR, 0); + save_errno = errno; } - if (rval >= 0) { +#else + fd = robust_open(device_filename, O_RDWR); + save_errno = errno; +#endif + if (fd >= 0) { self->write_open_errno = 0; } else { if (errno == EACCES || errno == EPERM) { /* Device is write-protected. */ self->write_open_errno = errno; - rval = robust_open(device_name, O_RDONLY | O_NONBLOCK, 0); - if (rval < 0 && (errno == EWOULDBLOCK || errno == EINVAL)) { - rval = robust_open(device_name, O_RDONLY, 0); +#ifdef O_NONBLOCK + fd = robust_open(device_filename, O_RDONLY | O_NONBLOCK, 0); + save_errno = errno; + if (fd < 0 && (save_errno == EWOULDBLOCK || save_errno == EINVAL)) { + fd = robust_open(device_filename, O_RDONLY, 0); + save_errno = errno; } +#else + fd = robust_open(device_filename, O_RDONLY); + save_errno = errno; +#endif } } +#ifdef O_NONBLOCK /* Clear O_NONBLOCK for operations from now on. */ - fcntl(rval, F_SETFL, fcntl(rval, F_GETFL, 0) & ~O_NONBLOCK); - return rval; -} -#else /* !defined(O_NONBLOCK) */ -static int try_open_tape_device(TapeDevice * self, char * device_name) { - int rval; - rval = robust_open(device_name, O_RDWR); - if (rval >= 0) { - self->write_open_errno = 0; - } else { - if (errno == EACCES || errno == EPERM) { - /* Device is write-protected. */ - self->write_open_errno = errno; - rval = robust_open(device_name, O_RDONLY); - } + if (fd >= 0) + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); + errno = save_errno; + /* function continues after #endif */ + +#endif /* O_NONBLOCK */ + + if (fd < 0) { + g_fprintf(stderr, _("Can't open tape device %s: %s\n"), + DEVICE(self)->device_name, strerror(errno)); + *status_result = READ_LABEL_STATUS_DEVICE_ERROR; + return -1; + } + + /* Check that this is actually a tape device. */ + new_status = tape_is_tape_device(fd); + if (new_status & (READ_LABEL_STATUS_DEVICE_ERROR | READ_LABEL_STATUS_VOLUME_MISSING)) { + g_fprintf(stderr, _("File %s is not a tape device\n"), + DEVICE(self)->device_name); + robust_close(fd); + *status_result = new_status; + return -1; } - return rval; + + tcr = tape_is_ready(fd); + if (new_status == TAPE_CHECK_FAILURE) { + g_fprintf(stderr, _("Tape device %s is not ready or is empty\n"), + DEVICE(self)->device_name); + robust_close(fd); + *status_result = READ_LABEL_STATUS_DEVICE_ERROR; + return -1; + } + + return fd; } -#endif /* O_NONBLOCK */ static gboolean tape_device_open_device (Device * d_self, char * device_name) { @@ -279,38 +315,6 @@ tape_device_open_device (Device * d_self, char * device_name) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (device_name != NULL, FALSE); - self->fd = try_open_tape_device(self, device_name); - - if (self->fd < 0) { - g_fprintf(stderr, "Can't open tape device %s: %s\n", - device_name, strerror(errno)); - return FALSE; - } - - /* Check that this is actually a tape device. */ - if (tape_is_tape_device(self->fd) == TAPE_CHECK_FAILURE) { - g_fprintf(stderr, "File %s is not a tape device.\n", - device_name); - robust_close(self->fd); - return FALSE; - } - - if (tape_is_ready(self->fd) == TAPE_CHECK_FAILURE) { - g_fprintf(stderr, - "Tape device %s is not ready or is empty.\n", - device_name); - robust_close(self->fd); - return FALSE; - } - - /* Rewind it. */ - if (!tape_rewind(self->fd)) { - g_fprintf(stderr, "Error rewinding device %s\n", - device_name); - robust_close(self->fd); - return FALSE; - } - /* Get tape drive/OS info */ tape_device_discover_capabilities(self); @@ -345,6 +349,17 @@ static ReadLabelStatusFlags tape_device_read_label(Device * dself) { self = TAPE_DEVICE(dself); g_return_val_if_fail(self != NULL, FALSE); + amfree(dself->volume_label); + amfree(dself->volume_time); + + if (self->fd == -1) { + ReadLabelStatusFlags status; + self->fd = try_open_tape_device(self, dself->device_name, &status); + if (self->fd == -1) + return status; + } + + /* Rewind it. */ if (!tape_rewind(self->fd)) { g_fprintf(stderr, "Error rewinding device %s\n", dself->device_name); @@ -464,7 +479,9 @@ static int tape_device_read_block (Device * pself, gpointer buf, } case RESULT_NO_DATA: pself->is_eof = TRUE; - /* FALLTHROUGH */ + pself->in_file = FALSE; + return -1; + default: return -1; } @@ -509,7 +526,23 @@ tape_device_start (Device * d_self, DeviceAccessMode mode, char * label, self = TAPE_DEVICE(d_self); g_return_val_if_fail(self != NULL, FALSE); - + + if (self->fd == -1) { + ReadLabelStatusFlags status; + self->fd = try_open_tape_device(self, d_self->device_name, &status); + if (self->fd == -1) + return FALSE; /* can't do anything with status here */ + } + + if (mode != ACCESS_WRITE && d_self->volume_label == NULL) { + /* we need a labeled volume for APPEND and READ */ + if (tape_device_read_label(d_self) != READ_LABEL_STATUS_SUCCESS) + return FALSE; + } + + d_self->access_mode = mode; + d_self->in_file = FALSE; + if (IS_WRITABLE_ACCESS_MODE(mode)) { if (self->write_open_errno != 0) { /* We tried and failed to open the device in write mode. */ diff --git a/device-src/tape-ops.h b/device-src/tape-ops.h index 2448373..bebe28a 100644 --- a/device-src/tape-ops.h +++ b/device-src/tape-ops.h @@ -53,7 +53,7 @@ typedef enum { TAPE_CHECK_UNKNOWN, TAPE_CHECK_FAILURE } TapeCheckResult; -TapeCheckResult tape_is_tape_device(int fd); +ReadLabelStatusFlags tape_is_tape_device(int fd); TapeCheckResult tape_is_ready(int fd); /* Also implemented in above files. Sets properties on the device. */ diff --git a/device-src/tape-posix.c b/device-src/tape-posix.c index a9a31bb..70e9480 100644 --- a/device-src/tape-posix.c +++ b/device-src/tape-posix.c @@ -131,16 +131,21 @@ gboolean tape_setcompression(int fd G_GNUC_UNUSED, #endif } -TapeCheckResult tape_is_tape_device(int fd) { +ReadLabelStatusFlags tape_is_tape_device(int fd) { struct mtop mt; mt.mt_op = MTNOP; mt.mt_count = 1; if (0 == ioctl(fd, MTIOCTOP, &mt)) { - return TAPE_CHECK_SUCCESS; + return READ_LABEL_STATUS_SUCCESS; } else { dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s", strerror(errno)); - return TAPE_CHECK_FAILURE; + if (errno == EIO) { + /* some devices return EIO while the drive is busy loading */ + return READ_LABEL_STATUS_DEVICE_ERROR|READ_LABEL_STATUS_VOLUME_MISSING; + } else { + return READ_LABEL_STATUS_DEVICE_ERROR; + } } } diff --git a/device-src/tape-uware.c b/device-src/tape-uware.c index 4f21616..0b86761 100644 --- a/device-src/tape-uware.c +++ b/device-src/tape-uware.c @@ -83,13 +83,15 @@ gboolean tape_setcompression(int fd, gboolean on) { return 0 == ioctl(fd, T_SETCOMP, cmd); } -TapeCheckResult tape_is_tape_device(int fd) { +ReadLabelStatusFlags tape_is_tape_device(int fd) { /* If we can read block information, it's probably a tape device. */ struct blklen result; if (0 == ioctl(fd, T_RDBLKLEN, &result)) { - return TAPE_CHECK_SUCCESS; + return READ_LABEL_STATUS_SUCCESS; } else { - return TAPE_CHECK_FAILURE; + dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s", + strerror(errno)); + return READ_LABEL_STATUS_DEVICE_ERROR; } } diff --git a/device-src/tape-xenix.c b/device-src/tape-xenix.c index 87be604..1890cd2 100644 --- a/device-src/tape-xenix.c +++ b/device-src/tape-xenix.c @@ -81,12 +81,14 @@ gboolean tape_setcompression(int fd, gboolean on) { return FALSE; } -TapeCheckResult tape_is_tape_device(int fd) { +ReadLabelStatusFlags tape_is_tape_device(int fd) { struct tape_info result; if (0 == ioctl(fd, MT_STATUS, &result)) { - return TAPE_CHECK_SUCCESS; + return READ_LABEL_STATUS_SUCCESS; } else { - return TAPE_CHECK_FAILURE; + dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s", + strerror(errno)); + return READ_LABEL_STATUS_DEVICE_ERROR; } } diff --git a/device-src/tests/Makefile.in b/device-src/tests/Makefile.in index fd8b7ec..37fe55e 100644 --- a/device-src/tests/Makefile.in +++ b/device-src/tests/Makefile.in @@ -81,6 +81,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/device-src/tests/semaphore-test.c b/device-src/tests/semaphore-test.c index cdfac17..2e523c7 100644 --- a/device-src/tests/semaphore-test.c +++ b/device-src/tests/semaphore-test.c @@ -20,6 +20,7 @@ #include "semaphore.h" #include "amanda.h" +#include "util.h" /* * test that decrement waits properly @@ -49,12 +50,11 @@ static gboolean test_decr_wait(void) { GThread *th; - struct test_decr_wait_data data = { - semaphore_new_with_value(10), - FALSE - }; + struct test_decr_wait_data data = { NULL, FALSE }; int rv; + data.sem = semaphore_new_with_value(10), + /* die after 10 seconds (default signal disposition is to fail) */ alarm(10); @@ -254,7 +254,7 @@ main(void) gboolean pass = TRUE; #if defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE) - amanda_thread_init(NULL); + amanda_thread_init(); pass = test_decr_wait() && pass; pass = test_wait_empty() && pass; diff --git a/device-src/tests/vfs_test.c b/device-src/tests/vfs_test.c index 5b63f2b..b05ee78 100644 --- a/device-src/tests/vfs_test.c +++ b/device-src/tests/vfs_test.c @@ -20,6 +20,7 @@ #include #include +#include "util.h" /* global so the 'atexit' handler can access it */ @@ -118,7 +119,7 @@ main(int argc G_GNUC_UNUSED, char **argv G_GNUC_UNUSED) pid_t pid; amwait_t status; - amanda_thread_init(NULL); + amanda_thread_init(); device_path = setup_vtape_dir(); diff --git a/device-src/vfs-device.c b/device-src/vfs-device.c index b197dcc..a69b584 100644 --- a/device-src/vfs-device.c +++ b/device-src/vfs-device.c @@ -20,9 +20,9 @@ #include /* memset() */ +#include "amanda.h" #include "vfs-device.h" #include "fsusage.h" -#include "amanda.h" #include "util.h" #include @@ -726,7 +726,8 @@ vfs_device_read_block(Device * pself, gpointer data, int * size_req) { return size; case RESULT_NO_DATA: pself->is_eof = TRUE; - /* FALLTHROUGH */ + pself->in_file = FALSE; + return -1; default: return -1; } @@ -871,6 +872,9 @@ char * make_new_file_name(VfsDevice * self, const dumpfile_t * ji) { } } + /* record that we're at this filenum now */ + DEVICE(self)->file = fileno; + base = g_strdup_printf("%05d.%s.%s.%d", fileno, ji->name, ji->disk, ji->dumplevel); sanitary_base = sanitise_filename(base); @@ -922,6 +926,8 @@ vfs_device_start_file (Device * pself, const dumpfile_t * ji) { } self->volume_bytes += VFS_DEVICE_LABEL_SIZE; + /* make_new_file_name set pself->file for us, but the parent class will increment it, so decrement it now */ + pself->file--; if (parent_class->start_file) { parent_class->start_file(pself, ji); @@ -1112,8 +1118,8 @@ vfs_device_property_set (Device * pself, DevicePropertyId ID, GValue * val) { self->volume_limit = g_value_get_uint64(val); return TRUE; } else { - if (parent_class->property_get) { - return parent_class->property_get(pself, ID, val); + if (parent_class->property_set) { + return parent_class->property_set(pself, ID, val); } else { return FALSE; } diff --git a/dumper-src/Makefile.in b/dumper-src/Makefile.in index 50353aa..bd21ff1 100644 --- a/dumper-src/Makefile.in +++ b/dumper-src/Makefile.in @@ -206,6 +206,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/example/Makefile.in b/example/Makefile.in index 70c041d..f866f46 100644 --- a/example/Makefile.in +++ b/example/Makefile.in @@ -121,6 +121,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/gnulib/Makefile.in b/gnulib/Makefile.in index 04c9381..aab44ad 100644 --- a/gnulib/Makefile.in +++ b/gnulib/Makefile.in @@ -90,6 +90,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/installcheck/Amanda_Config.pl b/installcheck/Amanda_Config.pl index 8a21935..5a0bb22 100644 --- a/installcheck/Amanda_Config.pl +++ b/installcheck/Amanda_Config.pl @@ -159,7 +159,7 @@ SKIP: { # tapetypes ok(!tapetype_seen($ttyp, $TAPETYPE_LBL_TEMPL), "tapetype lbl_templ was not seen"); - is_deeply([ sort(getconf_list("tapetype")) ], + is_deeply([ sort(+getconf_list("tapetype")) ], [ sort("mytapetype", "TEST-TAPE") ], "getconf_list lists all tapetypes"); } @@ -205,7 +205,7 @@ SKIP: { # dumptypes ok(!dumptype_seen($dtyp, $DUMPTYPE_RECORD), "'record' parm was not seen"); - is_deeply([ sort(getconf_list("dumptype")) ], + is_deeply([ sort(+getconf_list("dumptype")) ], [ sort(qw( mydumptype NO-COMPRESS COMPRESS-FAST COMPRESS-BEST COMPRESS-CUST @@ -233,7 +233,7 @@ SKIP: { # interfaces ok(!interface_seen($iface, $INTER_MAXUSAGE), "seen not set for parameters that did not appear"); - is_deeply([ sort(getconf_list("interface")) ], + is_deeply([ sort(+getconf_list("interface")) ], [ sort('inyoface', 'inherface', 'default') ], "getconf_list lists all interfaces (in any order)"); } @@ -271,7 +271,7 @@ SKIP: { # holdingdisks ok(!holdingdisk_next($hdisk), "no third holding disk"); - is_deeply([ sort(getconf_list("holdingdisk")) ], + is_deeply([ sort(+getconf_list("holdingdisk")) ], [ sort('hd1', 'hd2') ], "getconf_list lists all holdingdisks (in any order)"); } diff --git a/installcheck/Makefile.in b/installcheck/Makefile.in index c42c8d1..afbc373 100644 --- a/installcheck/Makefile.in +++ b/installcheck/Makefile.in @@ -163,6 +163,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/installcheck/amgetconf.pl b/installcheck/amgetconf.pl index 7678fea..31ea204 100644 --- a/installcheck/amgetconf.pl +++ b/installcheck/amgetconf.pl @@ -116,7 +116,7 @@ $testconf->add_param("device_property", '"power" "on"'); $testconf->add_param("device_property", '"turbo" "engaged"'); $testconf->write(); -is_deeply([sort(split(qr/\n/, amgetconf('TESTCONF', 'device_property')))], +is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'device_property')))], [sort('"power" "on"', '"turbo" "engaged"')], "device_property can have multiple values"); @@ -132,7 +132,7 @@ $testconf->add_interface("testiface", [ use => '10' ]); $testconf->add_holdingdisk("hd17", [ chunksize => '128' ]); $testconf->write(); -is_deeply([sort(split(/\n/, amgetconf('TESTCONF', '--list', 'tapetype')))], +is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'tapetype')))], [sort("cassette", "reel2reel", "scotch", "TEST-TAPE")], "--list returns correct set of tapetypes"); is(amgetconf('TESTCONF', 'tapetype:scotch:length'), '500', @@ -143,14 +143,14 @@ ok(grep { $_ eq 'testdump' } split(/\n/, amgetconf('TESTCONF', '--list', 'dumpty is(amgetconf('TESTCONF', 'dumptype:testdump:comment'), 'testdump-dumptype', "returns dumptype parameter correctly"); -is_deeply([sort(split(/\n/, amgetconf('TESTCONF', '--list', 'interface')))], +is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'interface')))], [sort("testiface", "default")], "--list returns correct set of interfaces"); is(amgetconf('TESTCONF', 'interface:testiface:use'), '10', "returns interface parameter correctly"); -is_deeply([sort(split(/\n/, amgetconf('TESTCONF', '--list', 'holdingdisk')))], - [sort("hd17")], +is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'holdingdisk')))], + [sort("hd17")], "--list returns correct set of holdingdisks"); is(amgetconf('TESTCONF', 'holdingdisk:hd17:chunksize'), '128', "returns holdingdisk parameter correctly"); @@ -177,12 +177,12 @@ $testconf->add_dumptype("testdump", [ ]); $testconf->write(); -is_deeply([sort(split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:exclude')))], +is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:exclude')))], [sort('FILE "f1" "f2"', 'LIST "l1" "l2"')], "exclude files and lists displayed correctly; a non-final optional is ignored"); -is_deeply([sort(split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:include')))], +is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:include')))], [sort('FILE OPTIONAL "ifo"', 'LIST OPTIONAL "ilo"')], "a final 'OPTIONAL' makes the whole include/exclude optional") diff --git a/man/Makefile.am b/man/Makefile.am index 1a74ac4..c060341 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -70,24 +70,34 @@ SRCMANPAGEDIR = $(srcdir)/xml-source MAN_XML = $(ALL_MAN_PAGES:%=xml-source/%.xml) EXTRA_XML = xslt/expand-sambadoc.xsl \ - xslt/man.xsl \ + xslt/man.xsl.in \ + xslt/html.xsl.in \ xslt/settings.xsl \ entities/global.entities \ entities/xinclude.dtd -EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_XML) +EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_HTML) $(EXTRA_XML) GEN_XML = $(ALL_MAN_PAGES:%=xml-source/%.proc.xml) MOSTLYCLEANFILES = $(GEN_XML) MAINTAINERCLEANFILES = $(ALL_MAN_PAGES) +# some of the XSL needs to know what docbook-xsl version we've selected +%.xsl: %.xsl.in $(top_builddir)/config.status + $(top_builddir)/config.status --file=$@:$< + if ENABLE_MANPAGE_BUILD +# phase one of the documentation build expands some macros. xml-source/%.proc.xml: $(SRCMANPAGEDIR)/%.xml $(srcdir)/xslt/expand-sambadoc.xsl $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --xinclude --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --output $@ $(srcdir)/xslt/expand-sambadoc.xsl $< +# phase two generates a manpage from the resulting "expanded" docbook XML %: xml-source/%.proc.xml $(srcdir)/xslt/man.xsl - $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ http://docbook.sourceforge.net/release/xsl/$(XSLREL)/manpages/docbook.xsl $< + $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/man.xsl $< + +%.html: xml-source/%.proc.xml $(srcdir)/xslt/html.xsl + $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/html.xsl $< else !ENABLE_MANPAGE_BUILD @@ -95,8 +105,24 @@ else !ENABLE_MANPAGE_BUILD @echo WARNING: Not building needed $@ because building manpages is disabled. @echo 'DUMMY' > $@ +# (no rule to build HTML without ENABLE_MANPAGE_BUILD) + endif +## +## HTML Generation +## + +EXTRA_DIST += \ + index.php \ + amanda.css + +ALL_MAN_HTMLS = $(ALL_MAN_PAGES:%=%.html) + +# toplevel rule to build HTML manpages and tar them up +html: amanda.css index.php $(ALL_MAN_HTMLS) + tar -zcf html.tar.gz $(ALL_MAN_HTMLS) amanda.css index.php + # double-check that we don't ship dummy manpages dist-hook: for f in $(WANTED_MAN_PAGES); do \ diff --git a/man/Makefile.in b/man/Makefile.in index 33edd41..80f0d8f 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -80,6 +80,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ @@ -612,15 +613,20 @@ WANTED_MAN_PAGES = $(COMMON_MAN_PAGES) $(am__append_1) $(am__append_2) \ SRCMANPAGEDIR = $(srcdir)/xml-source MAN_XML = $(ALL_MAN_PAGES:%=xml-source/%.xml) EXTRA_XML = xslt/expand-sambadoc.xsl \ - xslt/man.xsl \ + xslt/man.xsl.in \ + xslt/html.xsl.in \ xslt/settings.xsl \ entities/global.entities \ entities/xinclude.dtd -EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_XML) + +# (no rule to build HTML without ENABLE_MANPAGE_BUILD) +EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_HTML) $(EXTRA_XML) \ + index.php amanda.css GEN_XML = $(ALL_MAN_PAGES:%=xml-source/%.proc.xml) MOSTLYCLEANFILES = $(GEN_XML) MAINTAINERCLEANFILES = $(ALL_MAN_PAGES) +ALL_MAN_HTMLS = $(ALL_MAN_PAGES:%=%.html) man_MANS = $(WANTED_MAN_PAGES) all: all-am @@ -831,8 +837,6 @@ dvi: dvi-am dvi-am: -html: html-am - info: info-am info-am: @@ -891,16 +895,29 @@ uninstall-man: uninstall-man5 uninstall-man8 uninstall-man uninstall-man5 uninstall-man8 +# some of the XSL needs to know what docbook-xsl version we've selected +%.xsl: %.xsl.in $(top_builddir)/config.status + $(top_builddir)/config.status --file=$@:$< + +# phase one of the documentation build expands some macros. @ENABLE_MANPAGE_BUILD_TRUE@xml-source/%.proc.xml: $(SRCMANPAGEDIR)/%.xml $(srcdir)/xslt/expand-sambadoc.xsl @ENABLE_MANPAGE_BUILD_TRUE@ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --xinclude --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --output $@ $(srcdir)/xslt/expand-sambadoc.xsl $< +# phase two generates a manpage from the resulting "expanded" docbook XML @ENABLE_MANPAGE_BUILD_TRUE@%: xml-source/%.proc.xml $(srcdir)/xslt/man.xsl -@ENABLE_MANPAGE_BUILD_TRUE@ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ http://docbook.sourceforge.net/release/xsl/$(XSLREL)/manpages/docbook.xsl $< +@ENABLE_MANPAGE_BUILD_TRUE@ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/man.xsl $< + +@ENABLE_MANPAGE_BUILD_TRUE@%.html: xml-source/%.proc.xml $(srcdir)/xslt/html.xsl +@ENABLE_MANPAGE_BUILD_TRUE@ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/html.xsl $< @ENABLE_MANPAGE_BUILD_FALSE@%: $(SRCMANPAGEDIR)/%.xml @ENABLE_MANPAGE_BUILD_FALSE@ @echo WARNING: Not building needed $@ because building manpages is disabled. @ENABLE_MANPAGE_BUILD_FALSE@ @echo 'DUMMY' > $@ +# toplevel rule to build HTML manpages and tar them up +html: amanda.css index.php $(ALL_MAN_HTMLS) + tar -zcf html.tar.gz $(ALL_MAN_HTMLS) amanda.css index.php + # double-check that we don't ship dummy manpages dist-hook: for f in $(WANTED_MAN_PAGES); do \ diff --git a/man/amaddclient.8 b/man/amaddclient.8 index c83ddcc..0857293 100644 --- a/man/amaddclient.8 +++ b/man/amaddclient.8 @@ -1,11 +1,11 @@ .\" Title: amaddclient .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMADDCLIENT" "8" "05/14/2008" "" "" +.TH "AMADDCLIENT" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -209,4 +209,4 @@ The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.c \fBssh-keygen\fR(1) \fBssh-add\fR(1) \fBscp\fR(1) -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amadmin.8 b/man/amadmin.8 index cb38aec..871d679 100644 --- a/man/amadmin.8 +++ b/man/amadmin.8 @@ -1,11 +1,11 @@ .\" Title: amadmin .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMADMIN" "8" "05/14/2008" "" "" +.TH "AMADMIN" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -144,7 +144,6 @@ The \fB\-\-sort\fR option changes the sort order using the following flags: .sp -.RS 4 .nf \fIh\fR: host name \fIk\fR: disk name @@ -153,7 +152,6 @@ option changes the sort order using the following flags: \fIp\fR: dump part \fIb\fR: tape label .fi -.RE .sp An uppercase letter reverses the sort order for that key\. The default sort order is \fBhkdlpb\fR\. @@ -263,23 +261,18 @@ Request three specific file systems on get a full level 0 backup during the next \fIAmanda\fR run\. -.sp -.RS 4 .nf $ amadmin daily force machine\-a / /var /usr amadmin: machine\-a:/ is set to a forced level 0 tonight\. amadmin: machine\-a:/var is set to a forced level 0 tonight\. amadmin: machine\-a:/usr is set to a forced level 0 tonight\. .fi -.RE .PP Request all file systems on \fImachine\-b\fR get a full level 0 backup during the next \fIAmanda\fR run\. -.sp -.RS 4 .nf $ amadmin daily force machine\-b amadmin: machine\-b:/ is set to a forced level 0 tonight\. @@ -287,7 +280,6 @@ amadmin: machine\-b:/var is set to a forced level 0 tonight\. amadmin: machine\-b:/usr is set to a forced level 0 tonight\. amadmin: machine\-b:/home is set to a forced level 0 tonight\. .fi -.RE .PP Undo the previous \fBforce\fR @@ -295,13 +287,10 @@ request for \fI/home\fR on \fImachine\-b\fR\. The other file systems will still get a full level 0 backup\. -.sp -.RS 4 .nf $ amadmin daily unforce machine\-b /home amadmin: force command for machine\-b:/home cleared\. .fi -.RE .PP Locate backup images of \fI/var\fR @@ -313,8 +302,6 @@ column displays either a tape label or a filename depending on whether the image column tells you which file on the tape has the image (file number zero is a tape label)\. This column shows zero and is not meaningful if the image is still in the holding disk\. The \fIstatus\fR column tells you whether the backup was successful or had some type of error\. -.sp -.RS 4 .nf $ amadmin daily find machine\-c /var date host disk lv tape or file file part status @@ -329,7 +316,6 @@ date host disk lv tape or file file part status 2000\-11\-01 machine\-c /var 1 000102 5 \-\- OK 2000\-10\-31 machine\-c /var 1 000101 3 \-\- OK .fi -.RE .PP Forget about the \fI/workspace\fR @@ -339,26 +325,20 @@ disk on file, \fIAmanda\fR will treat it as a new disk during the next run\. -.sp -.RS 4 .nf $ amadmin daily delete machine\-d /workspace amadmin: machine\-d:/workspace deleted from database\. amadmin: NOTE: you\'ll have to remove these from the disklist yourself\. .fi -.RE .PP Find the next tape \fIAmanda\fR will use (in this case, 123456)\. -.sp -.RS 4 .nf $ amadmin daily tape The next \fIAmanda\fR run should go onto tape 123456 or a new tape\. .fi -.RE .PP Show how well full backups are balanced across the dump cycle\. The \fIdue\-date\fR @@ -383,8 +363,6 @@ The last line also shows an estimate of how many runs will be made between full backups for a file system\. In the example, a file system will probably have a full backup done every eight times \fIAmanda\fR is run (e\.g\. every eight days)\. -.sp -.RS 4 .nf $ amadmin daily balance due\-date #fs orig KB out KB balance @@ -402,7 +380,6 @@ $ amadmin daily balance \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- TOTAL 241 12412187 7316312 731631 (estimated 8 runs per dumpcycle) .fi -.RE .SH "FILES" .PP /usr/local/etc/amanda/\fIconfig\fR/amanda\.conf @@ -422,4 +399,4 @@ Stefan G\. Weichinger, \fBamdump\fR(8), \fBamrestore\fR(8), \fBamfetchdump\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amaespipe.8 b/man/amaespipe.8 index 13dd165..5bf7451 100644 --- a/man/amaespipe.8 +++ b/man/amaespipe.8 @@ -1,11 +1,11 @@ .\" Title: amaespipe .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMAESPIPE" "8" "05/14/2008" "" "" +.TH "AMAESPIPE" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -25,7 +25,7 @@ requires and \fBgpg\fR to work\. Aespipe is available from -\fI\%http://loop-aes.sourceforge.net\fR +: http://loop-aes.sourceforge.net .PP \fBamaespipe\fR @@ -53,4 +53,4 @@ autodects encryption type and hash function from the encrypted image\. \fBaespipe\fR(1), \fBamcrypt\fR(8), \fBgpg\fR(1), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amanda-client.conf.5 b/man/amanda-client.conf.5 index 83d9978..fb15d22 100644 --- a/man/amanda-client.conf.5 +++ b/man/amanda-client.conf.5 @@ -1,11 +1,11 @@ .\" Title: amanda-client.conf .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMANDA\-CLIENT\.CONF" "5" "05/14/2008" "" "" +.TH "AMANDA\-CLIENT\.CONF" "5" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -298,4 +298,4 @@ Stefan G\. Weichinger, \fBamanda.conf\fR(5), \fBamcrypt\fR(8), \fBaespipe\fR(1), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amanda.8 b/man/amanda.8 index 15dbba4..ef16e72 100644 --- a/man/amanda.8 +++ b/man/amanda.8 @@ -1,11 +1,11 @@ .\" Title: amanda .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMANDA" "8" "05/14/2008" "" "" +.TH "AMANDA" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -396,12 +396,9 @@ The \fIdisklist\fR file determines which disks will be backed up by \fIAmanda\fR\. The file usually contains one line per disk: -.sp -.RS 4 .nf \fIhostname diskname\fR [\fIdiskdevice\fR] \fIdumptype\fR [\fIspindle\fR [\fIinterface\fR] ] .fi -.RE .PP All pairs [ \fIhostname diskname\fR @@ -505,15 +502,12 @@ For instance, if a named \fInormal\fR is used for most disks, but use of the holding disk needs to be disabled for the file system that holds it, this would work instead of defining a new dumptype: -.sp -.RS 4 .nf \fIhostname diskname\fR [ \fIdiskdevice\fR ] { normal holdingdisk never } [ \fIspindle\fR [ \fIinterface\fR ] ] .fi -.RE .SH "TAPE MANAGEMENT" .PP The @@ -522,11 +516,9 @@ file contains the list of tapes in active use\. This file is maintained entirely \fIAmanda\fR and should not be created or edited during normal operation\. It contains lines of the form: .PP -.RS 4 .nf YYYYMMDD label flags .fi -.RE .PP Where \fIYYYYMMDD\fR @@ -581,20 +573,15 @@ This is the default driver\. The \fIdriver\-info\fR is the tape device name\. Entering .sp -.RS 4 .nf tapedev /dev/rmt/0mn .fi -.RE -.sp is really a short hand for .sp -.RS 4 .nf tapedev tape:/dev/rmt/0mn .fi .RE -.RE .PP \fInull\fR .RS 4 @@ -606,11 +593,9 @@ checks for and allows through regardless of what you have set in field is not used and may be left blank: .sp .sp -.RS 4 .nf tapedev null: .fi -.RE .sp The \fIlength\fR @@ -641,11 +626,9 @@ The field describes the devices to use\. Curly braces indicate multiple replacements in the string\. For instance: .sp .sp -.RS 4 .nf tapedev rait:/dev/rmt/tps0d{4,5,6}n .fi -.RE .sp would use the following devices: .sp @@ -784,13 +767,10 @@ needs a file on the Samba server (which may or may not also be the tape server) \fI/etc/amandapass\fR with share names, (clear text) passwords and (optional) domain names, in that order, one per line, whitespace separated\. By default, the user used to connect to the PC is the same for all PC\'s and is compiled into \fIAmanda\fR\. It may be changed on a host by host basis by listing it first in the password field followed by a percent sign and then the password\. For instance: -.sp -.RS 4 .nf //some\-pc/home normalpw //another\-pc/disk otheruser%otherpw .fi -.RE With clear text passwords, this file should obviously be tightly protected\. It only needs to be readable by the \fIAmanda\fR\-user on the Samba server\. .sp @@ -1117,12 +1097,9 @@ For global options, \fIname\fR is simply the name of the option, e\.g\., .sp -.RS 4 .nf amdump \-oruntapes=2 .fi -.RE -.sp For options in a named section of the configuration, \fIname\fR has the form @@ -1132,24 +1109,19 @@ is one of TAPETYPE, DUMPTYPE, HOLDINGDISK, or INTERFACE, and \fIsection_name\fR is the name of the tapetype, dumptype, holdingdisk, or interface\. Examples: .sp -.RS 4 .nf amdump \-o TAPETYPE:HP\-DAT:length=2000m amdump \-o DUMPTYPE:no\-compress:compress="server fast" amdump \-o HOLDINGDISK:hd1:use="\-100 mb" amdump \-o INTERFACE:local:use="2000 kbps" .fi -.RE .PP Note that configuration overrides are not effective for tape changers, which supply a tapedev based on their own configuration\. In order to override \fItapedev\fR, you must also disable any changer: .sp -.RS 4 .nf amdump \-otapedev=/dev/nst1 \-otpchanger=\'\' .fi -.RE -.sp .SH "AUTHOR" .PP James da Silva, @@ -1188,4 +1160,4 @@ Stefan G\. Weichinger, \fBamcheckdump\fR(8), \fBamserverconfig\fR(8), \fBamaddclient\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amanda.conf.5 b/man/amanda.conf.5 index 3e5ea96..31e7d46 100644 --- a/man/amanda.conf.5 +++ b/man/amanda.conf.5 @@ -1,11 +1,11 @@ .\" Title: amanda.conf .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMANDA\.CONF" "5" "05/14/2008" "" "" +.TH "AMANDA\.CONF" "5" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -259,12 +259,8 @@ option set to These options can set various device properties, including block size, maximum volume usage, authentication information, hardware feature support, and more\.Specifics of how properties are used are device\-dependent, though some common properties are supported across multiple device drivers\. .sp Both strings are quoted; the first string contains the name of the property to set, and the second contains its value\. For example, to set a fixed block size of 128k, do: -.sp -.RS 4 .nf -device_property "BLOCK_SIZE" "131072" -.fi -.RE +device_property "BLOCK_SIZE" "131072".fi .sp The order in which device properties are set is as follows: .sp @@ -462,7 +458,6 @@ Default: Default: \fItttTTTTTTT\fR\. The priority order of each dumper: .sp -.RS 4 .nf s: smallest size S: largest size @@ -472,7 +467,6 @@ b: smallest bandwidth B: largest bandwidth .fi .RE -.RE .PP \fBmaxdumps\fR int .RS 4 @@ -661,8 +655,6 @@ is a comma (\',\') separated list of triples\. Each triple consists of three par .sp .RS 4 \h'-04' 1.\h'+02'the name of the column, which may be: -.sp -.RS 4 .nf Compress (compression ratio) Disk (client disk name) @@ -674,9 +666,7 @@ is a comma (\',\') separated list of triples\. Each triple consists of three par OutKB (output image size in KBytes) TapeRate (tape writing rate in KBytes/sec) TapeTime (total tape time in hours:minutes) - -.fi -.RE + .fi .RE .sp .RS 4 @@ -690,11 +680,9 @@ is a comma (\',\') separated list of triples\. Each triple consists of three par .IP "" 4 Here is an example: .sp -.RS 4 .nf columnspec "Disk=1:18,HostName=0:10,OutKB=1:7" .fi -.RE .sp The above will display the disk information in 18 characters and put one space before it\. The hostname column will be 10 characters wide with no space to the left\. The output KBytes column is seven characters wide with one space before it\. .RE @@ -865,15 +853,12 @@ Default: \-\-with\-tcpportrange or The \fBamanda\.conf\fR file may define one or more holding disks used as buffers to hold backup images before they are written to tape\. The syntax is: -.sp -.RS 4 .nf holdingdisk \fIname\fR { \fIholdingdisk\-option\fR \fIholdingdisk\-value\fR \.\.\. } .fi -.RE .PP \fIName\fR is a logical name for this holding disk\. @@ -926,15 +911,12 @@ file\. For instance, one set of options might be defined for file systems that c A set of backup options are entered in a \fBdumptype\fR section, which looks like this: -.sp -.RS 4 .nf define dumptype \fIname\fR { \fIdumptype\-option\fR \fIdumptype\-value\fR \.\.\. } .fi -.RE .PP \fIName\fR is the name of this set of backup options\. It is referenced from the @@ -1254,12 +1236,9 @@ is specified for .sp For \fBexclude list\fR, if the file name is relative, the disk name being backed up is prepended\. So if this is entered: -.sp -.RS 4 .nf exclude list "\.amanda\.excludes" .fi -.RE the actual file used would be \fI/var/\.amanda\.excludes\fR for a backup of @@ -1508,8 +1487,6 @@ The following \fBdumptype\fR entries are predefined by \fIAmanda\fR: -.sp -.RS 4 .nf define dumptype no\-compress { compress none @@ -1539,7 +1516,6 @@ define dumptype no\-full { skip\-full yes } .fi -.RE .PP In addition to options in a \fBdumptype\fR @@ -1551,8 +1527,6 @@ inherit options from other previously defined \fBdumptype\fRs\. For instance, two sections might be the same except for the \fBrecord\fR option: -.sp -.RS 4 .nf define dumptype normal { comment "Normal backup, no compression, do indexing" @@ -1566,7 +1540,6 @@ define dumptype testing { record no } .fi -.RE .PP \fIAmanda\fR provides a @@ -1585,15 +1558,12 @@ The file may define multiple types of tape media and devices\. The information is entered in a \fBtapetype\fR section, which looks like this in the config file: -.sp -.RS 4 .nf define tapetype \fIname\fR { \fItapetype\-option\fR \fItapetype\-value\fR \.\.\. } .fi -.RE .PP \fIName\fR is the name of this type of tape medium/device\. It is referenced from the @@ -1685,8 +1655,6 @@ name may be entered, which makes this \fBtapetype\fR inherit options from another \fBtapetype\fR\. For instance, the only difference between a DLT4000 tape drive using Compact\-III tapes and one using Compact\-IV tapes is the length of the tape\. So they could be entered as: -.sp -.RS 4 .nf define tapetype DLT4000\-III { comment "DLT4000 tape drives with Compact\-III tapes" @@ -1700,8 +1668,6 @@ define tapetype DLT4000\-IV { length 25000 mbytes # 20 Gig tapes with some compression } .fi -.RE -.sp .SH "INTERFACE SECTION" .PP The @@ -1709,15 +1675,12 @@ The file may define multiple types of network interfaces\. The information is entered in an \fBinterface\fR section, which looks like this: -.sp -.RS 4 .nf define interface \fIname\fR { \fIinterface\-option\fR \fIinterface\-value\fR \.\.\. } .fi -.RE .PP \fIname\fR is the name of this type of network interface\. It is referenced from the @@ -1766,6 +1729,4 @@ Stefan G\. Weichinger, \fBamanda-client.conf\fR(5), \fBamcrypt\fR(8), \fBaespipe\fR(1), -\fI\%http://wiki.zmanda.com\fR -.PP -An updated version of this man page may be available at http://wiki\.zmanda\.com/index\.php/Amanda\.conf\. +: http://wiki.zmanda.com diff --git a/man/amanda.css b/man/amanda.css new file mode 100644 index 0000000..d6ee054 --- /dev/null +++ b/man/amanda.css @@ -0,0 +1,48 @@ +/* Taken from the Zmanda wiki, for at least a little bit of visual continuity */ +body { + font: small sans-serif; + background: #82B1C8 0 0 no-repeat; + color: black; +} + +div.refentry { + background: white; + margin-left: 11em; + margin-top: 2em; + padding: .6em; + padding-top: 0; + border: thin gray ridge; +} + +pre { + padding: 1em; + border: 1px dashed #2f6fab; + color: black; + background-color: #f9f9f9; + line-height: 1.1em; +} + +/* browsers override this for some reason */ +table { + font-size: small; +} + +h1, h2, h3, h4, h5, h6 { + color: black; + background: none; + font-weight: normal; + margin: 0; + padding-top: .5em; + padding-bottom: .17em; + border-bottom: 1px solid #5C706D; +} +h1 { font-size: 188%; } +h2 { font-size: 150%; } +h3, h4, h5, h6 { + border-bottom: none; + font-weight: bold; +} +h3 { font-size: 132%; } +h4 { font-size: 116%; } +h5 { font-size: 100%; } +h6 { font-size: 80%; } diff --git a/man/amcheck.8 b/man/amcheck.8 index e7fab67..e4d7f6f 100644 --- a/man/amcheck.8 +++ b/man/amcheck.8 @@ -1,11 +1,11 @@ .\" Title: amcheck .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMCHECK" "8" "05/14/2008" "" "" +.TH "AMCHECK" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -116,8 +116,6 @@ The default is .SH "EXAMPLES" .PP In this example, both the tape server and client tests are run\. The results are displayed on standard output\. -.sp -.RS 4 .nf % amcheck daily \fIAmanda\fR Tape Server Host Check @@ -136,7 +134,6 @@ Client check: 136 hosts checked in 51\.945 seconds, 3 problems found\. (brought to you by \fIAmanda\fR 2\.5\.0) .fi -.RE .PP In this example, if the line \fBmailto csd\-amanda\fR @@ -144,12 +141,9 @@ is in \fIamanda\.conf\fR, mail will be sent to \fBcsd\-amanda\fR if the server check returns an error\. -.sp -.RS 4 .nf % amcheck \-s \-m daily .fi -.RE .SH "MESSAGES" .PP fatal slot \fIslot\fR: \fIerror message\fR @@ -679,6 +673,13 @@ ERROR: \fIhost\fR: \fImessage\fR was reported by the status check on \fIhost\fR\. .RE +.SH "EXIT CODE" + +The exit code of \fBamcheck\fR is one of: +.nf + 0 = success + 1 = error +.fi .SH "AUTHOR" .PP James da Silva, @@ -692,4 +693,4 @@ Stefan G\. Weichinger, .PP \fBamanda\fR(8), \fBamdump\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amcheckdb.8 b/man/amcheckdb.8 index 4d273e0..754c312 100644 --- a/man/amcheckdb.8 +++ b/man/amcheckdb.8 @@ -1,11 +1,11 @@ .\" Title: amcheckdb .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMCHECKDB" "8" "05/14/2008" "" "" +.TH "AMCHECKDB" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -31,27 +31,21 @@ man page for more details about .SH "EXAMPLE" .PP This shows a normal response: -.sp -.RS 4 .nf # amcheckdb daily Ready\. .fi -.RE .PP This shows tape \fIDMP014\fR is still listed in the database but is no longer listed in the \fItapelist\fR file: -.sp -.RS 4 .nf # amcheckdb daily Tape DMP014 missing in /usr/local/etc/amanda//daily/tapelist Ready\. .fi -.RE .SH "AUTHOR" .PP Adrian T\. Filipi\-Martin : Original text @@ -64,4 +58,4 @@ Stefan G\. Weichinger, \fBamadmin\fR(8), \fBamrmtape\fR(8), \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amcheckdump.8 b/man/amcheckdump.8 index e9340ad..4371b83 100644 --- a/man/amcheckdump.8 +++ b/man/amcheckdump.8 @@ -1,11 +1,11 @@ .\" Title: amcheckdump .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMCHECKDUMP" "8" "05/14/2008" "" "" +.TH "AMCHECKDUMP" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -38,10 +38,9 @@ option\. .SH "SEE ALSO" .PP \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com .SH "EXAMPLE" .PP -.RS 4 .nf # check the most recent dump amcheckdump MYCONFIG @@ -49,7 +48,6 @@ amcheckdump MYCONFIG # check a specific dump from back in \'78 amcheckdump MYCONFIG \-\-timestamp 19780615 .fi -.RE .SH "SEE ALSO" .PP \fBamanda\fR(8), diff --git a/man/amcleanup.8 b/man/amcleanup.8 index 666d26a..04dc0f8 100644 --- a/man/amcleanup.8 +++ b/man/amcleanup.8 @@ -1,11 +1,11 @@ .\" Title: amcleanup .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMCLEANUP" "8" "05/14/2008" "" "" +.TH "AMCLEANUP" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -50,33 +50,24 @@ Generate verbose output\. This example runs the \fIAmanda\fR cleanup process by hand after a failure\. -.sp -.RS 4 .nf % amcleanup daily .fi -.RE .PP Putting the following line in a system boot script (e\.g\. \fI/etc/rc\.local\fR) runs the \fIAmanda\fR cleanup process as part of the reboot, eliminating the need to run it by hand\. -.sp -.RS 4 .nf /usr/local/sbin/amcleanup daily .fi -.RE .PP If nothing needs to be done, \fBamcleanup\fR exits normally with the message: -.sp -.RS 4 .nf amcleanup: no unprocessed logfile to clean up\. .fi -.RE .SH "AUTHOR" .PP James da Silva, @@ -89,4 +80,4 @@ Stefan G\. Weichinger, .PP \fBamanda\fR(8), \fBamdump\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amcrypt-ossl-asym.8 b/man/amcrypt-ossl-asym.8 index d01a04c..6971d8d 100644 --- a/man/amcrypt-ossl-asym.8 +++ b/man/amcrypt-ossl-asym.8 @@ -1,11 +1,11 @@ .\" Title: amcrypt-ossl-asym .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMCRYPT\-OSSL\-ASYM" "8" "05/14/2008" "" "" +.TH "AMCRYPT\-OSSL\-ASYM" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -22,7 +22,7 @@ amcrypt-ossl-asym - crypt program for Amanda asymmetric data encryption using Op uses \fBOpenSSL\fR to encrypt and decrypt data\. OpenSSL is available from -\fIwww\.openssl\.org\fR\&[1]\. OpenSSL offers a wide variety of cipher choices ( +www\.openssl\.org\. OpenSSL offers a wide variety of cipher choices ( \fBamcrypt\-ossl\-asym\fR defaults to 256\-bit AES) and can use hardware cryptographic accelerators on several platforms\. .PP @@ -32,8 +32,6 @@ will search for the OpenSSL program in the following directories: /bin:/usr/bin: .SH "GENERATING PUBLIC AND PRIVATE KEYS" .PP RSA keys can be generated with the standard OpenSSL commands, e\.g\.: -.sp -.RS 4 .nf $ cd /var/lib/amanda $ openssl genrsa \-aes128 \-out backup\-privkey\.pem 1024 @@ -45,9 +43,7 @@ Verifying \- Enter pass phrase for backup\-key\.pem: \fIENTER YOUR PASS PHRASE\f $ openssl rsa \-in backup\-privkey\.pem \-pubout \-out backup\-pubkey\.pem Enter pass phrase for backup\-privkey\.pem: \fIENTER YOUR PASS PHRASE\fR Writing RSA key - .fi -.RE .PP To generate a private key without a passphrase, omit the \fB\-aes128\fR @@ -69,7 +65,7 @@ is used to decrypt data, and must be protected\. Encrypted backup data cannot be While the public key must be online at all times to perorm backups, the private key and optional passphrase are only needed to restore data\. It is recommended that the latter be stored offline all other times\. For example, you could keep the private key on removable media, and copy it into place for a restore; or you could keep the private key online, encrypted with a passphrase that is present only for a restore\. .PP OpenSSL\'s key derivation routines use a salt to guard against dictionary attacks on the pass phrase; still it is important to pick a pass phrase that is hard to guess\. The Diceware method (see -\fIwww\.diceware\.com\fR\&[2]) can be used to create passphrases that are difficult to guess and easy to remember\. +www\.diceware\.com) can be used to create passphrases that are difficult to guess and easy to remember\. .SH "FILES" .PP /var/lib/amanda/backup\-privkey\.pem @@ -97,7 +93,7 @@ user\. \fBamanda.conf\fR(5), \fBopenssl\fR(1), \fBamcrypt-ossl\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com .SH "NOTES" .IP " 1." 4 www.openssl.org diff --git a/man/amcrypt-ossl.8 b/man/amcrypt-ossl.8 index cfa338f..9e4903c 100644 --- a/man/amcrypt-ossl.8 +++ b/man/amcrypt-ossl.8 @@ -1,11 +1,11 @@ .\" Title: amcrypt-ossl .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMCRYPT\-OSSL" "8" "05/14/2008" "" "" +.TH "AMCRYPT\-OSSL" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -22,7 +22,7 @@ amcrypt-ossl - crypt program for Amanda symmetric data encryption using OpenSSL uses \fBOpenSSL\fR to encrypt and decrypt data\. OpenSSL is available from -\fIwww\.openssl\.org\fR\&[1]\. OpenSSL offers a wide variety of cipher choices ( +www\.openssl\.org\. OpenSSL offers a wide variety of cipher choices ( \fBamcrypt\-ossl\fR defaults to 256\-bit AES) and can use hardware cryptographic accelerators on several platforms\. .PP @@ -38,7 +38,7 @@ uses the same pass phrase to encrypt and decrypt data\. It is very important to be recovered with the correct passphrase\. .PP OpenSSL\'s key derivation routines use a salt to guard against dictionary attacks on the pass phrase; still it is important to pick a pass phrase that is hard to guess\. The Diceware method (see -\fIwww\.diceware\.com\fR\&[2]) can be used to create passphrases that are difficult to guess and easy to remember\. +www\.diceware\.com) can be used to create passphrases that are difficult to guess and easy to remember\. .SH "FILES" .PP /var/lib/amanda/\.am_passphrase @@ -54,7 +54,7 @@ user\. \fBamanda.conf\fR(5), \fBopenssl\fR(1), \fBamcrypt-ossl-asym\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com .SH "NOTES" .IP " 1." 4 www.openssl.org diff --git a/man/amcrypt.8 b/man/amcrypt.8 index 36dae74..9b3276f 100644 --- a/man/amcrypt.8 +++ b/man/amcrypt.8 @@ -1,11 +1,11 @@ .\" Title: amcrypt .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMCRYPT" "8" "05/14/2008" "" "" +.TH "AMCRYPT" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -25,7 +25,7 @@ requires and \fBgpg\fR to work\. Aespipe is available from -\fI\%http://loop-aes.sourceforge.net\fR +: http://loop-aes.sourceforge.net .PP \fBamcrypt\fR @@ -47,14 +47,11 @@ head \-c 2925 /dev/random | uuencode \-m \- | head \-n 66 | tail \-n 65 \e | gpg This will ask for a passphrase\. Remember this passphrase as you will need it in the next step\. .PP 2\. Store the passphrase inside the home\-directory of the AMANDA\-user and protect it with proper permissions: -.sp -.RS 4 .nf echo my_secret_passphrase > ~amanda/\.am_passphrase chown amanda:disk ~amanda/\.am_passphrase chmod 700 ~amanda/\.am_passphrase .fi -.RE .SH "KEY AND PASSPHRASE" .PP @@ -71,4 +68,4 @@ be recovered with the correct key and passphrase\. \fBaespipe\fR(1), \fBamaespipe\fR(8), \fBgpg\fR(1), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amcryptsimple.8 b/man/amcryptsimple.8 index 2ca624e..cecbd1f 100644 --- a/man/amcryptsimple.8 +++ b/man/amcryptsimple.8 @@ -1,11 +1,11 @@ .\" Title: amcryptsimple .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMCRYPTSIMPLE" "8" "05/14/2008" "" "" +.TH "AMCRYPTSIMPLE" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -63,4 +63,4 @@ The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.c \fBamgpgcrypt\fR(8), \fBamrestore\fR(8), \fBgpg\fR(1), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amdd.8 b/man/amdd.8 index 545a2cd..55382d4 100644 --- a/man/amdd.8 +++ b/man/amdd.8 @@ -1,11 +1,11 @@ .\" Title: amdd .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMDD" "8" "05/14/2008" "" "" +.TH "AMDD" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -118,4 +118,4 @@ Stefan G\. Weichinger, .PP \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amdevcheck.8 b/man/amdevcheck.8 index a0602e2..a9b403e 100644 --- a/man/amdevcheck.8 +++ b/man/amdevcheck.8 @@ -1,11 +1,11 @@ .\" Title: amdevcheck .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMDEVCHECK" "8" "05/14/2008" "" "" +.TH "AMDEVCHECK" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -66,4 +66,4 @@ and others\. Authorship of this tool and its documentation was funded by Zmanda, \fBamanda\fR(8), \fBammt\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amdump.8 b/man/amdump.8 index 01fa1ac..90b963c 100644 --- a/man/amdump.8 +++ b/man/amdump.8 @@ -1,11 +1,11 @@ .\" Title: amdump .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMDUMP" "8" "05/14/2008" "" "" +.TH "AMDUMP" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -57,12 +57,9 @@ Here is a typical crontab entry\. It runs \fBamdump\fR every weeknight at 1 a\.m\. as user \fBbin\fR: -.sp -.RS 4 .nf 0 1 * * 1\-5 bin /usr/local/sbin/amdump daily .fi -.RE .PP Please see the \fBcrontab\fR(5) @@ -93,6 +90,17 @@ run\. This run is terminated\. If the problem is caused by the remains of a prev and then rerun \fBamdump\fR\. .RE +.SH "EXIT CODE" + +The exit code of \fBamdump\fR is the ORed value of: +.nf + 0 = success + 1 = error + 2 = a dle give strange message + 4 = a dle failed + 8 = Don\'t know the status of a dle (RESULT_MISSING in the report) + 16 = tape error or no more tape +.fi .SH "AUTHOR" .PP James da Silva, @@ -111,4 +119,4 @@ Stefan G\. Weichinger, \fBamrestore\fR(8), \fBamflush\fR(8), \fBcron\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amfetchdump.8 b/man/amfetchdump.8 index a2a3bc0..9035990 100644 --- a/man/amfetchdump.8 +++ b/man/amfetchdump.8 @@ -1,11 +1,11 @@ .\" Title: amfetchdump .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMFETCHDUMP" "8" "05/14/2008" "" "" +.TH "AMFETCHDUMP" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -164,4 +164,4 @@ Ian Turner, \fBamrestore\fR(8), \fBtar\fR(1), \fBrestore\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amflush.8 b/man/amflush.8 index e7d665d..7568e40 100644 --- a/man/amflush.8 +++ b/man/amflush.8 @@ -1,11 +1,11 @@ .\" Title: amflush .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMFLUSH" "8" "05/14/2008" "" "" +.TH "AMFLUSH" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -106,8 +106,6 @@ configuration\. After you select which holding area to flush, \fBamflush\fR writes the data to tape, updates the databases and sends a mail report similar to \fBamdump\fR(8)\. -.sp -.RS 4 .nf % amflush daily Scanning /amanda\-hold\.\.\. @@ -127,7 +125,16 @@ Are you sure you want to do this? yes Running in background, you can log off now\. You\'ll get mail when amflush is finished\. .fi -.RE +.SH "EXIT CODE" + +The exit code of \fBamflush\fR is the ORed value of: +.nf + 0 = success + 1 = error + 4 = a dle failed + 8 = Don\'t know the status of a dle (RESULT_MISSING in the report) + 16 = tape error or no more tape +.fi .SH "AUTHOR" .PP James da Silva, @@ -142,4 +149,4 @@ Stefan G\. Weichinger, \fBamanda\fR(8), \fBamdump\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amgetconf.8 b/man/amgetconf.8 index 0c57f4f..753a845 100644 --- a/man/amgetconf.8 +++ b/man/amgetconf.8 @@ -1,11 +1,11 @@ .\" Title: amgetconf .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMGETCONF" "8" "05/14/2008" "" "" +.TH "AMGETCONF" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -168,4 +168,4 @@ keyword)\. .PP \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amgpgcrypt.8 b/man/amgpgcrypt.8 index bb71017..ad36e69 100644 --- a/man/amgpgcrypt.8 +++ b/man/amgpgcrypt.8 @@ -1,11 +1,11 @@ .\" Title: amgpgcrypt .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMGPGCRYPT" "8" "05/14/2008" "" "" +.TH "AMGPGCRYPT" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -56,8 +56,6 @@ Store the passphrase that you used in following "gpg \-\-gen\-key" command insid chmod 700 ~$amanda_user/\.am_passphrase .PP Run "gpg \-\-gen\-key"\. Below is an example: -.sp -.RS 4 .nf $ gpg \-\-gen\-key gpg (GnuPG) 1\.2\.6; Copyright (C) 2004 Free Software Foundation, Inc\. @@ -116,9 +114,7 @@ key marked as ultimately trusted\. pub 1024D/4417A8CB 2006\-02\-07 amandabackup (gpg keys for amandabackup) Key fingerprint = 139C 6369 44FC 7F1A 655C E5E9 7EAA 515A 4417 A8CB sub 1024g/8C3A6A78 2006\-02\-07 [expires: 2006\-08\-06] - .fi -.RE .SH "FILES" .PP \fB$AMANDA_HOME/\.gnupg/pubring\.gpg\fR @@ -154,4 +150,4 @@ The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.c \fBamcrypt\fR(8), \fBamrestore\fR(8), \fBgpg\fR(1), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amlabel.8 b/man/amlabel.8 index 5c738b9..f57e013 100644 --- a/man/amlabel.8 +++ b/man/amlabel.8 @@ -1,11 +1,11 @@ .\" Title: amlabel .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMLABEL" "8" "05/14/2008" "" "" +.TH "AMLABEL" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -81,20 +81,14 @@ Write an label with the string "DMP000" on the tape loaded in the device named in the \fBtapedev\fR option in /usr/local/etc/amanda/daily/amanda\.conf: -.sp -.RS 4 .nf % amlabel daily DMP000 .fi -.RE .PP Label the tape in slot 3 of the currently configured tape changer with the string "DMP003": -.sp -.RS 4 .nf % amlabel daily DMP003 slot 3 .fi -.RE .SH "MESSAGES" .PP label \fIlabel\fR doesn\'t match labelstr \fIstr\fR @@ -171,4 +165,4 @@ Stefan G\. Weichinger, \fBamanda\fR(8), \fBamdump\fR(8), \fBamflush\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/ammt.8 b/man/ammt.8 index a8acd7b..1283e23 100644 --- a/man/ammt.8 +++ b/man/ammt.8 @@ -1,11 +1,11 @@ .\" Title: ammt .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMMT" "8" "05/14/2008" "" "" +.TH "AMMT" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -180,4 +180,4 @@ Stefan G\. Weichinger, .SH "SEE ALSO" .PP \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amoverview.8 b/man/amoverview.8 index 18bd4b6..4ba2aaa 100644 --- a/man/amoverview.8 +++ b/man/amoverview.8 @@ -1,11 +1,11 @@ .\" Title: amoverview .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMOVERVIEW" "8" "05/14/2008" "" "" +.TH "AMOVERVIEW" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -103,8 +103,6 @@ This shows the file system on \fIhost2\fR was backed up at level 3 on the 8th, 9th and 10th of December, had a full backup on the 11th, a level 1 on the 12th and a level 2 on the 13th\. -.sp -.RS 4 .nf # amoverview date 12 12 12 12 12 12 @@ -117,9 +115,8 @@ host2 /home 3 3 3 0 1 2 host2 /opt 1 1 1 1 1 1 host2 /var 1 1 0 1 1 1 .fi -.RE .SH "SEE ALSO" .PP \fBamadmin\fR(8), \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amplot.8 b/man/amplot.8 index 4b3c379..6da1ecf 100644 --- a/man/amplot.8 +++ b/man/amplot.8 @@ -1,11 +1,11 @@ .\" Title: amplot .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMPLOT" "8" "05/14/2008" "" "" +.TH "AMPLOT" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -159,4 +159,4 @@ Reports lines it does not recognize, mainly error cases but some are legitimate \fBsh\fR(1), \fBcompress\fR(1), \fBgzip\fR(1), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amrecover.8 b/man/amrecover.8 index ece641d..01608fb 100644 --- a/man/amrecover.8 +++ b/man/amrecover.8 @@ -1,11 +1,11 @@ .\" Title: amrecover .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMRECOVER" "8" "05/14/2008" "" "" +.TH "AMRECOVER" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -169,15 +169,10 @@ If you want amrecover to use your changer, the must be equal to the amrecover_changer setting on the server\. .sp If you need to change the protocol (tape:, rait:, file:, null:) then you must specify the hostname\. -.sp -.RS 4 .nf settape 192\.168\.0\.10:file:/file1 .fi -.RE You can change the tape device when amrecover ask you to load the tape: -.sp -.RS 4 .nf Load tape DMP014 now Continue? [Y/n/t]: t @@ -186,7 +181,6 @@ Continue? [Y/n/t]: Y Using tape /dev/nst2 from server server2\. .fi .RE -.RE .PP \fBsetmode\fR \fImode\fR .RS 4 @@ -314,8 +308,6 @@ Display a brief list of these commands\. The following shows the recovery of an old \fIsyslog\fR file\. -.sp -.RS 4 .nf # cd /var/log # ls \-l syslog\.7 @@ -368,13 +360,10 @@ amrecover> quit total 26 \-rw\-r\-\-r\-\- 1 root other 12678 Oct 14 16:36 syslog\.7 .fi -.RE .PP If you do not want to overwrite existing files, create a subdirectory to run \fBamrecover\fR from and then move the restored files afterward\. -.sp -.RS 4 .nf # cd /var # (umask 077 ; mkdir \.restore) @@ -400,7 +389,6 @@ amrecover> quit # cd \.\. # rm \-fr \.restore .fi -.RE .PP If you need to run \fBamrestore\fR @@ -409,8 +397,6 @@ by hand instead of letting control it, use the \fBlist\fR command after browsing to display the needed tapes\. -.sp -.RS 4 .nf # cd /var/log # amrecover @@ -430,15 +416,12 @@ TAPE DMP015 LEVEL 1 DATE 1997\-12\-09 /log/syslog amrecover> quit .fi -.RE .PP The \fBhistory\fR command shows each tape that has a backup of the current disk along with the date of the backup, the level, the tape label and the file position on the tape\. All active tapes are listed, not just back to the most recent full dump\. .PP Tape file position zero is a label\. The first backup image is in file position one\. -.sp -.RS 4 .nf # cd /var/log # amrecover @@ -459,7 +442,6 @@ amrecover> history \.\.\. amrecover> quit .fi -.RE .SH "ENVIRONMENT" .PP \fBPAGER\fR @@ -492,4 +474,4 @@ Stefan G\. Weichinger, \fBamrestore\fR(8), \fBamfetchdump\fR(8), \fBreadline\fR(3), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amreport.8 b/man/amreport.8 index be28b5b..d8feabb 100644 --- a/man/amreport.8 +++ b/man/amreport.8 @@ -1,11 +1,11 @@ .\" Title: amreport .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMREPORT" "8" "05/14/2008" "" "" +.TH "AMREPORT" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -118,8 +118,19 @@ provides label templates for the following tape types\. These are pretty generic .RE .PP The 3\-ring binder type is the most generic\. It may be used to make a hardcopy log of the tapes\. +.SH "EXIT CODE" + +The exit code of \fBamreport\fR is the ORed value of: +.nf + 0 = success + 1 = error + 2 = a dle give strange message + 4 = a dle failed + 8 = Don\'t know the status of a dle (RESULT_MISSING in the report) + 16 = tape error or no more tape +.fi .SH "SEE ALSO" .PP \fBamanda\fR(8), \fBamflush\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amrestore.8 b/man/amrestore.8 index df874ba..d7617d9 100644 --- a/man/amrestore.8 +++ b/man/amrestore.8 @@ -1,11 +1,11 @@ .\" Title: amrestore .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMRESTORE" "8" "05/14/2008" "" "" +.TH "AMRESTORE" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -262,4 +262,4 @@ Stefan G\. Weichinger, \fBamflush\fR(8), \fBtar\fR(1), \fBrestore\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amrmtape.8 b/man/amrmtape.8 index 44b7b04..e3f1cf7 100644 --- a/man/amrmtape.8 +++ b/man/amrmtape.8 @@ -1,11 +1,11 @@ .\" Title: amrmtape .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMRMTAPE" "8" "05/14/2008" "" "" +.TH "AMRMTAPE" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -59,12 +59,9 @@ Remove tape labeled from the \fIDailySet1\fR configuration\. -.sp -.RS 4 .nf # amrmtape DailySet1 DAILY034 .fi -.RE .SH "AUTHOR" .PP Adrian T\. Filipi\-Martin @@ -77,4 +74,4 @@ Stefan G\. Weichinger, .PP \fBamadmin\fR(8), \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amserverconfig.8 b/man/amserverconfig.8 index df32401..093899d 100644 --- a/man/amserverconfig.8 +++ b/man/amserverconfig.8 @@ -1,11 +1,11 @@ .\" Title: amserverconfig .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMSERVERCONFIG" "8" "05/14/2008" "" "" +.TH "AMSERVERCONFIG" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -178,4 +178,4 @@ The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.c \fBamanda\fR(8), \fBamanda.conf\fR(5), \fBamaddclient\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amstatus.8 b/man/amstatus.8 index 6a146ec..f17d645 100644 --- a/man/amstatus.8 +++ b/man/amstatus.8 @@ -1,11 +1,11 @@ .\" Title: amstatus .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMSTATUS" "8" "05/14/2008" "" "" +.TH "AMSTATUS" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -109,6 +109,16 @@ Display statistics about active\-time of taper and dumpers\. .RS 4 Output the date in a locale independent format\. The format is the same executing: date +\'%Y\-%m\-%d %H:%M:%S %Z\' .RE +.SH "EXIT CODE" + +The exit code of \fBamstatus\fR is the ORed value of: +.nf + 0 = success + 1 = error + 4 = a dle failed + 8 = Don\'t know the status of a dle (RESULT_MISSING in the report) + 16 = tape error or no more tape +.fi .SH "SEE ALSO" .PP \fBamanda\fR(8), @@ -116,4 +126,4 @@ Output the date in a locale independent format\. The format is the same executin \fBamdump\fR(8), \fBamrestore\fR(8), \fBamadmin\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amtape.8 b/man/amtape.8 index 6f3b5be..fcf3296 100644 --- a/man/amtape.8 +++ b/man/amtape.8 @@ -1,11 +1,11 @@ .\" Title: amtape .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMTAPE" "8" "05/14/2008" "" "" +.TH "AMTAPE" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -169,4 +169,4 @@ Stefan G\. Weichinger, .SH "SEE ALSO" .PP \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amtapetype.8 b/man/amtapetype.8 index 0c76c44..a4f0b70 100644 --- a/man/amtapetype.8 +++ b/man/amtapetype.8 @@ -1,11 +1,11 @@ .\" Title: amtapetype .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMTAPETYPE" "8" "05/14/2008" "" "" +.TH "AMTAPETYPE" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -95,4 +95,4 @@ used to sometimes report a negative file mark size if the math happened to end u .SH "SEE ALSO" .PP \fBamanda\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amtoc.8 b/man/amtoc.8 index e6bc640..045ff1d 100644 --- a/man/amtoc.8 +++ b/man/amtoc.8 @@ -1,11 +1,11 @@ .\" Title: amtoc .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMTOC" "8" "05/14/2008" "" "" +.TH "AMTOC" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -75,8 +75,6 @@ Marks the last option so the next parameter is the .SH "OUTPUT FORMAT" .PP The standard output has five fields separated by two spaces: -.sp -.RS 4 .nf # Server:/partition date level size[Kb] 0 daily\-05: 19991005 \- \- @@ -85,14 +83,9 @@ The standard output has five fields separated by two spaces: \.\.\. 103 cuisg11:/ 19991005 0 4139136 103 total: \- \- 16716288 - - .fi -.RE .PP In tabular format (\-t), this would look like: -.sp -.RS 4 .nf # Server:/partition date lev size[Kb] 0 daily\-05: 19991005 \- \- @@ -101,9 +94,7 @@ In tabular format (\-t), this would look like: \.\.\. 103 cuisg11:/ 19991005 0 4139136 103 total: \- \- 16716288 - .fi -.RE .SH "USAGE" .PP The easiest way to use it is to run @@ -112,12 +103,9 @@ right after \fIamdump\fR in the \fIcron job:\fR -.sp -.RS 4 .nf amdump daily ; logdir=`amgetconf daily logdir` ; log=`ls \-1t $logdir/log\.*\.[0\-9] | head \-1` ; amtoc \-a $log .fi -.RE .PP which will generate /usr/local/etc/amanda//daily/\fItape_label\fR\.toc\. You may also want to call \fBamtoc\fR @@ -129,7 +117,7 @@ after an \fBamdump\fR(8), \fBamflush\fR(8), \fBamgetconf\fR(8), cron, perl, -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com .SH "AUTHOR" .PP Nicolas Mayencourt diff --git a/man/amverify.8 b/man/amverify.8 index a4ac08d..d9ada11 100644 --- a/man/amverify.8 +++ b/man/amverify.8 @@ -1,11 +1,11 @@ .\" Title: amverify .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMVERIFY" "8" "05/14/2008" "" "" +.TH "AMVERIFY" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -61,4 +61,4 @@ Stefan G\. Weichinger, \fBamrestore\fR(8), \fBamanda\fR(8), \fBamverifyrun\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/amverifyrun.8 b/man/amverifyrun.8 index b80c3f0..8390574 100644 --- a/man/amverifyrun.8 +++ b/man/amverifyrun.8 @@ -1,11 +1,11 @@ .\" Title: amverifyrun .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: 05/14/2008 +.\" Date: 08/22/2008 .\" Manual: .\" Source: .\" -.TH "AMVERIFYRUN" "8" "05/14/2008" "" "" +.TH "AMVERIFYRUN" "8" "08/22/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -27,4 +27,4 @@ with these argument\. .PP \fBamanda\fR(8), \fBamverify\fR(8), -\fI\%http://wiki.zmanda.com\fR +: http://wiki.zmanda.com diff --git a/man/index.php b/man/index.php new file mode 100644 index 0000000..5322dd6 --- /dev/null +++ b/man/index.php @@ -0,0 +1,4 @@ + - -An updated version of this man page may be available at http://wiki.zmanda.com/index.php/Amanda.conf. - diff --git a/man/xml-source/amcheck.8.xml b/man/xml-source/amcheck.8.xml index 5bc33fd..0ee87d5 100644 --- a/man/xml-source/amcheck.8.xml +++ b/man/xml-source/amcheck.8.xml @@ -862,6 +862,14 @@ was reported by the status check on +EXIT CODE +The exit code of amcheck is one of: + + 0 = success + 1 = error + + + AUTHOR James da Silva, &email.jds; : Original text &maintainer.sgw;: XML-conversion diff --git a/man/xml-source/amdump.8.xml b/man/xml-source/amdump.8.xml index f1239d0..c559cfd 100644 --- a/man/xml-source/amdump.8.xml +++ b/man/xml-source/amdump.8.xml @@ -123,6 +123,18 @@ and then rerun +EXIT CODE +The exit code of amdump is the ORed value of: + + 0 = success + 1 = error + 2 = a dle give strange message + 4 = a dle failed + 8 = Don't know the status of a dle (RESULT_MISSING in the report) + 16 = tape error or no more tape + + + AUTHOR James da Silva, &email.jds; : Original text &maintainer.sgw;: XML-conversion diff --git a/man/xml-source/amflush.8.xml b/man/xml-source/amflush.8.xml index 086f942..24fde4e 100644 --- a/man/xml-source/amflush.8.xml +++ b/man/xml-source/amflush.8.xml @@ -171,6 +171,17 @@ You'll get mail when amflush is finished. +EXIT CODE +The exit code of amflush is the ORed value of: + + 0 = success + 1 = error + 4 = a dle failed + 8 = Don't know the status of a dle (RESULT_MISSING in the report) + 16 = tape error or no more tape + + + AUTHOR James da Silva, &email.jds; : Original text &maintainer.sgw;: XML-conversion diff --git a/man/xml-source/amreport.8.xml b/man/xml-source/amreport.8.xml index e8c6ea8..38e7fbe 100644 --- a/man/xml-source/amreport.8.xml +++ b/man/xml-source/amreport.8.xml @@ -179,6 +179,18 @@ other tape types or particular site needs. It may be used to make a hardcopy log of the tapes. +EXIT CODE +The exit code of amreport is the ORed value of: + + 0 = success + 1 = error + 2 = a dle give strange message + 4 = a dle failed + 8 = Don't know the status of a dle (RESULT_MISSING in the report) + 16 = tape error or no more tape + + + SEE ALSO amanda8, amflush8, diff --git a/man/xml-source/amstatus.8.xml b/man/xml-source/amstatus.8.xml index 6058f4b..1073023 100644 --- a/man/xml-source/amstatus.8.xml +++ b/man/xml-source/amstatus.8.xml @@ -152,6 +152,17 @@ Works only during the estimate phase. +EXIT CODE +The exit code of amstatus is the ORed value of: + + 0 = success + 1 = error + 4 = a dle failed + 8 = Don't know the status of a dle (RESULT_MISSING in the report) + 16 = tape error or no more tape + + + SEE ALSO amanda8, amcheck8, diff --git a/man/xml-source/amtoc.8.xml b/man/xml-source/amtoc.8.xml index 8857a96..b4eb1eb 100644 --- a/man/xml-source/amtoc.8.xml +++ b/man/xml-source/amtoc.8.xml @@ -108,8 +108,7 @@ option is equivalent to OUTPUT FORMAT The standard output has five fields separated by two spaces: - - + # Server:/partition date level size[Kb] 0 daily-05: 19991005 - - 1 cuisun15:/cuisun15/home 19991005 1 96 @@ -117,12 +116,10 @@ option is equivalent to ... 103 cuisg11:/ 19991005 0 4139136 103 total: - - 16716288 - - -In tabular format (-t), this would look like: + +In tabular format (-t), this would look like: - - + # Server:/partition date lev size[Kb] 0 daily-05: 19991005 - - 1 cuisun15:/cuisun15/home 19991005 1 96 @@ -130,8 +127,7 @@ option is equivalent to ... 103 cuisg11:/ 19991005 0 4139136 103 total: - - 16716288 - - + USAGE The easiest way to use it is to run @@ -142,9 +138,9 @@ in the cron job: - + amdump daily ; logdir=`amgetconf daily logdir` ; log=`ls -1t $logdir/log.*.[0-9] | head -1` ; amtoc -a $log - + which will generate /usr/local/etc/amanda//daily/tape_label.toc. You may also want to call diff --git a/man/xslt/html.xsl.in b/man/xslt/html.xsl.in new file mode 100644 index 0000000..03ae385 --- /dev/null +++ b/man/xslt/html.xsl.in @@ -0,0 +1,31 @@ + + + + + + + + + + + + + +text/css + + + + + + + + + ..html + + + + + + diff --git a/man/xslt/man.xsl b/man/xslt/man.xsl.in similarity index 88% rename from man/xslt/man.xsl rename to man/xslt/man.xsl.in index 3dac788..2453bc0 100644 --- a/man/xslt/man.xsl +++ b/man/xslt/man.xsl.in @@ -4,15 +4,17 @@ version='1.0'> - + + - + - diff --git a/oldrecover-src/Makefile.in b/oldrecover-src/Makefile.in index 98ba6ad..3caa50f 100644 --- a/oldrecover-src/Makefile.in +++ b/oldrecover-src/Makefile.in @@ -125,6 +125,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/packaging/Makefile.in b/packaging/Makefile.in index 7a4d4e9..1952026 100644 --- a/packaging/Makefile.in +++ b/packaging/Makefile.in @@ -75,6 +75,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/amanda/rsh-security.m4 \ $(top_srcdir)/config/amanda/s3-device.m4 \ $(top_srcdir)/config/amanda/shmem.m4 \ + $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \ $(top_srcdir)/config/amanda/ssh-security.m4 \ $(top_srcdir)/config/amanda/summary.m4 \ $(top_srcdir)/config/amanda/swig.m4 \ diff --git a/packaging/deb/amanda-backup-client.postrm b/packaging/deb/amanda-backup-client.postrm index 74ecbb8..e69de29 100755 --- a/packaging/deb/amanda-backup-client.postrm +++ b/packaging/deb/amanda-backup-client.postrm @@ -1,3 +0,0 @@ -#!/bin/sh -# Automatically added by dh_makeshlibs -# End automatically added section diff --git a/packaging/deb/amanda-backup-server.postrm b/packaging/deb/amanda-backup-server.postrm index 74ecbb8..e69de29 100755 --- a/packaging/deb/amanda-backup-server.postrm +++ b/packaging/deb/amanda-backup-server.postrm @@ -1,3 +0,0 @@ -#!/bin/sh -# Automatically added by dh_makeshlibs -# End automatically added section diff --git a/packaging/deb/buildpkg b/packaging/deb/buildpkg index 6e41192..4cee2d6 100755 --- a/packaging/deb/buildpkg +++ b/packaging/deb/buildpkg @@ -49,7 +49,7 @@ fi if [ -z $AMVER ] then - AMVER=amanda-2.6.0p1 + AMVER=amanda-2.6.0p2 fi if [ -z $AMTARBALL ] diff --git a/packaging/deb/control b/packaging/deb/control index 76afb65..c74248d 100644 --- a/packaging/deb/control +++ b/packaging/deb/control @@ -2,12 +2,13 @@ Source: amanda Section: utils Priority: optional Maintainer: Zmanda Inc -Build-Depends: dump, gnuplot, libncurses5-dev, libreadline5-dev | libreadline-dev, libtool, flex, perl (>=5.6.0), smbclient, mailx, mtx +Build-Depends: debhelper, dump, fakeroot, flex, gnuplot, libtool, mailx, mtx, perl (>=5.6.0), smbclient, + libcurl-dev, libncurses5-dev, libreadline5-dev | libreadline-dev, libssl-dev Standards-Version: 3.6.1 Package: amanda-backup-server Architecture: any -Depends: xinetd, perl (>=5.6.0), mailx, gnuplot, tar (>=1.15), curl (>=7.10.0), libglib2.0-0 (>=2.2.0) +Depends: xinetd, perl (>=5.6.0), mailx, gnuplot, tar (>=1.15), libcurl3 (>=7.10.0), libglib2.0-0 (>=2.2.0), libssl | libssl0.9.8 Suggests: amanda-backup-client (= ${Source-Version}) Description: Amanda Network Backup and Archiving software . @@ -23,7 +24,7 @@ Description: Amanda Network Backup and Archiving software Package: amanda-backup-client Architecture: any -Depends: xinetd, perl (>=5.6.0), libglib2.0-0 (>=2.2.0) +Depends: xinetd, perl (>=5.6.0), grep, libcurl3 (>=7.10.0), libglib2.0-0 (>=2.2.0), libssl | libssl0.9.8 Conflicts: amanda-backup-server (>=${Source-Version}) Description: Amanda Network Backup and Archiving software . diff --git a/packaging/deb/postrm b/packaging/deb/postrm index d9fde01..e972af6 100755 --- a/packaging/deb/postrm +++ b/packaging/deb/postrm @@ -21,7 +21,7 @@ case "$1" in awk -F: '{ print $4 }' | awk -F, '{ for (i=1; i <= NF; i++ ) print $i }' | grep '^amandabackup$' > /dev/null; then - deluser "amandabackup$group" || true + deluser "amandabackup $group" || true fi done fi diff --git a/packaging/deb/rules b/packaging/deb/rules index 511e3f7..bae37a0 100755 --- a/packaging/deb/rules +++ b/packaging/deb/rules @@ -8,7 +8,7 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -AMVER=2.6.0p1 +AMVER=2.6.0p2 # These are variables that the user can override. They get used in various # places during configure, build, and install. @@ -81,6 +81,13 @@ build-stamp: /sbin/dump /usr/bin/smbclient --enable-s3-device \ --disable-installperms touch missing + # There's probably a better way to do this. Preinst and postrm are the + # same for client and server, but we leave room for differences by just + # appending here. + cat $(shell pwd)/debian/preinst >> $(shell pwd)/debian/amanda-backup-client.preinst + cat $(shell pwd)/debian/preinst >> $(shell pwd)/debian/amanda-backup-server.preinst + cat $(shell pwd)/debian/postrm >> $(shell pwd)/debian/amanda-backup-client.postrm + cat $(shell pwd)/debian/postrm >> $(shell pwd)/debian/amanda-backup-server.postrm make touch build-stamp diff --git a/packaging/rpm/amanda.spec b/packaging/rpm/amanda.spec index b71eb0c..64deb84 100644 --- a/packaging/rpm/amanda.spec +++ b/packaging/rpm/amanda.spec @@ -35,34 +35,34 @@ # Try to detect the distribution we are building: %if %{_vendor} == redhat # Fedora symlinks /etc/fedora-release to /etc/redhat-release for at least - # fc3-7. So RHEL and Fedora look at the same file. The awk trickery here - # forces the field to be numeric so that the spec comparison works - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 3 + # fc3-8. So RHEL and Fedora look at the same file. Different versions have + # different numbers of spaces; hence the use if $3 vs. $4.. + %if %(awk '$1 == "Fedora" && $4 ~ /3.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist fedora %define disttag fc %define distver 3 %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print$4+0}' /etc/redhat-release) == 4 + %if %(awk '$1 == "Fedora" && $4 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist fedora %define disttag fc %define distver 4 %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 5 + %if %(awk '$1 == "Fedora" && $4 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist fedora %define disttag fc %define distver 5 %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 6 + %if %(awk '$1 == "Fedora" && $4 ~ /6.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist fedora %define disttag fc %define distver 6 %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 7 + %if %(awk '$1 == "Fedora" && $3 ~ /7.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist fedora %define disttag fc %define distver 7 %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 8 + %if %(awk '$1 == "Fedora" && $3 ~ /8.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist fedora %define disttag fc %define distver 8 @@ -72,17 +72,19 @@ %{!?PKG_CONFIG_PATH: %define PKG_CONFIG_PATH /usr/lib/pkgconfig} %endif %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 3 + %if %(awk '$1 == "Red" && $7 ~ /3.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist redhat %define disttag rhel %define distver 3 + %define tarver 1.14 %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 4 + %if %(awk '$1 == "Red" && $7 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist redhat %define disttag rhel %define distver 4 + %define tarver 1.14 %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 5 + %if %(awk '$1 == "Red" && $7 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?) %define dist redhat %define disttag rhel %define distver 5 @@ -117,12 +119,15 @@ %define xinetd_reload restart %endif +# Set minimum tar version if it wasn't set in the per-distro section +%{!?tarver: %define tarver 1.15} + %define packer %(%{__id_u} -n) # --- Definitions --- # Define amanda_version if it is not already defined. -%{!?amanda_version: %define amanda_version 2.6.0p1} +%{!?amanda_version: %define amanda_version 2.6.0p2} %{!?amanda_release: %define amanda_release 1} %define amanda_version_info "Amanda Community Edition - version %{amanda_version}" %define amanda_user amandabackup @@ -171,7 +176,7 @@ Requires: libnsl.so.1 Requires: curl >= 7.10.0 Requires: xinetd Requires: perl >= 5.6.0 -Requires: tar >= 1.15 +Requires: tar >= %{tarver} %if %{dist} == redhat || %{dist}== fedora Requires: libtermcap.so.2 Requires: initscripts @@ -649,7 +654,7 @@ if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then fi fi if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} + echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then @@ -1052,7 +1057,7 @@ if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then fi fi if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} + echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then @@ -1419,7 +1424,7 @@ if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then fi fi if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} + echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then @@ -1500,7 +1505,8 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an /sbin/ldconfig # --- Files to install --- - +# Notes: Do not use wildcards on directories not wholly owned by amanda. An +# uninstall of the software will attempt to delete whatever matches here. %files backup_client %defattr(0755,%{amanda_user},%{amanda_group}) %{SYSCONFDIR}/amanda diff --git a/packaging/rpm/amanda.spec.orig b/packaging/rpm/amanda.spec.orig deleted file mode 100644 index b71eb0c..0000000 --- a/packaging/rpm/amanda.spec.orig +++ /dev/null @@ -1,1788 +0,0 @@ -# -# Copyright (C) 2005 Zmanda Incorporated. -# All Rights Reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# 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 -# -# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120 -# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com -# - - -%define build_srpm 0 -%{?srpm_only: %define build_srpm 1} - -# Pkg-config sometimes needs its own path set, and we need to allow users to -# override our guess during detection. This macro takes care of that. -# If no --define PKG_CONFIG_PATH was passed and env var $PKG_CONFIG_PATH is -# set then use the env var. -%{!?PKG_CONFIG_PATH: %{expand:%(echo ${PKG_CONFIG_PATH:+"%%define PKG_CONFIG_PATH $PKG_CONFIG_PATH"})}} - -%{?PKG_CONFIG_PATH:%{echo:PKG_CONFIG_PATH = %{PKG_CONFIG_PATH}}} - -# Define which Distribution we are building: -# Try to detect the distribution we are building: -%if %{_vendor} == redhat - # Fedora symlinks /etc/fedora-release to /etc/redhat-release for at least - # fc3-7. So RHEL and Fedora look at the same file. The awk trickery here - # forces the field to be numeric so that the spec comparison works - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 3 - %define dist fedora - %define disttag fc - %define distver 3 - %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print$4+0}' /etc/redhat-release) == 4 - %define dist fedora - %define disttag fc - %define distver 4 - %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 5 - %define dist fedora - %define disttag fc - %define distver 5 - %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 6 - %define dist fedora - %define disttag fc - %define distver 6 - %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 7 - %define dist fedora - %define disttag fc - %define distver 7 - %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 8 - %define dist fedora - %define disttag fc - %define distver 8 - # TODO: generalize this so that any platform can cross compile - %if %{_host_cpu} == x86_64 && %{_target_cpu} == i686 - # Do nothing if PKG_CONFIG_PATH was set by the user above. - %{!?PKG_CONFIG_PATH: %define PKG_CONFIG_PATH /usr/lib/pkgconfig} - %endif - %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 3 - %define dist redhat - %define disttag rhel - %define distver 3 - %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 4 - %define dist redhat - %define disttag rhel - %define distver 4 - %endif - %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 5 - %define dist redhat - %define disttag rhel - %define distver 5 - %endif -%endif -# Detect Suse variants. Suse gives us some nice macros in their rpms -%if %{_vendor} == "suse" - %if %{suse_version} == 910 - %define dist SuSE - %define disttag sles - %define distver 9 - %endif - %if %{suse_version} == 1010 - %define dist SuSE - %define disttag sles - %define distver 10 - %endif - %if %{suse_version} == 1000 - %define dist SuSE - %define disttag suse - %define distver 10 - %endif -%endif - -# Set options per distribution -%if %{dist} == redhat || %{dist} == fedora - %define rpm_group Applications/Archiving - %define xinetd_reload restart -%endif -%if %{dist} == SuSE - %define rpm_group Productivity/Archiving/Backup - %define xinetd_reload restart -%endif - -%define packer %(%{__id_u} -n) - -# --- Definitions --- - -# Define amanda_version if it is not already defined. -%{!?amanda_version: %define amanda_version 2.6.0p1} -%{!?amanda_release: %define amanda_release 1} -%define amanda_version_info "Amanda Community Edition - version %{amanda_version}" -%define amanda_user amandabackup -%define amanda_group disk -%define udpportrange "700,740" -%define tcpportrange "11000,11040" -%define low_tcpportrange "700,710" - -Summary: The Amanda Backup and Archiving System -Name: amanda -Version: %{amanda_version} -%define rpm_release %{amanda_release}.%{disttag}%{distver} -%if %{build_srpm} -%define rpm_release %{amanda_release} -%endif -Release: %{rpm_release} -Source: %{name}-%{version}.tar.gz -License: http://wiki.zmanda.com/index.php/Amanda_Copyright -Vendor: Zmanda, Inc. -Packager: www.zmanda.com -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{packer}-buildroot -Group: %{rpm_group} -# TODO - Need required versions for these: -BuildRequires: autoconf -BuildRequires: automake -BuildRequires: binutils -BuildRequires: bison -BuildRequires: flex -BuildRequires: gcc -BuildRequires: glibc >= 2.2.0 -BuildRequires: readline -BuildRequires: curl >= 7.10.0 -Requires: /bin/awk -Requires: /bin/date -Requires: /usr/bin/id -Requires: /sbin/ldconfig -Requires: /bin/sh -Requires: /usr/sbin/useradd -Requires: /usr/sbin/usermod -Requires: fileutils -Requires: grep -Requires: gnuplot -Requires: libc.so.6 -Requires: libm.so.6 -Requires: libnsl.so.1 -Requires: curl >= 7.10.0 -Requires: xinetd -Requires: perl >= 5.6.0 -Requires: tar >= 1.15 -%if %{dist} == redhat || %{dist}== fedora -Requires: libtermcap.so.2 -Requires: initscripts -%endif -Provides: amanda-backup_client = %{amanda_version}, amanda-backup_server = %{amanda_version} - -%package backup_client -Summary: The Amanda Backup and Archiving Client -Group: %{rpm_group} -Requires: /bin/awk -Requires: fileutils -Requires: grep -%if %{dist} == redhat || %{dist}== fedora -Requires: libtermcap.so.2 -Requires: initscripts -%endif -Requires: xinetd -Requires: libc.so.6 -Requires: libm.so.6 -Requires: libnsl.so.1 -Requires: perl >= 5.6.0 -Requires: tar >= 1.15 -Provides: amanda-backup_client = %{amanda_version} -Provides: libamclient-%{version}.so = %{amanda_version} -Provides: libamanda-%{version}.so = %{amanda_version} -Conflicts: amanda-backup_server - -%package backup_server -Summary: The Amanda Backup and Archiving Server -Group: %{rpm_group} -Requires: /bin/awk -Requires: fileutils -Requires: grep -Requires: libc.so.6 -Requires: libm.so.6 -Requires: libnsl.so.1 -%if %{dist} == redhat || %{dist}== fedora -Requires: libtermcap.so.2 -Requires: initscripts -%endif -Requires: xinetd -Requires: perl >= 5.6.0 -Requires: tar >= 1.15 -Provides: amanda-backup_server = %{amanda_version} -Provides: libamclient-%{version}.so = %{amanda_version} -Provides: libamanda-%{version}.so = %{amanda_version} -Provides: libamserver-%{version}.so = %{amanda_version} -Provides: librestore-%{version}.so = %{amanda_version} -Provides: libamtape-%{version}.so = %{amanda_version} -Provides: libamdevice-%{version}.so = %{amanda_version} - -# --- Package descriptions --- - -%description -Amanda is the leading Open-Source Backup and Archiving software. - -The amanda-backup_server package should be installed on the Amanda server, i.e. -the machine attached to backup media (such as a tape drive or disk -drives) where backups will be written. The amanda-backup_server package -includes Amanda client. The amanda-backup_client package needs -to be installed on every system that is being backed up. - -Amanda Forums is located at: http://forums.zmanda.com/ -Amanda Documentation is available at: http://wiki.zmanda.com/ - - - -%description backup_server -Amanda is the leading Open-Source Backup and Archiving software. - -This package contains the Amanda server. The amanda-backup_server package -should be installed on the Amanda server, i.e. the machine attached -to backup media (such as a tape drive or disk drives) where backups -will be written. The amanda-backup_server package includes Amanda client. - -Amanda Forums is located at: http://forums.zmanda.com/ -Amanda Documentation is available at: http://wiki.zmanda.com/ - - - -%description backup_client -Amanda is the leading Open-Source Backup and Archiving software. - -This package contains the Amanda client. The amanda-backup_client package -needs to be installed on every system that is being backed up. - -Amanda Forums is located at: http://forums.zmanda.com/ -Amanda Documentation is available at: http://wiki.zmanda.com/ - -# --- Directory setup --- - -# Configure directories: -%define PREFIX /usr -%define EPREFIX %{PREFIX} -%define BINDIR %{EPREFIX}/bin -%define SBINDIR %{EPREFIX}/sbin -%define LIBEXECDIR %{EPREFIX}/libexec -%define AMLIBEXECDIR %{LIBEXECDIR}/amanda -%define DATADIR %{PREFIX}/share -%define SYSCONFDIR /etc -%define LOCALSTATEDIR /var -%define AMANDAHOMEDIR %{LOCALSTATEDIR}/lib/amanda -%ifarch x86_64 -%define LIBDIR %{EPREFIX}/lib64 -%else -%define LIBDIR %{EPREFIX}/lib -%endif -%define AMLIBDIR %{LIBDIR}/amanda -%define INCLUDEDIR %{PREFIX}/include -%define MANDIR %{DATADIR}/man -%define LOGDIR /var/log/amanda -%define PERLSITELIB %(eval "`perl -V:installsitelib`"; echo $installsitelib) - -# Installation directories: -%define ROOT_SBINDIR %{buildroot}/%{SBINDIR} -%define ROOT_LIBEXECDIR %{buildroot}/%{LIBEXECDIR} -%define ROOT_DATADIR %{buildroot}/%{DATADIR} -%define ROOT_LOCALSTATEDIR %{buildroot}/%{LOCALSTATEDIR} -%define ROOT_SYSCONFDIR %{buildroot}/%{SYSCONFDIR} -%define ROOT_AMANDAHOMEDIR %{buildroot}/%{AMANDAHOMEDIR} -%define ROOT_LIBDIR %{buildroot}/%{LIBDIR} -%define ROOT_MANDIR %{buildroot}/%{MANDIR} -%define ROOT_LOGDIR %{buildroot}/%{LOGDIR} - -# --- Unpack --- - -%prep -%setup -q -# --- Configure and compile --- - -%build -%define config_user %{amanda_user} -%define config_group %{amanda_group} - -%if %{disttag} == rhel && %{distver} == 3 -./configure \ - CFLAGS="%{optflags} -g" CXXFLAGS="%{optflags}" \ - --quiet \ - --prefix=%{PREFIX} \ - --sysconfdir=%{SYSCONFDIR} \ - --sharedstatedir=%{LOCALSTATEDIR} \ - --localstatedir=%{LOCALSTATEDIR} \ - --libdir=%{LIBDIR} \ - --includedir=%{INCLUDEDIR} \ - --with-gnuplot=/usr/bin/gnuplot \ - --with-gnutar=/bin/tar \ - --with-gnutar-listdir=%{AMANDAHOMEDIR}/gnutar-lists \ - --with-index-server=localhost \ - --with-tape-server=localhost \ - --with-user=%{config_user} \ - --with-group=%{config_group} \ - --with-owner=%{packer} \ - --with-fqdn \ - --with-bsd-security \ - --with-bsdtcp-security \ - --with-bsdudp-security \ - --with-ssh-security \ - --with-udpportrange=%{udpportrange} \ - --with-tcpportrange=%{tcpportrange} \ - --with-low-tcpportrange=%{low_tcpportrange} \ - --with-debugging=%{LOGDIR} \ - --with-assertions \ - --disable-installperms \ - --without-ipv6 -%else -# This confusing macro results in PKG_CONFIG_PATH=some/path if some/path -# was set on the command line, or by the platform detection bits. -./configure \ - %{?PKG_CONFIG_PATH: PKG_CONFIG_PATH=%PKG_CONFIG_PATH} \ - CFLAGS="%{optflags} -g" CXXFLAGS="%{optflags}" \ - --quiet \ - --prefix=%{PREFIX} \ - --sysconfdir=%{SYSCONFDIR} \ - --sharedstatedir=%{LOCALSTATEDIR} \ - --localstatedir=%{LOCALSTATEDIR} \ - --libdir=%{LIBDIR} \ - --includedir=%{INCLUDEDIR} \ - --with-star=/usr/bin/star \ - --with-gnuplot=/usr/bin/gnuplot \ - --with-gnutar=/bin/tar \ - --with-gnutar-listdir=%{AMANDAHOMEDIR}/gnutar-lists \ - --with-index-server=localhost \ - --with-tape-server=localhost \ - --with-user=%{config_user} \ - --with-group=%{config_group} \ - --with-owner=%{packer} \ - --with-fqdn \ - --with-bsd-security \ - --with-bsdtcp-security \ - --with-bsdudp-security \ - --with-ssh-security \ - --with-udpportrange=%{udpportrange} \ - --with-tcpportrange=%{tcpportrange} \ - --with-low-tcpportrange=%{low_tcpportrange} \ - --with-debugging=%{LOGDIR} \ - --with-assertions \ - --disable-installperms -%endif - -make - -# --- Install to buildroot --- - -%install -if [ "%{buildroot}" != "/" ]; then - if [ -d "%{buildroot}" ] ; then - rm -rf %{buildroot} - fi -else - echo "BuildRoot was somehow set to / !" - exit -1 -fi - -make -j1 DESTDIR=%{buildroot} install - -rm -rf %{ROOT_DATADIR}/amanda -rm -f %{ROOT_AMANDAHOMEDIR}/example/inetd.conf.amandaclient -mkdir %{buildroot}/{etc,var/log} -mkdir %{ROOT_LOCALSTATEDIR}/amanda -mkdir %{ROOT_SYSCONFDIR}/amanda -mkdir %{ROOT_AMANDAHOMEDIR}/gnutar-lists -mkdir %{ROOT_LOGDIR} - -echo "%{amanda_version_info}" >%{ROOT_AMANDAHOMEDIR}/amanda-release - -# --- Clean up buildroot --- - -%clean -if [ "%{buildroot}" != "/" ]; then - if [ -d "%{buildroot}" ] ; then - rm -rf %{buildroot} - fi -else - echo "BuildRoot was somehow set to / !" - exit -1 -fi - -# --- Pre/post (un)installation scripts --- - -%pre -TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX` -if [ $? -ne 0 ]; then - echo "Unable to mktemp!" 1>&2 - exit 1 -fi -LOGDIR="%{LOGDIR}" -INSTALL_LOG="${LOGDIR}/install.log" -INSTALL_ERR="${LOGDIR}/install.err" - -echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE} - -# Check for the 'amanda' user -echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE} -if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then - useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} - if [ %{dist} = "SuSE" ]; then - PASSWD_EXIT=$? - else - # Lock the amanda account until admin sets password - passwd -l %{amanda_user} >>/dev/null - PASSWD_EXIT=$? - fi - if [ ${PASSWD_EXIT} -eq 0 ] ; then - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - PASSWD_OK=0 - else - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - PASSWD_OK=1 - fi -else - # log information about 'amanda' user parameters - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: please see that the following parameters are set for that" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: user.:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: SHELL: /bin/sh" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: HOME: %{AMANDAHOMEDIR}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Default group: %{amanda_group}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Verifying %{amanda_user} parameters :" >>${TMPFILE} - - if [ "`id -gn %{amanda_user}`" != "disk" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected before start using amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified group name of user 'amandabackup'" >>${TMPFILE} - fi - - if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' default shell should be set to !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! /bin/sh, pl correct before start using Amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE} - fi - - if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before using Amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified Default home directory for user amandabackup" >>${TMPFILE} - fi - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - PASSWD_OK=0 -fi -if [ -d %{AMANDAHOMEDIR} ] ; then - echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE} - if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \ - [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then - echo "correct." >>${TMPFILE} - VARLIB_OK=0 - else - echo "incorrect!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE} - VARLIB_OK=1 - fi -else - VARLIB_OK=0 -fi -echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} -if [ ! -e ${LOGDIR} ] ; then - # create log directory - mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 - chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 -elif [ ! -d ${LOGDIR} ] ; then - mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1 - mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 - chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 - mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1 -fi - -if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} - echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2 - echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." - exit 1 -else - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi - -echo "`date +'%b %e %Y %T'`: === Amanda installation started. ===" >${TMPFILE} - -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} -if [ -f "${TMPFILE}" ]; then - rm -f "${TMPFILE}" -fi - -%post -TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX -if [ $? -ne 0 ]; then - echo "Unable to mktemp!" 1>&2 - exit 1 -fi -LOGDIR="%{LOGDIR}" -INSTALL_LOG="${LOGDIR}/install.log" -INSTALL_ERR="${LOGDIR}/install.err" - -echo -n "`date +'%b %e %Y %T'`: Updating library cache..." >${TMPFILE} -/sbin/ldconfig >>${TMPFILE} 2>&1 -echo "done." >>${TMPFILE} -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then - if [ ! -f /etc/xinetd.d/amandaserver ] ; then - cp %{AMANDAHOMEDIR}/example/xinetd.amandaserver /etc/xinetd.d/amandaserver - chmod 0644 /etc/xinetd.d/amandaserver >>${TMPFILE} 2>&1 - if [ -f /etc/xinetd.d/amandaclient ] ; then - rm /etc/xinetd.d/amandaclient - fi - echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE} - if [ "%{xinetd_reload}" == "reload" ] ; then - /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -ne 0 ] ; then - echo -n "reload failed. Attempting restart..." >>${TMPFILE} - /etc/init.d/xinetd restart >>${TMPFILE} 2>&1 - ret_val=$? - fi - else - /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 - ret_val=$? - fi - if [ ${ret_val} -eq 0 ] ; then - echo "success." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - else - echo "failed. Please check your system logs." >>${TMPFILE} - cat ${TMPFILE} 1>&2 - cat ${TMPFILE} >>${INSTALL_ERR} - fi - fi -fi - -echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE} -ret_val=0 -if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then - touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE} - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE} - chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 - chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 - if [ -x /sbin/restorecon ] ; then - /sbin/restorecon %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -else - echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} -fi - - -# Install .gnupg directory -echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE} -ret_val=0 -if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE} - mkdir %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE} - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} - chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -else - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} -fi - -# Install .amandahosts -echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE} -if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then - touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -fi -for host in localhost localhost.localdomain ; do - if [ -z "`grep \"^${host}[[:blank:]]\+root[[:blank:]]\+amindexd[[:blank:]]\+amidxtaped\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then - echo "${host} root amindexd amidxtaped" >>%{AMANDAHOMEDIR}/.amandahosts - fi - if [ -z "`grep \"^${host}[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then - echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts - fi -done -chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# SSH RSA key generation for amdump -KEYDIR="%{AMANDAHOMEDIR}/.ssh" -KEYFILE="id_rsa_amdump" -COMMENT="%{amanda_user}@server" -if [ ! -d ${KEYDIR} ] ; then - if [ -f ${KEYDIR} ] ; then - echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} - mv ${KEYDIR} ${KEYDIR}.rpmsave - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - fi - echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} - mkdir ${KEYDIR} >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then - echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE} -chown %{amanda_user}:%{amanda_group} ${KEYDIR} ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 -chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 -chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# SSH RSA key generation on client for amrecover -KEYDIR="%{AMANDAHOMEDIR}/.ssh" -KEYFILE="id_rsa_amrecover" -COMMENT="root@client" -if [ ! -d ${KEYDIR} ] ; then - if [ -f ${KEYDIR} ] ; then - echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} - mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - fi - echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} - mkdir ${KEYDIR} >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then - echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} - ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -echo "`date +'%b %e %Y %T'`: Setting permissions for '${KEYDIR}'" >${TMPFILE} -chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1 -chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 -chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# environment variables (~amandabackup/.profile) -echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE} -if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then - touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -fi -if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then - echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile 2>>${TMPFILE} -fi -echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >>${TMPFILE} -chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -echo "`date +'%b %e %Y %T'`: Sending anonymous distribution and version information to Zmanda" >> ${INSTALL_LOG} -if [ -x /usr/bin/wget ]; then - /usr/bin/wget -q -o /dev/null -O - --timeout=5 http://www.zmanda.com/amanda-tips.php\?version=%{amanda_version}\&os=%{disttag}%{distver}\&type=server -fi - -echo "`date +'%b %e %Y %T'`: === Amanda installation complete. ===" >${TMPFILE} - -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} -if [ -f "${TMPFILE}" ]; then - rm -f "${TMPFILE}" -fi - -echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." -%postun -/sbin/ldconfig -%pre backup_server -TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX` -if [ $? -ne 0 ]; then - echo "Unable to mktemp!" 1>&2 - exit 1 -fi - -LOGDIR="%{LOGDIR}" -INSTALL_LOG="${LOGDIR}/install.log" -INSTALL_ERR="${LOGDIR}/install.err" - -echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE} - -# Check for the 'amanda' user -echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE} -if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then - useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} - if [ %{dist} = "SuSE" ]; then - PASSWD_EXIT=$? - else - # Lock the amanda account until admin sets password - passwd -l %{amanda_user} >>/dev/null - PASSWD_EXIT=$? - fi - if [ ${PASSWD_EXIT} -eq 0 ] ; then - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - PASSWD_OK=0 - else - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - PASSWD_OK=1 - fi -else - # log information about 'amanda' user parameters - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: please see that the following parameters are set for that" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: user.:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: SHELL: /bin/sh" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: HOME: %{AMANDAHOMEDIR}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Default group: %{amanda_group}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Verifying %{amanda_user} parameters :" >>${TMPFILE} - - if [ "`id -gn %{amanda_user}`" != "disk" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected before start using Amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified group name of user 'amandabackup'" >>${TMPFILE} - fi - - if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' default shell should be set to !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! /bin/sh, pl correct before start using Amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE} - fi - - if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before using Amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified Default home directory for user amandabackup" >>${TMPFILE} - fi - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - PASSWD_OK=0 -fi -if [ -d %{AMANDAHOMEDIR} ] ; then - echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE} - if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \ - [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then - echo "correct." >>${TMPFILE} - VARLIB_OK=0 - else - echo "incorrect!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE} - VARLIB_OK=1 - fi -else - VARLIB_OK=0 -fi -echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - -if [ ! -e ${LOGDIR} ] ; then - # create log directory - mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 - chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 -elif [ ! -d ${LOGDIR} ] ; then - mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1 - mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 - chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 - mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1 -fi -if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} - echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2 - echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." - exit 1 -else - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi - -echo "`date +'%b %e %Y %T'`: === Amanda backup server installation started. ===" >${TMPFILE} - -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} -if [ -f "${TMPFILE}" ]; then - rm -f "${TMPFILE}" -fi -%post backup_server -TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX` -if [ $? -ne 0 ]; then - echo "Unable to mktemp!" 1>&2 - exit 1 -fi -LOGDIR="%{LOGDIR}" -INSTALL_LOG="${LOGDIR}/install.log" -INSTALL_ERR="${LOGDIR}/install.err" - -echo -n "`date +'%b %e %Y %T'`: Updating system library cache..." >${TMPFILE} -/sbin/ldconfig -echo "done." >>${TMPFILE} -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then - if [ ! -f /etc/xinetd.d/amandaserver ] ; then - cp %{AMANDAHOMEDIR}/example/xinetd.amandaserver /etc/xinetd.d/amandaserver - chmod 0644 /etc/xinetd.d/amandaserver >>${TMPFILE} 2>&1 - if [ -f /etc/xinetd.d/amandaclient ] ; then - rm /etc/xinetd.d/amandaclient - fi - - echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE} - if [ "%{xinetd_reload}" == "reload" ] ; then - /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -ne 0 ] ; then - echo -n "reload failed. Attempting restart..." >>${TMPFILE} - /etc/init.d/xinetd restart >>${TMPFILE} 2>&1 - ret_val=$? - fi - else - /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 - ret_val=$? - fi - if [ ${ret_val} -eq 0 ] ; then - echo "success." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - else - echo "failed. Please check your system logs." >>${TMPFILE} - cat ${TMPFILE} 1>&2 - cat ${TMPFILE} >>${INSTALL_ERR} - fi - fi -fi - -echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE} -ret_val=0 -if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then - touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE} - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE} - chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 - chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -else - echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} -fi - -# Install .amandahosts to server -echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE} -if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then - touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -fi -for host in localhost localhost.localdomain ; do - if [ -z "`grep \"^${host}[[:blank:]]\+root[[:blank:]]\+amindexd[[:blank:]]\+amidxtaped\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then - echo "${host} root amindexd amidxtaped" >>%{AMANDAHOMEDIR}/.amandahosts - fi - if [ -z "`grep \"^${host}[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then - echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts - fi -done -chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# Install amanda client configuration file -echo "`date +'%b %e %Y %T'`: Checking '%{SYSCONFDIR}/amanda/amanda-client.conf' file." >${TMPFILE} -if [ ! -f %{SYSCONFDIR}/amanda/amanda-client.conf ] ; then - cp %{AMANDAHOMEDIR}/example/amanda-client.conf %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 -fi -chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 -chmod 0600 %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# install am_passphrase file to server -echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.am_passphrase' file." >${TMPFILE} -if [ ! -f %{AMANDAHOMEDIR}/.am_passphrase ] ; then - echo "`date +'%b %e %Y %T'`: Create '%{AMANDAHOMEDIR}/.am_passphrase' file." >${TMPFILE} - touch %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1 - phrase=`echo "amandabackup" | md5sum | awk '{print $1}'` - echo ${phrase} >>%{AMANDAHOMEDIR}/.am_passphrase - - chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1 - chmod 0700 %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1 -fi -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# Install .gnupg directory -echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE} -ret_val=0 -if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE} - mkdir %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE} - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} - chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -else - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} -fi - -# SSH RSA key generation on server for amdump -KEYDIR="%{AMANDAHOMEDIR}/.ssh" -KEYFILE="id_rsa_amdump" -COMMENT="%{amanda_user}@server" -if [ ! -d ${KEYDIR} ] ; then - if [ -f ${KEYDIR} ] ; then - echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} - mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - fi - echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} - mkdir ${KEYDIR} >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then - echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} - ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE} -chown %{amanda_user}:%{amanda_group} ${KEYDIR} ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 -chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 -chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# SSH RSA key generation on client for amrecover -KEYDIR="%{AMANDAHOMEDIR}/.ssh" -KEYFILE="id_rsa_amrecover" -COMMENT="root@client" -if [ ! -d ${KEYDIR} ] ; then - if [ -f ${KEYDIR} ] ; then - echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} - mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - fi - echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} - mkdir ${KEYDIR} >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then - echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} - ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}'" >${TMPFILE} -chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1 -chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 -chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# environment variables (~amandabackup/.profile) -echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE} -if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then - touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -fi -if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then - echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile 2>>${TMPFILE} -fi -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >${TMPFILE} -chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -echo "`date +'%b %e %Y %T'`: Sending anonymous distribution and version information to Zmanda" >> ${INSTALL_LOG} -if [ -x /usr/bin/wget ]; then - /usr/bin/wget -q -o /dev/null -O - --timeout=5 http://www.zmanda.com/amanda-tips.php\?version=%{amanda_version}\&os=%{disttag}%{distver}\&type=server -fi - -echo "`date +'%b %e %Y %T'`: === Amanda backup server installation complete. ===" >${TMPFILE} - -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -if [ -f "${TMPFILE}" ]; then - rm -f "${TMPFILE}" >>${TMPFILE} 2>&1 -fi - -echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." -%postun backup_server -/sbin/ldconfig -%pre backup_client -TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX` -if [ $? -ne 0 ]; then - echo "Unable to mktemp!" 1>&2 - exit 1 -fi -LOGDIR="%{LOGDIR}" -INSTALL_LOG="${LOGDIR}/install.log" -INSTALL_ERR="${LOGDIR}/install.err" - -echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE} - -# Check for the 'amanda' user -echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE} -if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then - useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} >>${TMPFILE} 2>&1 - if [ %{dist} = "SuSE" ]; then - PASSWD_EXIT=$? - else - # Lock the amanda account until admin sets password - passwd -l %{amanda_user} >>/dev/null - PASSWD_EXIT=$? - fi - if [ ${PASSWD_EXIT} -eq 0 ] ; then - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - PASSWD_OK=0 - else - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - PASSWD_OK=1 - fi -else - # log information about 'amanda' user parameters - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: please see that the following parameters are set for that" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: user.:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: SHELL: /bin/sh" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: HOME: %{AMANDAHOMEDIR}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Default group: %{amanda_group}" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Verifying %{amanda_user} parameters :" >>${TMPFILE} - - if [ "`id -gn %{amanda_user}`" != "disk" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected before start using Amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified group name of user 'amandabackup'" >>${TMPFILE} - fi - - if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' default shell should be set to !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! /bin/sh, pl correct before start using Amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE} - fi - - if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before using Amanda !!!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: Verified Default home directory for user amandabackup" >>${TMPFILE} - fi - echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - PASSWD_OK=0 -fi -if [ -d %{AMANDAHOMEDIR} ] ; then - echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE} - if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \ - [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then - echo "correct." >>${TMPFILE} - VARLIB_OK=0 - else - echo "incorrect!" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE} - echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE} - VARLIB_OK=1 - fi -else - VARLIB_OK=0 -fi -echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} - -if [ ! -e ${LOGDIR} ] ; then - # create log directory - mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 - chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 -elif [ ! -d ${LOGDIR} ] ; then - mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1 - mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 - chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 - mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1 -fi -if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} - echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2 - echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." - exit 1 -else - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi - -echo "`date +'%b %e %Y %T'`: === Amanda backup client installation started. ===" >${TMPFILE} - -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -if [ -f "${TMPFILE}" ]; then - rm -f "${TMPFILE}" -fi - -%post backup_client -TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX` -if [ $? -ne 0 ]; then - echo "Unable to mktemp!" 1>&2 - exit 1 -fi -LOGDIR="%{LOGDIR}" -INSTALL_LOG="${LOGDIR}/install.log" -INSTALL_ERR="${LOGDIR}/install.err" - -echo -n "`date +'%b %e %Y %T'`: Updating system library cache..." >${TMPFILE} -/sbin/ldconfig -echo "done." >>${TMPFILE} -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then - if [ ! -f /etc/xinetd.d/amandaclient ] ; then - cp %{AMANDAHOMEDIR}/example/xinetd.amandaclient /etc/xinetd.d/amandaclient - - echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE} - if [ "%{xinetd_reload}" == "reload" ] ; then - /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -ne 0 ] ; then - echo -n "reload failed. Attempting restart..." >>${TMPFILE} - /etc/init.d/xinetd restart >>${TMPFILE} 2>&1 - ret_val=$? - fi - else - /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 - ret_val=$? - fi - if [ ${ret_val} -eq 0 ] ; then - echo "success." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - else - echo "failed. Please check your system logs." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - fi - fi -fi - -echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE} -ret_val=0 -if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then - touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE} - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE} - chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 - chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1 -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -else - echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} -fi - -# Install .amandahosts to client -echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE} -if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then - touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -fi -for host in localhost localhost.localdomain ; do - if [ -z "`grep \"^${host}[[:blank:]]\+\" %{AMANDAHOMEDIR}/.amandahosts | grep \"[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\"`" ] ; then - echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts - fi -done -chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# Install amanda client configuration file -echo "`date +'%b %e %Y %T'`: Checking '%{SYSCONFDIR}/amanda/amanda-client.conf' file." >${TMPFILE} -if [ ! -f %{SYSCONFDIR}/amanda/amanda-client.conf ] ; then - cp %{AMANDAHOMEDIR}/example/amanda-client.conf %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 -fi -chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 -chmod 0600 %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# Install .gnupg directory -echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE} -ret_val=0 -if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE} - mkdir %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE} - else - echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE} - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} - chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - if [ ${ret_val} -eq 0 ]; then - chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 - ret_val=$? - fi -fi -if [ ${ret_val} -eq 0 ]; then - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -else - echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE} - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_ERR} -fi - -# SSH RSA key generation on client for amrecover -KEYDIR="%{AMANDAHOMEDIR}/.ssh" -KEYFILE="id_rsa_amrecover" -COMMENT="root@client" -if [ ! -d ${KEYDIR} ] ; then - if [ -f ${KEYDIR} ] ; then - echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} - mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} - fi - echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} - mkdir ${KEYDIR} >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then - echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} - ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 - cat ${TMPFILE} - cat ${TMPFILE} >>${INSTALL_LOG} -fi -echo "`date +'%b %e %Y %T'`: Setting permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE} -chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1 -chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 -chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -# environment variables (~amandabackup/.profile) -echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE} -if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then - touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -fi -if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then - echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile 2>>${TMPFILE} -fi -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} -echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >${TMPFILE} -chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -echo "`date +'%b %e %Y %T'`: Sending anonymous distribution and version information to Zmanda" >> ${INSTALL_LOG} -if [ -x /usr/bin/wget ]; then - /usr/bin/wget -q -o /dev/null -O - --timeout=5 http://www.zmanda.com/amanda-tips.php\?version=%{amanda_version}\&os=%{disttag}%{distver}\&type=client -fi - -echo "`date +'%b %e %Y %T'`: === Amanda backup client installation complete. ===" >>${TMPFILE} -cat ${TMPFILE} -cat ${TMPFILE} >>${INSTALL_LOG} - -if [ -f "${TMPFILE}" ]; then - rm -f "${TMPFILE}" -fi - -echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." -%postun backup_client -/sbin/ldconfig - -# --- Files to install --- - -%files backup_client -%defattr(0755,%{amanda_user},%{amanda_group}) -%{SYSCONFDIR}/amanda -%{AMANDAHOMEDIR} -%{AMLIBEXECDIR} -%{AMLIBDIR} -%{AMLIBEXECDIR}/amanda-sh-lib.sh -%{LOCALSTATEDIR}/amanda -%defattr(4750,root,disk) -%{AMLIBEXECDIR}/calcsize -%{AMLIBEXECDIR}/killpgrp -%{AMLIBEXECDIR}/rundump -%{AMLIBEXECDIR}/runtar -%defattr(0750,%{amanda_user},%{amanda_group}) -%{LOGDIR} -%{SBINDIR}/amaespipe -%{SBINDIR}/amcryp* -%{SBINDIR}/amgpgcrypt -%{SBINDIR}/amoldrecover -%{SBINDIR}/amrecover -%defattr(0644,%{amanda_user},%{amanda_group}) -%docdir %{MANDIR} -%{MANDIR}/man5/amanda.conf.5.gz -%{MANDIR}/man5/amanda-client.conf.5.gz -%{MANDIR}/man8/amanda.8.gz -%{MANDIR}/man8/amcheckdump.8.gz -%{MANDIR}/man8/amrecover.8.gz -%{AMLIBEXECDIR}/amcat.awk -%{AMANDAHOMEDIR}/amanda-release -%{AMANDAHOMEDIR}/example/xinetd.amandaclient -%{AMANDAHOMEDIR}/example/amanda-client.conf - -%files backup_server -%defattr(0755,%{amanda_user},%{amanda_group}) -%{SYSCONFDIR}/amanda -%{AMLIBEXECDIR} -%{AMLIBDIR} -%{PERLSITELIB}/Amanda -%{PERLSITELIB}/auto/Amanda -%{AMANDAHOMEDIR} -%{LOCALSTATEDIR}/amanda -%{SBINDIR}/amaddclient -%{SBINDIR}/amadmin -%{SBINDIR}/amcheckdb -%{SBINDIR}/amcheckdump -%{SBINDIR}/amcleanup -%{SBINDIR}/amdd -%{SBINDIR}/amdevcheck -%{SBINDIR}/amdump -%{SBINDIR}/amfetchdump -%{SBINDIR}/amflush -%{SBINDIR}/amgetconf -%{SBINDIR}/amlabel -%{SBINDIR}/ammt -%{SBINDIR}/amoverview -%{SBINDIR}/amplot -%{SBINDIR}/amreport -%{SBINDIR}/amrestore -%{SBINDIR}/amrmtape -%{SBINDIR}/amserverconfig -%{SBINDIR}/amstatus -%{SBINDIR}/amtape -%{SBINDIR}/amtapetype -%{SBINDIR}/amtoc -%{SBINDIR}/amverify -%{SBINDIR}/amverifyrun -%{AMLIBEXECDIR}/amanda-sh-lib.sh -%defattr(4750,root,disk) -%{AMLIBEXECDIR}/calcsize -%{AMLIBEXECDIR}/killpgrp -%{AMLIBEXECDIR}/rundump -%{AMLIBEXECDIR}/runtar -%{AMLIBEXECDIR}/dumper -%{AMLIBEXECDIR}/planner -%{SBINDIR}/amcheck -%defattr(0750,%{amanda_user},%{amanda_group}) -%{LOGDIR} -%{SBINDIR}/amaespipe -%{SBINDIR}/amcrypt -%{SBINDIR}/amcrypt-ossl -%{SBINDIR}/amcrypt-ossl-asym -%{SBINDIR}/amcryptsimple -%{SBINDIR}/amgpgcrypt -%{SBINDIR}/amoldrecover -%{SBINDIR}/amrecover -%defattr(0644,%{amanda_user},%{amanda_group}) -%{AMLIBEXECDIR}/amcat.awk -%{AMLIBEXECDIR}/amplot.awk -%{AMLIBEXECDIR}/amplot.g -%{AMLIBEXECDIR}/amplot.gp -%docdir %{MANDIR} -%{MANDIR}/man5/amanda.conf.5.gz -%{MANDIR}/man5/amanda-client.conf.5.gz -%{MANDIR}/man8/amaddclient.8.gz -%{MANDIR}/man8/amadmin.8.gz -%{MANDIR}/man8/amanda.8.gz -%{MANDIR}/man8/amcheck.8.gz -%{MANDIR}/man8/amcheckdb.8.gz -%{MANDIR}/man8/amcheckdump.8.gz -%{MANDIR}/man8/amcleanup.8.gz -%{MANDIR}/man8/amdd.8.gz -%{MANDIR}/man8/amdump.8.gz -%{MANDIR}/man8/amfetchdump.8.gz -%{MANDIR}/man8/amflush.8.gz -%{MANDIR}/man8/amgetconf.8.gz -%{MANDIR}/man8/amlabel.8.gz -%{MANDIR}/man8/ammt.8.gz -%{MANDIR}/man8/amoverview.8.gz -%{MANDIR}/man8/amplot.8.gz -%{MANDIR}/man8/amrecover.8.gz -%{MANDIR}/man8/amreport.8.gz -%{MANDIR}/man8/amrestore.8.gz -%{MANDIR}/man8/amrmtape.8.gz -%{MANDIR}/man8/amserverconfig.8.gz -%{MANDIR}/man8/amstatus.8.gz -%{MANDIR}/man8/amtape.8.gz -%{MANDIR}/man8/amtapetype.8.gz -%{MANDIR}/man8/amtoc.8.gz -%{MANDIR}/man8/amverify.8.gz -%{MANDIR}/man8/amverifyrun.8.gz -%{MANDIR}/man8/amcrypt.8.gz -%{MANDIR}/man8/amcrypt-ossl.8.gz -%{MANDIR}/man8/amcrypt-ossl-asym.8.gz -%{MANDIR}/man8/amcryptsimple.8.gz -%{MANDIR}/man8/amgpgcrypt.8.gz -%{MANDIR}/man8/amaespipe.8.gz -%{MANDIR}/man8/amdevcheck.8.gz -%{AMANDAHOMEDIR}/amanda-release -%{AMANDAHOMEDIR}/example/amanda-client.conf -%{AMANDAHOMEDIR}/example/xinetd.amandaserver - -# --- ChangeLog - -%changelog -* Fri May 02 2008 Dan Locks -- Changed instances of ${ to %%{ where applicable -* Tue Mar 11 2008 Dan Locks -- fixed many rpmlint complaints -- added --quiet to configure statements -- moved PERLSITELIB to definitions section -* Wed Feb 13 2008 Dan Locks -- added an environment check for PKG_CONFIG_PATH -- added PKG_CONFIG_PATH conditional to handle cross comp on FC8 (environment - var is used if provided) -* Fri Feb 01 2008 Dan Locks -- Removed amplot executable and manpages from client installation -- Added amcheckdump.8 manpage -- Fixed %%{LOCALSTATEDIR}/amanda dir creation. -* Wed Jan 23 2008 Dan Locks -- Change %%{SYSCONFDIR}/amanda/amandates to %%{LOCALSTATEDIR}/amanda/amandates, - and added %%{LOCALSTATEDIR}/amanda to the files lists. -* Mon Jan 14 2008 Dan Locks -- Updates for perlified amanda, file location moves, gpg setup. -* Tue Nov 13 2007 Paddy Sreenivasan -- Added SYSCONFDIR to client rpm -- Set xinetd and amanda-client.conf configuration files as part of postinstall -* Thu Nov 8 2007 Dan Locks -- Added Linux distribution detection -* Wed Nov 7 2007 Paddy Sreenivasan -- Added amserverconfig, amaddclient, amgpgcrypt, amcryptsimple and libamdevice. -- Added amanda configuration template files -* Fri Sep 21 2007 Paddy Sreenivasan -- Remove libamserver, libamtape from client rpm -* Wed Sep 19 2007 Paddy Sreenivasan -- Added Fedora 7 -* Tue Jun 26 2007 Kevin Till -- set debug log to /var/log/amanda -* Fri Jan 12 2007 Paddy Sreenivasan -- Added label templates -* Thu Dec 07 2006 Paddy Sreenivasan -- Application API changes -* Fri Jun 16 2006 Kevin Till -- make install will install necessary example files. - No need to "cp" -* Wed Jun 07 2006 Paddy Sreenivasan - -- Added amoldrecover and amanda-client.conf man page. -* Thu Jun 01 2006 Kevin Till - -- Added amcrypt-ossl, amcrypt-ossl-asym by Ben Slusky. -* Thu May 18 2006 Paddy Sreenivasan - -- Added SLES10, RHEL3 build options. -* Tue May 09 2006 Chris Lee - -- Added amanda-release file to amandabackup home directory. -- Installation message logging cleanup. -* Thu Apr 27 2006 Paddy Sreenivasan - -- Removed dependency on tar version. -- Moved log directory creation after backup user creation. -* Wed Apr 19 2006 Chris Lee - -- Added informative message to note the location of pre- and post- -- install script logs files. -* Mon Apr 17 2006 Chris Lee - -- Reworked installation message logging and reporting. -* Fri Apr 14 2006 Chris Lee - -- Changed behavior for creating required localhost entries in the -- amandahosts file to check for these entries even when the file -- already exists. -* Wed Apr 12 2006 Chris Lee - -- Removed pre-install check for "disk" group. This group should exist -- by default on almost all modern distributions. -* Tue Apr 11 2006 Chris Lee - -- Added amandahosts entry for "localhost" without domain. -* Fri Apr 07 2006 Chris Lee - -- Changed default entries in .amandahosts to use "localdomain" instead -- of "localnet". -- Updated amanda_version and release. -* Mon Apr 03 2006 Chris Lee - -- Added example amanda.conf to files. -* Thu Mar 16 2006 Chris Lee - -- Corrected an issue with pre-install scripts wrt bug #218. -- Corrected an issue with post-install scripts and added testing .profile -- in amandabackup's home directory for setting environment variables wrt -- bug #220. -* Mon Mar 13 2006 Chris Lee - -- Corrected a syntactical error with setting ownership of amandates file -- wrt bug #216. -* Wed Mar 08 2006 Chris Lee - -- Added pre-install scripts to verify proper ownership of -- amandabackup home directory. -* Thu Feb 2 2006 Paddy Sreenivasan - -- Require xinetd. Require termcap and initscripts for Fedora and Redhat. -* Mon Jan 09 2006 Chris Lee - -- Pre/post install scripts updated: -- o Resolved an issue where an empty amandates file was installed -- even if the file already existed on the system. -- o If .amandahosts does not exist a default is now created. -- The Amanda user account has been changed to 'amandabackup' for -- additional security. -* Tue Jan 03 2006 Paddy Sreenivasan - -- Removed amandates from files list. -* Thu Dec 29 2005 Chris Lee - -- Corrected dependency for awk to "/bin/awk". -* Thu Dec 29 2005 Kevin Till - -- add man pages for amcrypt and amaespipe -* Thu Dec 29 2005 Chris Lee - -- Updated dependancy info to depend on tar >= 1.15. -- Included dependancies from top-level package in backup_client and -- backup_server packages. -- Reorganized files lists for readability (alphabetically). -- Updated backup_client files list to include some missing files per -- bug #129. -- Updated pre- and post-install to handle potential issue when -- /var/log/amanda exists and is a file rather than a directory. -- Corrected permissions for /var/log/amanda in pre-install scripts -- per bug #78 and 13 December change. -* Thu Dec 22 2005 Paddy Sreenivasan - -- Added amaespipe and amcrypt -- Added sles9 build definitions -* Tue Dec 13 2005 Chris Lee - -- Changed permissions for /var/log/amanda, removing set group id bit. -- Added /etc/amandates to backup_client package. -* Thu Dec 08 2005 Chris Lee - -- Corrected an issue with detection of existing 'amanda' user account. -- Corrected ownership of setuid executables per Bug #66. -- Moved the gnutar and noop files to the backup_client package (where -- they sould be). -- Removed amqde from files list. -- Added logging features to pre- and post-install scripts. -* Wed Dec 07 2005 Chris Lee - -- Changed a number of directory and file permissions from amanda:root -- to amanda:disk in response to Bug #57. -* Fri Dec 02 2005 Chris Lee - -- Corrected SYSCONFDIR path definition. Closes Bug #58. -* Mon Nov 28 2005 Chris Lee - -- Really fixed user creation preinstall scripts. -* Wed Nov 23 2005 Paddy Sreenivasan - -- Updated package description. -- Changed Group for packages. -* Tue Nov 22 2005 Chris Lee - -- Corrected dependancy packaging issue with amanda libraries. -- Fixed creation of amanda user on systems which it does not exist. -- Corrected Group definition for SuSE. -- Updated descriptions to include amanda-libs package. -- Updated release number to 2. -* Tue Nov 08 2005 Chris Lee - -- Permissions changes: now using user=amanda, group=disk -* Sun Oct 30 2005 Chris Lee - -- Parameters to configure options --with-user and --with-group changed -- such that when test_build is set to '1' the username of the user who -- runs rpmbuild is used for both values. If test_build is set to '0' -- then root is used for both values. -- The release field was also changed to automatically reflect the -- distribution and distribution release version for which the RPM was -- built. -* Tue Oct 18 2005 Chris Lee - -- Initial RPM SPEC file created. - diff --git a/packaging/rpm/amanda.spec.rej b/packaging/rpm/amanda.spec.rej deleted file mode 100644 index 3bcd640..0000000 --- a/packaging/rpm/amanda.spec.rej +++ /dev/null @@ -1,17 +0,0 @@ -*************** -*** 122,128 **** - # --- Definitions --- - - # Define amanda_version if it is not already defined. -- %{!?amanda_version: %define amanda_version 2.6.0} - %{!?amanda_release: %define amanda_release 2} - %define amanda_version_info "Amanda Community Edition - version %{amanda_version}" - %define amanda_user amandabackup ---- 122,128 ---- - # --- Definitions --- - - # Define amanda_version if it is not already defined. -+ %{!?amanda_version: %define amanda_version 2.6.0p1} - %{!?amanda_release: %define amanda_release 2} - %define amanda_version_info "Amanda Community Edition - version %{amanda_version}" - %define amanda_user amandabackup diff --git a/packaging/rpm/buildpkg b/packaging/rpm/buildpkg index ec5010d..6361d14 100755 --- a/packaging/rpm/buildpkg +++ b/packaging/rpm/buildpkg @@ -6,7 +6,7 @@ set -x # Buildbot exports some useful env variables. # Check for $AMVER. I couldn't come up with a good way to detect it. if [ -z $AMVER ]; then - AMVER=amanda-2.6.0p1 + AMVER=amanda-2.6.0p2 fi # Check for AMTARBALL variable. if [ -z $AMTARBALL ]; then @@ -48,3 +48,5 @@ cp packaging/rpm/amanda.spec rpm/SPECS/amanda.spec # this is useful for changing %amanda_release or %amanda_version rpmbuild -ba --define "_topdir ${AMPKGDIR}/rpm" \ ${AMPKGDIR}/rpm/SPECS/amanda.spec +cp rpm/RPMS/*/*.rpm . || exit 1 +cp rpm/SRPMS/*.rpm . || exit 1 diff --git a/packaging/rpm/buildpkg.orig b/packaging/rpm/buildpkg.orig deleted file mode 100755 index ec5010d..0000000 --- a/packaging/rpm/buildpkg.orig +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Buildpkg script for producing RPM packages. Does not require root access. - -# This is useful for debugging -set -x -# Buildbot exports some useful env variables. -# Check for $AMVER. I couldn't come up with a good way to detect it. -if [ -z $AMVER ]; then - AMVER=amanda-2.6.0p1 -fi -# Check for AMTARBALL variable. -if [ -z $AMTARBALL ]; then - AMTARBALL=$AMVER.tar.gz -fi - -# Check for AMTARBALL file, if it's not there, create it. -if [ ! -f ${AMTARBALL} ]; then - mkdir ${AMVER} - cp -Rfp * ${AMVER}/ - tar -cf ${AMTARBALL} -z ${AMVER} - rm -rf ${AMVER} -fi - -# Check for the packaging dirs. -if [ -z $AMPKGDIR ]; then - AMPKGDIR=${PWD} -fi -if [ ! -d ${AMPKGDIR} ]; then - mkdir ${AMPKGDIR} -fi -cd ${AMPKGDIR} - -if [ -d rpm ]; then - rm -rf rpm -fi -mkdir rpm -mkdir rpm/SOURCES -mkdir rpm/SRPMS -mkdir rpm/SPECS -mkdir rpm/BUILD -mkdir rpm/RPMS - -# Make a copy of the tarball with the name that rpmbuild expects -cp ${AMTARBALL} rpm/SOURCES/${AMVER}.tar.gz -cp packaging/rpm/amanda.spec rpm/SPECS/amanda.spec -# Rpmbuild requires absolute paths. annoying. If you need to change the -# default value of some rpm.spec variable, just pass extra --define options. -# this is useful for changing %amanda_release or %amanda_version -rpmbuild -ba --define "_topdir ${AMPKGDIR}/rpm" \ - ${AMPKGDIR}/rpm/SPECS/amanda.spec diff --git a/packaging/rpm/buildpkg.rej b/packaging/rpm/buildpkg.rej deleted file mode 100644 index be33dd1..0000000 --- a/packaging/rpm/buildpkg.rej +++ /dev/null @@ -1,17 +0,0 @@ -*************** -*** 6,12 **** - # Buildbot exports some useful env variables. - # Check for $AMVER. I couldn't come up with a good way to detect it. - if [ -z $AMVER ]; then -- AMVER=amanda-2.6.0 - fi - # Check for AMTARBALL variable. - if [ -z $AMTARBALL ]; then ---- 6,12 ---- - # Buildbot exports some useful env variables. - # Check for $AMVER. I couldn't come up with a good way to detect it. - if [ -z $AMVER ]; then -+ AMVER=amanda-2.6.0p1 - fi - # Check for AMTARBALL variable. - if [ -z $AMTARBALL ]; then diff --git a/perl/Amanda/Changer.pm b/perl/Amanda/Changer.pm index 6b8b012..bfad1bf 100644 --- a/perl/Amanda/Changer.pm +++ b/perl/Amanda/Changer.pm @@ -161,6 +161,8 @@ exhausted. C gets three arguments: a slot number, a device name for that slot, and a boolean value which is true if the changer successfully loaded the slot. +=back + =cut sub reset { diff --git a/perl/Amanda/Cmdline.pm b/perl/Amanda/Cmdline.pm index 9f9bae0..fa99ed1 100644 --- a/perl/Amanda/Cmdline.pm +++ b/perl/Amanda/Cmdline.pm @@ -122,7 +122,7 @@ Amanda::Cmdline - utilities for handling command lines my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"], $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP); - + =head1 API STATUS Will change. diff --git a/perl/Amanda/Cmdline.swg b/perl/Amanda/Cmdline.swg index b6dec02..953edab 100644 --- a/perl/Amanda/Cmdline.swg +++ b/perl/Amanda/Cmdline.swg @@ -42,7 +42,7 @@ Amanda::Cmdline - utilities for handling command lines my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"], $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP); - + =head1 API STATUS Will change. diff --git a/perl/Amanda/Config.pm b/perl/Amanda/Config.pm index c428b5a..b254c92 100644 --- a/perl/Amanda/Config.pm +++ b/perl/Amanda/Config.pm @@ -292,7 +292,7 @@ Amanda::Config - access to Amanda configuration parameters print "tape device is ", getconf($CNF_TAPEDEV), "\n"; -This API closely parallels the C API. See L for details +This API closely parallels the C API. See F for details on the functions and constants available here. =head1 API STATUS @@ -350,7 +350,7 @@ C, respectively. Most Amanda applications accept the command-line option C<-o> to "overwrite" configuration values in C. In Perl -applications, these options should be parsed with L, with +applications, these options should be parsed with L, with the action being a call to C. For example: my $config_overwrites = new_config_overwrites($#ARGV+1); @@ -402,17 +402,23 @@ Each subsection type has the following functions: =over -=item C, which returns an opaque object +=item C + +which returns an opaque object (C<$ss>) representing the subsection, or C if no subsection with that name exists; -=item C, returning the name of the subsection; +=item C + +returning the name of the subsection; + +=item C -=item C, which fetches a parameter value from -C<$ss>; and +which fetches a parameter value from C<$ss>; and -=item C, which returns a true value if <$cnf> -was seen in the subsection. +=item C + +which returns a true value if <$cnf> was seen in the subsection. =back @@ -420,13 +426,25 @@ The subsections are: =over -=item C, with constants beginning with C<$TAPETYPE_>, +=item C + +with constants beginning with C<$TAPETYPE_> + +=item C + +with constants beginning with C<$DUMPTYPE_> + +=item C + +with constants beginning with C<$HOLDING_> + +=item C -=item C, with constants beginning with C<$DUMPTYPE_>, +with constants beginning with C<$APPLICATION_> -=item C, with constants beginning with C<$INTER_>, and +=item C