Re: About the Radius protocol source code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My point is, it seems that there are something wrong with the source code in radproto.cxx.
When we call the constructor, 
RadiusAttr::RadiusAttr(
        unsigned char attrType, /// Attribute Type (see #enum AttrTypes#)
        int intValue /// 32 bit integer to be stored in the attribute Value
        )
the "intValue" passed should be in host byte ordering.  
However, in the code of this constructor, network byte ordering is assumed for "intValue", because
no byte-ordering change has been performed before the following code:

       data[FixedHeaderLength+0] = (BYTE)((intValue>>24) & 0xff);
        data[FixedHeaderLength+1] = (BYTE)((intValue>>16) & 0xff);
        data[FixedHeaderLength+2] = (BYTE)((intValue>>8) & 0xff);
        data[FixedHeaderLength+3] = (BYTE)(intValue & 0xff);

Did I make any mistakes?

Thanks & Regards
Kevin

  
----- Original Message ----- 
From: "Zygmuntowicz Michal" <m.zygmuntowicz@onet.pl>
To: <openh323gk-users@lists.sourceforge.net>
Sent: Monday, October 27, 2003 7:34 PM
Subject: Re:  About the Radius protocol source code


> Please imagine that you are building a RADIUS server. You are receiving
> attributes from two different hosts - let's say Intel x86 and SPARC.
> If we do not perform the byte ordering, the server would receive two different
> attributes for the same integer value.
> Besides the RADIUS standard defines clearly that it expects integers in big-endian
> order.
> If you want to send integer in the natural order for a given machine, just use something
> like:
> 
> RadiusAttr( type, &myint, sizeof(myint) )
> 
> and pass raw data pointer to the constructor.
> 
> ----- Original Message ----- 
> From: "Kevin Cai" <googol4u@yahoo.com.cn>
> Sent: Thursday, November 27, 2003 4:10 AM
> 
> 
> > Something about the source code in radproto.cxx
> [CUT]
> > Is it necessary to do a byte-ordering change (htonl)  to the value "intValue" in this function? why? 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?  SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> List: Openh323gk-users@lists.sourceforge.net
> Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
> Homepage: http://www.gnugk.org/ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÓ†+ù޵隊X¬²š'²ŠÞu¼ÿH_çzÑ¢½æÚrCë¢Ú›ðèzĨº·Šà{ùÞ¶¥§*.m騭êk¡Ûœ¶+Þü:²+azZr¢ç+y«^mëmz·(uïÒDLq9QÿjwazZn²¥¥ƒ”ü)brAÞ­ïá¶Úÿÿû(º·~Šà{ùÞ·÷h?«^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ.+-üê^žöÞ	ÿºÇ«³ùb²Ûÿ²‹«qçè®ÿ?ë@­Èb½ïá¶Úÿÿû(º·~Šà{ùÞ·ùšŠV«r¯{÷è®éÿ¦ÿ~Šî›ø?ôz&z– {øm¶Ÿÿÿ0þ	î‚Oè


[Index of Archives]     [SIP]     [Open H.323]     [Gnu Gatekeeper]     [Asterisk PBX]     [ISDN Cause Codes]     [Yosemite News]

  Powered by Linux