# This patch is for amanda-2.4.1p1 to incorporate the samba-2.0.x changes # that are in amanda-2.4.2 (specifically the 2.4.2-19990920 snapshot). # This patch includes changes for: # # - configure changes for SAMBA_VERSION # - SAMBA_DEBUG_LEVEL # - 'du' or 'dir' switch based on samba version # - '-q' quiet option to smbclient # - all the DMP_* regex lines # # This patch has been tested with amanda-2.4.1p1 and samba-2.0.5a. # It supercedes any previous patches for amanda-2.4.1x and samba-2.0.x and # will be most easily applied to a clean amanda-2.4.1p1 source tree. # # Todd Pfaff, pfaff@mcmaster.ca # Sep 29 1999 --- configure.orig Sat Nov 21 12:12:59 1998 +++ configure Tue Sep 28 13:34:55 1999 @@ -1682,79 +1682,32 @@ # Check whether --with-smbclient or --without-smbclient was given. if test "${with_smbclient+set}" = set; then withval="$with_smbclient" - - case "$withval" in - y | ye | yes) - for ac_prog in smbclient -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1694: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_SAMBA_CLIENT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$SAMBA_CLIENT" in - /*) - ac_cv_path_SAMBA_CLIENT="$SAMBA_CLIENT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $LOCSYSPATH$ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_SAMBA_CLIENT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - ;; -esac -fi -SAMBA_CLIENT="$ac_cv_path_SAMBA_CLIENT" -if test -n "$SAMBA_CLIENT"; then - echo "$ac_t""$SAMBA_CLIENT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -test -n "$SAMBA_CLIENT" && break -done + case "$withval" in + /*) SAMBA_CLIENT="$withval";; + y|ye|yes) :;; + n|no) SAMBA_CLIENT=;; + *) { echo "configure: error: *** You must supply a full pathname to + --with-smbclient" 1>&2; exit 1; };; + esac - if test -z "$SAMBA_CLIENT"; then - { echo "configure: error: *** please specify --with-smbclient=/some/dir/smbclient" 1>&2; exit 1; } - fi - ;; - n | no) unset SAMBA_CLIENT - ;; - *) SAMBA_CLIENT="$withval" - ;; - esac - fi -if test "$SAMBA_CLIENT"; then - LIBSRCS_CLIENT="$LIBSRCS_CLIENT findpass.c" - LIBOBJS_CLIENT="$LIBOBJS_CLIENT findpass.o" - cat >> confdefs.h <&2; exit 1; } - ;; - *) SAMBA_USER="$withval" - ;; - esac - + + case "$withval" in + "" | y | ye | yes | n | no) + { echo "configure: error: *** You must supply a user to the --with-s +amba-user option." 1>&2; exit 1; } + ;; + *) SAMBA_USER="$withval" + ;; + esac + else : ${SAMBA_USER="backup"} @@ -3079,6 +3032,79 @@ ;; esac fi + +for ac_prog in smbclient +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3506: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_SAMBA_CLIENT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$SAMBA_CLIENT" in + /*) + ac_cv_path_SAMBA_CLIENT="$SAMBA_CLIENT" # Let the user override the test with +a path. + ;; + ?:/*) + ac_cv_path_SAMBA_CLIENT="$SAMBA_CLIENT" # Let the user override the test with +a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$LOCSYSPATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_SAMBA_CLIENT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +SAMBA_CLIENT="$ac_cv_path_SAMBA_CLIENT" +if test -n "$SAMBA_CLIENT"; then + echo "$ac_t""$SAMBA_CLIENT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$SAMBA_CLIENT" && break +done + +if test ! -z "$SAMBA_CLIENT"; then + case "`\"$SAMBA_CLIENT\" '\\\\not.a.host.name\\notashare' -U nosuchuser -N -Tx + /dev/null 2>&1`" in + *"Unknown host"*) + smbversion=1 + ;; + *"Connection to not.a.host.name failed"*) + smbversion=2 + ;; + *) + echo "configure: warning: *** $SAMBA_CLIENT does not seem to be +smbclient, so it will not be used." 1>&2 + SAMBA_CLIENT= + ;; + esac + if test -n "$SAMBA_CLIENT"; then + LIBSRCS_CLIENT="$LIBSRCS_CLIENT findpass.c" + LIBOBJS_CLIENT="$LIBOBJS_CLIENT findpass.o" + cat >> confdefs.h <> confdefs.h <= 2 + if (level==0) { + if (no_record) + taropt = "-Tqc"; + else + taropt = "-Tqca"; + } else + taropt = "-Tqcg"; +#else if (level==0) { if (no_record) taropt = "-Tc"; @@ -305,6 +319,7 @@ taropt = "-Tca"; } else taropt = "-Tcg"; +#endif dbprintf(("backup from %s, user %s, pass %s\n", sharename, SAMBA_USER, "XXXXX")); --- client-src/sendsize.c.orig Tue Nov 17 20:07:20 1998 +++ client-src/sendsize.c Tue Sep 28 11:58:06 1999 @@ -571,7 +571,13 @@ {"Total bytes written: [0-9][0-9]*", 1}, /* Gnutar client */ #ifdef SAMBA_CLIENT - {"Total bytes listed: [0-9][0-9]*", 1}, /* Samba client */ +#if SAMBA_VERSION >= 2 +#define SAMBA_DEBUG_LEVEL "0" + {"Total number of bytes: [0-9][0-9]*", 1}, /* Samba du */ +#else +#define SAMBA_DEBUG_LEVEL "3" + {"Total bytes listed: [0-9][0-9]*", 1}, /* Samba dir */ +#endif #endif #ifdef HAVE_DUMP_ESTIMATE @@ -918,18 +924,26 @@ } nullfd = open("/dev/null", O_RDWR); pipe(pipefd); +#if SAMBA_VERSION >= 2 + if (level == 0) + tarkeys = "archive 0;recurse;du"; + else + tarkeys = "archive 1;recurse;du"; +#else if (level == 0) tarkeys = "archive 0;recurse;dir"; else tarkeys = "archive 1;recurse;dir"; +#endif - dbprintf(("%s: running \"%s \'%s\' %s -d 3 -U %s -E%s%s -c \'%s\'\"\n", - get_pname(), SAMBA_CLIENT, sharename, "XXXXX", SAMBA_USER, - domain ? " -W " : "", domain ? domain : "", - tarkeys)); + dbprintf(("%s: running \"%s \'%s\' %s -d %s -U %s -E%s%s -c \'%s\'\"\n", + get_pname(), SAMBA_CLIENT, sharename, "XXXXX", + SAMBA_DEBUG_LEVEL, SAMBA_USER, domain ? " -W " : "", + domain ? domain : "", tarkeys)); switch(dumppid = fork()) { case -1: + dbprintf(("fork for %s failed: %s\n", SAMBA_CLIENT, strerror(errno))); memset(pass, '\0', strlen(pass)); amfree(pass); if(domain) { @@ -948,7 +962,7 @@ aclose(pipefd[0]); execle(SAMBA_CLIENT, "smbclient", sharename, pass, - "-d", "3", + "-d", SAMBA_DEBUG_LEVEL, "-U", SAMBA_USER, "-E", domain ? "-W" : "-c", @@ -958,6 +972,7 @@ (char *)0, safe_env()); /* should not get here */ + dbprintf(("execle of %s failed: %s\n", SAMBA_CLIENT, strerror(errno))); memset(pass, '\0', strlen(pass)); amfree(pass); if(domain) {