Bug correction in getIsIPAllowed

sito <[email protected]>
Newsgroups gmane.comp.cms.infoglue.devel
Message-ID <[email protected]>
Another correction patch.. :)

Can you change function "getIsIPAllowed" (in 
"org.infoglue.cms.controllers.kernel.impl.simple.ServerNodeController") 
by next code that drops the null "ipRemote" parameter possibility?:
***********************************************************************************************

public boolean getIsIPAllowed(HttpServletRequest request, String ip)
    {
        boolean allowXForwardedIPCheck = 
CmsPropertyHandler.getAllowXForwardedIPCheck();
        if(!allowXForwardedIPCheck)
            return false;
       
        boolean isIPAllowed = false;             
        String ipRemote = null;
        String ipRequest = null;
       
        if (request != null)
        {
            ipRequest = request.getRemoteAddr();
            ipRemote = request.getHeader("X-Forwarded-For");
            //System.out.println("Request: "+ipRequest+", Remote: 
"+ipRemote+", Ip:"+ip);
            if (ip.equals(ipRequest))
            {
                isIPAllowed=true;
            }
            else
                if (ipRemote != null){
                       if (ipRemote.indexOf(",") > 0)
                    {
                        String[] ips = ipRemote.split(",");
                        //The first IP is the origin, other IPs added by 
forward                             
                        if ((ips.length>0) && (ip.equals(ips[0].trim())))
                        {
                            isIPAllowed=true;                      
                        }                                           
                    }
                    else
                    {
                        if (ip.equals(ipRemote))
                            isIPAllowed=true;
                    }
                }else{
                    isIPAllowed = false;
                }
        }
        return isIPAllowed;
    }
**********************************************************************************

Should we produce a patch and submit it to the Sourceforge tracker and
then people sees it there? Or would we rather discuss them first in the
list before the patch is sent?

I apologise for the basic questions but we are still not familiar on how
these issues are handled.

that's all folks!!

-- 
--------------======ooOO000OOoo======---------------
Vicente Javier Rosselló Ferrer
E-mail: vrossello [arroba] uib.es
Tel: 971 17 2884
Centre de Tecnologies de la Informació a la UIB
CTI - http://www.cti.uib.es
Edifici Anselm Turmeda
Ctra. Valldemossa 7.5km
Universitat de les Illes Balears - http://www.uib.es
==================================================== 



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.