tazbug rev 15

Dont crypt pass twice when generating SliTaz key
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 03 19:18:26 2012 +0200 (2012-04-03)
parents e8fc5365d589
children 6f171d79db65
files tazbug tazbug-box web/bugs.cgi
line diff
     1.1 --- a/tazbug	Tue Apr 03 13:41:08 2012 +0200
     1.2 +++ b/tazbug	Tue Apr 03 19:18:26 2012 +0200
     1.3 @@ -22,17 +22,17 @@
     1.4  do
     1.5  	case "$opt" in
     1.6  		--bug=*)
     1.7 -			bug=${opt#--bug=} ;;
     1.8 +			bug="${opt#--bug=}" ;;
     1.9  		--desc=*)
    1.10 -			desc=${opt#--desc=} ;;
    1.11 +			desc="${opt#--desc=}" ;;
    1.12  		--msg=*)
    1.13 -			msg=${opt#--msg=} ;;
    1.14 +			msg="${opt#--msg=}" ;;
    1.15  		--priority=*)
    1.16  			priority=${opt#--priority=} ;;
    1.17  		--pkgs=*)
    1.18 -			pkgs=${opt#--pkgs=} ;;
    1.19 +			pkgs="${opt#--pkgs=}" ;;
    1.20  		--name=*)
    1.21 -			name=${opt#--name=} ;;
    1.22 +			name="${opt#--name=}" ;;
    1.23  		--user=*)
    1.24  			user=${opt#--user=} ;;
    1.25  		--mail=*)
    1.26 @@ -106,7 +106,6 @@
    1.27  # Gen the secure key: gen_key login mail passwd
    1.28  gen_key() {
    1.29  	gettext "Creating SliTaz secure key..."; echo
    1.30 -	pass=$(crypt_pass $pass)
    1.31  	key=$(echo -n "$user:$mail:$pass" | md5sum | awk '{print $1}')
    1.32  	sed -i s"/KEY=.*/KEY=\"$key\"/" $conf
    1.33  	chmod 0600 $conf
    1.34 @@ -132,15 +131,16 @@
    1.35  		check_info_args
    1.36  		echo ""
    1.37  		echo "Sending account request for: $name ($user)"
    1.38 -		# 'gen_key login mail passwd' localy but dont send it. It will be
    1.39 +		# 'gen_key user:mail:passwd' localy but dont send it. It will be
    1.40  		# generated on server from the user login, mail and cryted password
    1.41  		# so it is not transmited in GET urls.
    1.42  		gen_config
    1.43 +		pass=$(crypt_pass $pass)
    1.44 +		name="$(echo $name | http_urlencode)"
    1.45  		gen_key
    1.46  		. $conf
    1.47 -		name="$(echo $name | http_urlencode)"
    1.48 -		pass=$(crypt_pass $pass)
    1.49 -		echo "Secure key: $KEY" 
    1.50 +		echo "Secure key: $KEY"
    1.51 +		# Wget GET url
    1.52  		busybox wget "${WEB_URL}?signup=$user&name=$name&mail=$mail&pass=$pass" \
    1.53  			-O /tmp/bug.msg
    1.54  		cat /tmp/bug.msg && rm -f /tmp/bug.msg && echo "" ;;
     2.1 --- a/tazbug-box	Tue Apr 03 13:41:08 2012 +0200
     2.2 +++ b/tazbug-box	Tue Apr 03 19:18:26 2012 +0200
     2.3 @@ -162,7 +162,7 @@
     2.4  	user="$(echo $main | cut -d "|" -f 2)"
     2.5  	mail="$(echo $main | cut -d "|" -f 3)"
     2.6  	pass="$(echo $main | cut -d "|" -f 4)"
     2.7 -	tazbug signup --name="$name" --user=$user --mail=$mail \
     2.8 +	./tazbug signup --name="$name" --user=$user --mail=$mail \
     2.9  		--pass="$pass" | output
    2.10  }
    2.11  
    2.12 @@ -180,7 +180,7 @@
    2.13  	signup) 
    2.14  		signup ;;
    2.15  	*)
    2.16 -		if [ ! $HOME/.config/slitaz/account.conf ]; then
    2.17 +		if [ ! -f $HOME/.config/slitaz/account.conf ]; then
    2.18  			signup
    2.19  		fi
    2.20  		new_bug ;;
     3.1 --- a/web/bugs.cgi	Tue Apr 03 13:41:08 2012 +0200
     3.2 +++ b/web/bugs.cgi	Tue Apr 03 19:18:26 2012 +0200
     3.3 @@ -196,7 +196,7 @@
     3.4  	if [ -f "$PEOPLE/$CREATOR/slitaz.conf" ]; then
     3.5  		. $PEOPLE/$CREATOR/slitaz.conf
     3.6  	else
     3.7 -		MAIL="defaul"
     3.8 +		MAIL="default"
     3.9  	fi
    3.10  	cat << EOT
    3.11  <h2>Bug $id</h2>