[Devel] [ openser-Bugs-1556965 ] wrong regexp in openserctl

SourceForge.net noreply at sourceforge.net
Thu Sep 14 11:19:38 CEST 2006


Bugs item #1556965, was opened at 2006-09-12 11:25
Message generated for change (Comment added) made by klaus_darilion
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1556965&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: tools
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Klaus Darilion (klaus_darilion)
Assigned to: Bogdan (bogdan_iancu)
Summary: wrong regexp in openserctl

Initial Comment:
a hyphen "-" is AFAIK also a valid character for a
username. Thus, the regexp's should be corrected.

[a-zA-Z0-9_\.\-] ???

regards
klaus


# check the parameter if it is a valid address of
record (user at domain)
  154 check_aor() {
  155 	echo "$1" | $EGREP "^[a-zA-Z0-9_\.]+ at .*\..*"
>/dev/null
  156 	if [ $? -ne 0 ] ; then
  157 		echo "error: invalid AoR: $1" > /dev/stderr
  158 		exit 1
  159 	fi
  160 }
  161 
  162 # check the parameter if it is a valid address of
record (user at domain)
  163 is_aor() {
  164 	echo "$1" | $EGREP "^[a-zA-Z0-9_\.]+ at .*\..*"
>/dev/null
  165 	if [ $? -ne 0 ] ; then
....
....
....
....



----------------------------------------------------------------------

>Comment By: Klaus Darilion (klaus_darilion)
Date: 2006-09-14 11:19

Message:
Logged In: YES 
user_id=1318360

Hi!

USERNAME_RE="[a-zA-Z0-9&=\+\$,;\?/-_\.\!~\*'\(\)]+"

does not work for me. The problem is that - is a special
character inside a set declaration. The strange thing is
that escaping with \- does not work too :-(

A workaround is to put the - at the beginning:
USERNAME_RE="[-a-zA-Z0-9&=\+\$,;\?/_\.\!~\*'\(\)]+"

----------------------------------------------------------------------

Comment By: Bogdan (bogdan_iancu)
Date: 2006-09-14 10:43

Message:
Logged In: YES 
user_id=1275325

Klaus,

please could you check if the fix is ok and if it doesn'r
break anything else?
if works ok, I will backport it to 1.1.0.

thanks,
bogdan

----------------------------------------------------------------------

Comment By: Klaus Darilion (klaus_darilion)
Date: 2006-09-14 10:06

Message:
Logged In: YES 
user_id=1318360

looks correct. now you just have to find the proper regular
expression :-)

----------------------------------------------------------------------

Comment By: Bogdan (bogdan_iancu)
Date: 2006-09-14 09:52

Message:
Logged In: YES 
user_id=1275325

Klaus,

according to the RFC, in the username name part you may have:

user  =  1*( unreserved / escaped / user-unreserved )
user-unreserved = "&" / "=" / "+" / "$" / "," / ";" / "?" / "/"

unreserved  =  alphanum / mark
mark        =  "-" / "_" / "." / "!" / "~" / "*" / "'"
             / "(" / ")"

which means you may find (unescaped) the following non
alphanumerical char: & = + $ , ; ? / - _ . ! ~ * ' ( )

right?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1556965&group_id=139143



More information about the Devel mailing list