Browse code

- applied (slightly modified) patch of Niklas Ogren

Jan Janak authored on 03/12/2003 19:48:18
Showing 1 changed files
... ...
@@ -119,6 +119,13 @@ A_LAST_MODIFIED_COLUMN=last_modified
119 119
 # domain table
120 120
 DOMAIN_TABLE=domain
121 121
 
122
+# URI table
123
+if [ -z "$URI_TABLE" ] ; then
124
+	URI_TABLE=uri
125
+fi
126
+URIUSER_COLUMN=uri_user
127
+MODIFIED_COLUMN=last_modified
128
+
122 129
 FIFO_DBG=0
123 130
 
124 131
 EGREP="egrep"
... ...
@@ -786,6 +793,16 @@ case $1 in
786 793
 			echo "new user added"
787 794
 		fi
788 795
 
796
+		QUERY="insert into $URI_TABLE \
797
+				($SUBSCRIBER_COLUMN,$REALM_COLUMN,$URIUSER_COLUMN,$MODIFIED_COLUMN) \
798
+				values ('$SERUSER','$SERDOMAIN','$SERUSER',now());";
799
+		sql_query "$QUERY"
800
+		if [ $? -ne 0 ] ; then
801
+			echo "introducing a new user into uri table failed"
802
+		else
803
+			echo "new user into uri table added"
804
+		fi
805
+
789 806
 		;;
790 807
 
791 808
 	monitor|console|moni|con)
... ...
@@ -803,13 +820,20 @@ case $1 in
803 820
 		fi
804 821
 		trap "rm $path;  clear; echo sc monitor ^C-ed; exit 1" 2
805 822
 		attempt=0
823
+		if [ "$2" == "" ]; then
824
+		    loops=-1;
825
+		else
826
+		    loops=$2;
827
+		fi
806 828
 		clear
807
-		while [ 1 -eq 1 ]; do
829
+		while [ $loops -gt $attempt ]; do
808 830
 			attempt=`expr $attempt + 1`
809 831
 			#clear
810 832
 			tput cup 0 0
811 833
 			print_stats $name $path $attempt
812
-			sleep $WATCH_PERIOD
834
+			if [ $loops -gt $attempt ]; then
835
+			    sleep $WATCH_PERIOD
836
+			fi
813 837
 		done
814 838
 		rm $path
815 839
 		exit 0
... ...
@@ -903,6 +927,10 @@ case $1 in
903 927
 		# begin with remove all user's privileges
904 928
 		$0 acl revoke $1  > /dev/null 2>&1
905 929
 
930
+        QUERY="delete from $URI_TABLE where $SUBSCRIBER_COLUMN='$SERUSER'"
931
+		sql_query "$QUERY"
932
+
933
+
906 934
 		# destroy the user now
907 935
         QUERY="delete from $SUB_TABLE where $SUB_TABLE.$SUBSCRIBER_COLUMN='$SERUSER' and $SUB_TABLE.$REALM_COLUMN='$SERDOMAIN'"
908 936
 		sql_query "$QUERY"