Name:	nwbackh	- help backup files from a NetWare server
	Jerzy Tarasiuk		version 1.01	21-Nov-2001
	Some code (socket open, IPX packet send/receive) is
	from Martin Stover's MARS (under GNU GPL copyright).

The program was written to backup files from a NetWare server to
a directory on Linux; it needs IPX to be available on the Linux
machine (maybe ipx.o kernel module); was tested with NW 3.1.
If it does not work on your Linux with any server read IPX-HOWTO.

Read carefully everything about password passing - for security!

				-----

A. Compile: type '. Make' - this makes file 'nwbackh'.


B. Usage:

   1. to list volumes on a server: 'nwbackh SERVER'
   2. to list all files from volumes: 'nwbackh SERVER VOLUME:'
   3. to list files from a dir: 'nwbackh SERVER VOLUME:DIR > list'
      (lists the dir specified and its all subdirs)
   4. to extract checksums from list: 'sel-md5.sh < list > cksums'
   5. to copy files: 'nwbackh SERVER destination - < cksums'
      (all files specified in cksums will be copied)
   6. to backup bindery: 'nwbackh SERVER destination :'
      (bindery files cannot be accessed without closing the bindery
       and the program closes bindery to backup them on request only;
       need set NWSVIS=supervisor and NWSPAS=supervisor-password)
   7. or to backup everything from volumes V1 and V2 + bindery:
      'nwbackh SERVER destination V1: V2: : > list'.
   8. or to backup entire server - all volumes + bindery:
      'nwbackh SERVER destination \*: : > list'

   Destination cannot be '-' nor can it contain ':' - otherwise it
   is recognized as bindery, STDIN, or NetWare path. If destination
   is specified, all files accessed as result of following (but not
   preceding) parameter processing are copied to destination dir.
   All parameter types can be mixed, although: '-' can be used once
   only (next will have no data on STDIN), and multiple use of same
   volume or bindery specifier is useless.


   Passwords and security.

   Operations 2,3,5 require environment variables NWUSER and NWPASS
   which are to contain username and password to logon on the server.
   Password is CASE SENSITIVE (usually uppercase password is used).

   To set NWPASS in environment use 'read NWPASS' for NWPASS=value
   would record the password in shell history. Do not ever think to
   pass password as arg for 'ps' can show all args to other users!

   Note an owner of a process (same UID) can see its environment!


   File backup.

   Files on destination are lowercased, and colon after volume name
   is replaced by slash - VOLUME:DIR/FILE becomes 'volume/dir/file'
   in the destination directory; directories are created when needed.

   Using commmand 2,4,5 you can get copy of all files from a volume;
   to select new files you must filter cksums between commands 4 and
   5 - another my utility, called md5bool, can be used.  Shortly:
   it operates on few files containing MD5 checksums and can select
   from one file lines with MD5-s which are not in other files - if
   the first file contain actual MD5-s and the other from previous
   backups, the output will list files which are to be backuped now.
   Info about md5bool: http://www.fuw.edu.pl/~jt/cdvfy/.


   Bindery (files SYS:SYSTEM/NET${OBJ,PROP,VAL}.SYS) backup.

   Requires supervisor (or equivalent) username and password to be
   in environment variables NWSVIS and NWSPAS.

   It is nonsense to check MD5-s of these files to decide if they
   are to be backuped - these MD5-s are different each time the
   bindery is closed in order to access these files. Therefore they
   can be backuped only; to be sure no error occured during their
   reading they are read and checksummed twice (but written once)
   during single bindery backup session.

   If 6 is interrupted the bindery remains closed until autologout
   (usually 15 minutes), and no one can log in - logon on server
   console to be able to force disconnect if the 15 minutes matter.


C. To do:

   . invent what more would be useful

   . what about restore? (well, can simply copy files...)

   . change format of file info listing (NetWare attributes?)

   . backup NetWare specific information (e.g. trustee lists)

   . c.inf (info about *.c) is a bit unactual - needs actualization

   . look if file date/time is set correctly when copying
     (note it is fixed in a bit strange way...)

   . multiple destinations for paranoidal users wishing to make
     many backups at once?  Q: what these users can do now?
     A: these users can repeat backup twice, and compare results
        and they will prefer it because it gives them possibility
        to detect errors in data transfer throgh the network
     (errors can be detected anyway - list files, then backup)

				-----

Here is Martin Stover's copyright notice.
File COPYING contains the GNU General Public License version 2.

/* (C)opyright (C) 1993,1995  Martin Stover, Marburg, Germany
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

				-----

Change log:

1.01	21-Nov-2001:	copying sets Linux date/time of copied file
			from NetWare date/time of the original file
1.02-	22-Nov-2001:	bindery backup (nwbackh SERVER : destination)
			added (bug: in same cases segmentation fault)
1.02	23-Nov-2001:	fixed the bug: uninitialized 'out' in md5file()
1.03	26-Nov-2001:	parameters cleanup: multiple volumes,
			backup entire server by single command
1.04	26-Nov-2001:	handled full adress of fileserver, rather than
			internal net only (as it was in previous v.)
1.05	26-Nov-2001:	source address compared on packet receipt
			(no problem seen, but just to be more safe...)
	-		copyright notices and file COPYING added (note
			because some of the code was taken from source
			which was under GNU GPL the copyright applies
			to earlier versions of the program, too)
