webbuild: check if WEBBUILD_URL is localhost to avoid recursive request to itself

This commit is contained in:
Silvan Calarco 2014-05-27 00:05:15 +02:00
parent 0f96bedecd
commit f2bb820de8
2 changed files with 3 additions and 2 deletions

View File

@ -211,7 +211,7 @@ fi
# Public requests
#
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
if [ "$WEBBUILD_URL" -a "$USER" ]; then
if [ "$WEBBUILD_URL" -a "$USER" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD" ]; then
curl -s "$WEBBUILD_URL?REQUEST=refreshsocial&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&FROMID=$FROMID"
else
[ -e "$WEBBUILD_STATEDIR/social_log" ] || exit

View File

@ -37,7 +37,8 @@ function social_log() {
set_user_state_var STATE_SOCIALLOG_ID $STATE_SOCIALLOG_ID webbuild
echo "SID=$STATE_SOCIALLOG_ID SPRIVACY=$STATE_PRIVACYMODE $line" >> $WEBBUILD_STATEDIR/social_log
if [ "$WEBBUILD_URL" ]; then
# Note: checking that URL does not point here again to avoid recursive requests
if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then
eval $line
USER_SECRET_FIXED=`echo $USER_SECRET | sed "s|\$|\\$|"`
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&\