Browse code

more user-existence checks added

Jiri Kuthan authored on 18/06/2002 08:05:57
Showing 1 changed files
... ...
@@ -115,6 +115,11 @@ ser_alias() {
115 115
 	case $1 in 
116 116
 		show)
117 117
 			if [ $# -eq 2 ] ; then
118
+				is_user $2
119
+				if [ $? -ne 0 ] ; then
120
+					echo non-existent user
121
+					exit 1;
122
+				fi
118 123
 				CLAUSE=" WHERE $A_USER_COLUMN='$2' "
119 124
 			elif [ $# -ne 1 ] ; then
120 125
 				usage
... ...
@@ -160,6 +165,11 @@ acl() {
160 165
 	case $1 in
161 166
 		show)
162 167
 			if [ $# -eq 2 ] ; then
168
+				is_user $2
169
+				if [ $? -ne 0 ] ; then
170
+					echo non-existent user
171
+					exit 1;
172
+				fi
163 173
 				CLAUSE=" WHERE $ACL_USER_COLUMN='$2' "
164 174
 			elif [ $# -ne 1 ] ; then
165 175
 				usage
... ...
@@ -243,7 +253,7 @@ acl() {
243 253
 is_user() {
244 254
 	QUERY="select count(*) from $TABLE \
245 255
 		where $SUBSCRIBER_COLUMN='$1' and $REALM_COLUMN='$DOMAIN';"
246
-	CNT=`sql_query "$QUERY" | grep -v ERROR | tail -n1`
256
+	CNT=`sql_ro_query "$QUERY" | grep -v ERROR | tail -n1`
247 257
 	if [ "0$CNT" -eq 0 ] ; then
248 258
 		false
249 259
 	else
... ...
@@ -379,8 +389,14 @@ case $1 in
379 389
 		;;
380 390
 
381 391
 
382
-	show)
383
-		if [ $# -ne 1 -a $# -ne 2 ] ; then
392
+	show|user)
393
+		if [ $# -eq 2 ] ; then
394
+			is_user $2
395
+			if [ $? -ne 0 ] ; then
396
+				echo non-existent user
397
+				exit 1;
398
+			fi
399
+		elif [ $# -ne 1  ] ; then
384 400
 			usage
385 401
 			exit 1
386 402
 		fi