[yast-commit] r53717 - in /trunk/apparmor/src: include/subdomain/apparmor_ycp_utils.ycp include/subdomain/sd-config.ycp perl/Notify.pm
Author: kmachalkova Date: Fri Nov 28 16:51:40 2008 New Revision: 53717 URL: http://svn.opensuse.org/viewcvs/yast?rev=53717&view=rev Log: jjohansen's patch for bnc#258079 (mail address validation) Modified: trunk/apparmor/src/include/subdomain/apparmor_ycp_utils.ycp trunk/apparmor/src/include/subdomain/sd-config.ycp trunk/apparmor/src/perl/Notify.pm Modified: trunk/apparmor/src/include/subdomain/apparmor_ycp_utils.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/apparmor/src/include/subdomain/apparmor_ycp_utils.ycp?rev=53717&r1=53716&r2=53717&view=diff ============================================================================== --- trunk/apparmor/src/include/subdomain/apparmor_ycp_utils.ycp (original) +++ trunk/apparmor/src/include/subdomain/apparmor_ycp_utils.ycp Fri Nov 28 16:51:40 2008 @@ -93,6 +93,16 @@ return isSafe; } +define boolean checkEmailAddress( string emailAddr ) { + + if ( ! validEmailAddress( emailAddr, false ) ) { + string err_email_format = _("Email address format invalid.\nEmail address must be less than 129 characters \n and of the format \"name@domain\". \n Please enter another address."); + Popup::Error( err_email_format ); + return false; + } + return true; +} + /** UI_RepositorySignInDialog * Dialog to allow users to signin or register with an external AppArmor @@ -255,9 +265,8 @@ Popup::Error( _("Password is required for registration." )); } else if ( password != password_verify ) { Popup::Error( _("Passwords do not match. Please re-enter." )); - } else if ( ! validEmailAddress( email, false ) ) { - string err_email_format = _("Email address format invalid.\nEmail address must be less than 129 characters \n and of the format \"name@domain\". \n Please enter another address."); - Popup::Error( err_email_format ); + } else if ( ! checkEmailAddress( email ) ) { + any dummy = nil; } else { y2milestone( "APPARMOR : REPO - new registration: \n\tusername [" + Modified: trunk/apparmor/src/include/subdomain/sd-config.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/apparmor/src/include/subdomain/sd-config.ycp?rev=53717&r1=53716&r2=53717&view=diff ============================================================================== --- trunk/apparmor/src/include/subdomain/sd-config.ycp (original) +++ trunk/apparmor/src/include/subdomain/sd-config.ycp Fri Nov 28 16:51:40 2008 @@ -10,30 +10,11 @@ { include "subdomain/config_complain.ycp"; include "subdomain/event_notification_helptext.ycp"; +include "subdomain/apparmor_ycp_utils.ycp"; textdomain "yast2-apparmor"; import "Label"; -define boolean safeFormat (string emailAddr) { - - boolean isSafe = false; - integer emailAddrLength = size(emailAddr); - - // Allow only name@host formats - if ( emailAddrLength > 128 ) { - Popup::Error( _("Email address is too long. Please enter another address.") ); - } else if ( ! regexpmatch(emailAddr, "..+") && - regexpmatch(emailAddr, "/^(\w+\.?)+\w+\@(\w+\.?)+\w+$") ) { - isSafe = true; - } else if ( regexpmatch(emailAddr, "\\w+@\\w+") ) { - isSafe = true; - } else { - Popup::Error( _("Error in email address format. Please use \"name@host\" format.") ); - } - - return isSafe; -} - define boolean changeAppArmorState(boolean aaEnabled) { any error = nil; @@ -214,7 +195,7 @@ if ( t_email == nil || t_email == "" ) { Popup::Error( _("An email address is required for each selected notification method.") ); continue; - } else if ( ! safeFormat(t_email) ) { + } else if ( ! checkEmailAddress( t_email ) ) { continue; } @@ -240,7 +221,7 @@ if ( s_email == nil || s_email == "" ) { Popup::Error( _("An email address is required for each selected notification method.") ); continue; - } else if ( ! safeFormat(s_email) ) { + } else if ( ! checkEmailAddress(s_email) ) { continue; } @@ -265,7 +246,7 @@ if ( v_email == nil || v_email == "" ) { Popup::Error( _("An email address is required for each selected notification method.") ); continue; - } else if (! safeFormat(v_email) ) { + } else if (! checkEmailAddress(v_email) ) { continue; } Modified: trunk/apparmor/src/perl/Notify.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/apparmor/src/perl/Notify.pm?rev=53717&r1=53716&r2=53717&view=diff ============================================================================== --- trunk/apparmor/src/perl/Notify.pm (original) +++ trunk/apparmor/src/perl/Notify.pm Fri Nov 28 16:51:40 2008 @@ -66,9 +66,8 @@ my $safeFormat = 0; if ( $emailAddr && (length($emailAddr) < 129) ) { - #if ( $emailAddr =~ /^\w+[\.\w]+\@[\w+\.]+\w+$/ || - if ( $emailAddr =~ /^(\w+\.?)+\w+\@(\w+\.?)+\w+$/ || + if ( $emailAddr =~ /^([\w\+-]+\.?)*[\w\+-]+\@(\w+\.?)*\w+$/ || $emailAddr =~ /^\/var\/mail\/\w+$/ ) { $safeFormat = 1; } else { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
kmachalkova@svn.opensuse.org