diff --git a/webbuild/webbuild-cgi b/webbuild/webbuild-cgi
index 774485a..c6d6ca0 100755
--- a/webbuild/webbuild-cgi
+++ b/webbuild/webbuild-cgi
@@ -49,18 +49,14 @@ if [ "$USER" ]; then
if [ "$SECRET" = "$USER_SECRET" ]; then
[ "$REMOTE_ADDR" = "127.0.0.1" -o "$USER_SECRET" ] && USER_ENABLED=1 || USER_ENABLED=
elif [ "$REQUEST" = "password" ]; then
- if [ "$USER_SECRET" ]; then
- /usr/libexec/webbuild-checkpassword "$PASSWORD" "$USER_SECRET" 2>/dev/null
- else
- /usr/libexec/webbuild-checkpassword "$PASSWORD" "$SECRET" 2>/dev/null
- fi
+ /usr/libexec/webbuild-checkpassword "$PASSWORD" "$SECRET" 2>/dev/null
if [ $? -eq 0 ]; then
- if [ ! "$USER_SECRET" ]; then
- tmpfile=`mktemp --suffix=webbuildtmp`
- cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile
+ USER_SECRET=$SECRET
+ tmpfile=`mktemp --suffix=webbuildtmp`
+ cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile
+ sed -i "/USER_SECRET=/d" $tmpfile
echo "USER_SECRET='$SECRET'" >> $tmpfile
$SUDO_WRAPPER 0 local "$USER" "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf"
- fi
USER_ENABLED=1
else
USER_ENABLED=
@@ -104,7 +100,7 @@ elif [ "${REQUEST:0:7}" != "refresh" ]; then
echo -n " "
echo -n " "
echo -n " "
- echo -n " "
++ echo -n " "
echo -n " "
echo -n ""
exit
@@ -220,8 +216,8 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
SID=0
if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then
# Find id of last row - 25
- if [ "$USER"]; then
- LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE user!='$USER' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
+ if [ "$USER" ]; then
+ LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE id!='$USER' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
else
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE target!='$DEVELOPERS' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
fi
@@ -362,6 +358,7 @@ fi
# refresh processes list
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
+
echo -n "Pending admin requests:"
@@ -400,27 +397,44 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
tac $WEBBUILD_STATEDIR/processes | \
while read line; do
set -- $line
- RETCODE=$6
+ CMDPID=$1
+ CMDUSER=$2
PROCESSLOG=$5
+ ORIGRETCODE=$6
+ NOTIFIED=
+ if [ "${ORIGRETCODE: -1}" == "+" ]; then
+ NOTIFIED=1
+ RETCODE="${ORIGRETCODE::-1}"
+ else
+ RETCODE=$ORIGRETCODE
+ fi
numprocess=$(($numprocess + 1))
- cmdline=`echo "$line" | sed "s|$1 $2 $3 $4 $5 $RETCODE ||"`
+ cmdline=`echo "$line" | sed "s|$1 $2 $3 $4 $5 $ORIGRETCODE ||"`
cmdline=`echo "$cmdline" | sed "s| --colors web||"`
PACKAGE_ENCODED=`cgi_encodevar $4`
[ "$STATE_JOBSSHOWALL" = "1" -o "$USER" = "$2" ] || continue
if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then
echo -n ""
elif [ ! -e $PROCESSLOG ]; then
- sed -i "\,$1 $USER.* $PROCESSLOG ,d" $WEBBUILD_STATEDIR/processes
+ sed -i "\,$CMDPID $CMDUSER.* $PROCESSLOG ,d" $WEBBUILD_STATEDIR/processes
continue
else
if [ $RETCODE -eq 256 ]; then
$SUDO_WRAPPER finishprocess $1 "$USER" $5
RETCODE=$?
fi
+ # Process finished: add + to retcode to report notification
+ if [ ! "$NOTIFIED" ]; then
+ sed -i "s|^\($CMDPID $CMDUSER.* $PROCESSLOG $RETCODE\)|\1\+|" $WEBBUILD_STATEDIR/processes
+ fi
if [ $RETCODE -eq 0 ]; then
+ [ "$NOTIFIED" ] || \
+ social_log "SUSER=$USER STYPE=job SEMAIL=$USER_EMAIL STEXT=\"''$cmdline'' succesfully completed!\" STIME=`date +%s`" >> /tmp/y
# echo -n "OK"
echo -n ""
else
+ [ "$NOTIFIED" ] || \
+ social_log "SUSER=$USER STYPE=job SEMAIL=$USER_EMAIL STEXT=\"''$cmdline'' failed\" STIME=`date +%s`"
# echo -n "ERROR ($RETCODE)"
echo -n ""
fi
diff --git a/webbuild/webbuild-checkpassword b/webbuild/webbuild-checkpassword
index 6687426..3fe9bc3 100755
--- a/webbuild/webbuild-checkpassword
+++ b/webbuild/webbuild-checkpassword
@@ -259,6 +259,7 @@ class PasswordHash {
}
$wp_hasher = new PasswordHash(8, TRUE);
+echo $wp_hasher->HashPassword($argv[1]);
if ($wp_hasher->CheckPassword($argv[1], $argv[2]) == "1")
exit(0);
else