Ilya Martynov on Wed, 13 Dec 2000 13:35:54 +0100 (CET)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Fixes for apsfilter-current-09.12.2000 (printing via smbclient)


Sorry - seems first patch has error. It should be

diff -r -u apsfilter.orig/SETUP apsfilter/SETUP
--- apsfilter.orig/SETUP	Tue Dec 12 17:39:27 2000
+++ apsfilter/SETUP	Tue Dec 12 17:41:45 2000
@@ -1107,7 +1107,7 @@
 		echo "Time for printer:" >> perf.log
 		if [ "$INTERFACE" = samba ]; then
 		    if [ -n "$SMB_USER" ]; then
-			export PASSWORD="$SMB_PASSWD"
+			export PASSWD="$SMB_PASSWD"
 			SMB_LOGIN="-U ${SMB_USER}"
 		    else
 			SMB_LOGIN=""
diff -r -u apsfilter.orig/bin/apsfilter apsfilter/bin/apsfilter
--- apsfilter.orig/bin/apsfilter	Tue Dec 12 17:39:26 2000
+++ apsfilter/bin/apsfilter	Tue Dec 12 17:40:09 2000
@@ -478,7 +478,7 @@
     if [ -f "/etc/apsfilter/$QUEUE/smbclient.conf" ]; then
 	find_filter smbclient || fatal_filter smbclient
 	. "/etc/apsfilter/$QUEUE/smbclient.conf"
-	[ "$SMB_PASSWD"] && export PASSWORD="$SMB_PASSWD"
+	[ "$SMB_PASSWD"] && export PASSWD="$SMB_PASSWD"
 	eval "$@" | smbclient "//$SMB_SERVER/$SMB_PRINTER" \
 			${SMP_IP:+-I"$SMB_IP"} ${SMB_USER:+-U"$SMB_USER"} \
 			${SMB_WORKGROUP:+-W"$SMB_WORKGROUP"} \


BTW why export PASSWD? Probably it is good idea since this env var will be
set this env var for all programs you execute from shell script. It probably
can be source of security hole. Better set this var only for smbclient. Code
show look like (no need to do export):

        eval "$@" | PASSWD="$SMB_PASSWD" smbclient "//$SMB_SERVER/$SMB_PRINTER" \
  			${SMP_IP:+-I"$SMB_IP"} ${SMB_USER:+-U"$SMB_USER"} \
 			${SMB_WORKGROUP:+-W"$SMB_WORKGROUP"} \

P.S. I forgot about another problem I meet while setting up printing. SETUP
creates smbclient.conf that is not readble by lpd. For me it was created as:

-rw-------  1 root  daemon  156 Dec 12 16:41 smbclient.conf

to make printing work I had to chmod g+r on it.

On Tue, 12 Dec 2000, Ilya Martynov wrote:

IM> Hi,
IM> 
IM> I've just installed apsfilter-current-09.12.2000 and have found several bugs
IM> in code that prints via Windows remote printers with smbclient.
IM> 
IM> 1) incompability with smbclient Version 2.0.7 on FreeBSD 4.2. This version
IM> expect password in environment variable PASSWD. I dont know if it same for
IM> other versions but man page for 2.0.5a installed on one of PC's I've remote
IM> access on also mention only PASSWD (I've not checked it there). Patch that
IM> fixes problems for me:
IM> 
IM> diff -r -u apsfilter.orig/SETUP apsfilter/SETUP
IM> --- apsfilter.orig/SETUP	Tue Dec 12 17:39:27 2000
IM> +++ apsfilter/SETUP	Tue Dec 12 17:41:45 2000
IM> @@ -1107,7 +1107,7 @@
IM>  		echo "Time for printer:" >> perf.log
IM>  		if [ "$INTERFACE" = samba ]; then
IM>  		    if [ -n "$SMB_USER" ]; then
IM> -			export PASSWORD="$SMB_PASSWD"
IM> +			export PASSWD="$SMB_PASSWD"
IM>  			SMB_LOGIN="-U ${SMB_USER}"
IM>  		    else
IM>  			SMB_LOGIN=""
IM> diff -r -u apsfilter.orig/bin/apsfilter apsfilter/bin/apsfilter
IM> --- apsfilter.orig/bin/apsfilter	Tue Dec 12 17:39:26 2000
IM> +++ apsfilter/bin/apsfilter	Tue Dec 12 17:40:09 2000
IM> @@ -478,7 +478,7 @@
IM>      if [ -f "/etc/apsfilter/$QUEUE/smbclient.conf" ]; then
IM>  	find_filter smbclient || fatal_filter smbclient
IM>  	. "/etc/apsfilter/$QUEUE/smbclient.conf"
IM> -	[ "$SMB_PASSWD"] && export PASSWD="$SMB_PASSWD"
IM> +	[ "$SMB_PASSWD"] && export PASSWD="$SMB_PASSWD"
IM>  	eval "$@" | smbclient "//$SMB_SERVER/$SMB_PRINTER" \
IM>  			${SMP_IP:+-I"$SMB_IP"} ${SMB_USER:+-U"$SMB_USER"} \
IM>  			${SMB_WORKGROUP:+-W"$SMB_WORKGROUP"} \
IM> 
IM> 
IM> 2) Missing white space in bin/apsfilter. Patch (note that affects one line
IM> that was changed by previous patch so you have to apply first patch before
IM> applying this):
IM> 
IM> diff -r -u apsfilter.orig/bin/apsfilter apsfilter/bin/apsfilter
IM> --- apsfilter.orig/bin/apsfilter	Tue Dec 12 17:45:26 2000
IM> +++ apsfilter/bin/apsfilter	Tue Dec 12 17:45:38 2000
IM> @@ -478,7 +478,7 @@
IM>      if [ -f "/etc/apsfilter/$QUEUE/smbclient.conf" ]; then
IM>  	find_filter smbclient || fatal_filter smbclient
IM>  	. "/etc/apsfilter/$QUEUE/smbclient.conf"
IM> -	[ "$SMB_PASSWD"] && export PASSWD="$SMB_PASSWD"
IM> +	[ "$SMB_PASSWD" ] && export PASSWD="$SMB_PASSWD"
IM>  	eval "$@" | smbclient "//$SMB_SERVER/$SMB_PRINTER" \
IM>  			${SMP_IP:+-I"$SMB_IP"} ${SMB_USER:+-U"$SMB_USER"} \
IM>  			${SMB_WORKGROUP:+-W"$SMB_WORKGROUP"} \
IM> 
IM> 
IM> 

-- 
Ilya Martynov
AGAVA Software Company, http://www.agava.com