AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:
CFG:
PT:0
S:andy.sharp@lsi.com
RQ:
SSV:mhbs.lsil.com
NSV:
SSH:
R:<ed.kwan@lsi.com>
MAID:2
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
RMID:#imap/LSI/INBOX	0	04FB0DCDF7702C409F7E481C74E6A9BF020CF8B173@inbmail02.lsi.com
X-Sylpheed-End-Special-Headers: 1
Date: Thu, 4 Mar 2010 22:48:47 -0800
From: Andrew Sharp <andy.sharp@lsi.com>
To: Ed Kwan <ed.kwan@lsi.com>
Subject: Re: Please review the code regarding defect TED00028036.
Message-ID: <20100304224847.05c9253d@ripper.onstor.net>
In-Reply-To: <04FB0DCDF7702C409F7E481C74E6A9BF020CF8B173@inbmail02.lsi.com>
References: <04FB0DCDF7702C409F7E481C74E6A9BF020CF8B16F@inbmail02.lsi.com>
	<2B044E14371DA244B71F8BF2514563F53BAB64B2@cosmail03.lsi.com>
	<04FB0DCDF7702C409F7E481C74E6A9BF020CF8B173@inbmail02.lsi.com>
Organization: LSI
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Thu, 4 Mar 2010 22:46:16 -0700 "Shedage, Pravin"
<Pravin.Shedage@lsi.com> wrote:

> Hi Ed,
>=20
>  defect TED00028036 :   =20
>=20
> * As per the below example in defect 12.912/32 is considered to be
> invalid IPAddress but it seems to valid. 10:50:32 g3r5 G3R5-VS6 diag>
> nfs show all State: Enabled    Share path: /vol6a
>    Option: rw, client list:
>   12.912/32
>   Option: no_root_squash, client list:
>   12.12/32
>=20
> * inet_aton() handles validation for IPAddress, following IPAddress
> are invalid client IPAddresses 127.0.0.1
>     255.255.255.255
>     0.0.0.0
>   - I have handled these validations.=20
> * Now /32 is not valid subnet mask & this is default behaviour to
> add /32 subnet in ipaddress.
>   - this subnet mask is valid only in classful subnetting, now this
> is not used anymore ...
>   - In CIDR /32 is 255.255.255.255 means all bits in ipaddress are
> used for networks So /32 subnet mask is not allowed. I think it's a
> bug...
>=20
> 	g5r6 TEST diag> nfs show all
> 	State: Enabled    Share path: /vol_std_g5r6_test
> 	Option: rw, client list:=20
> 	127.0.0.15/32=20
> 	Option: no_root_squash, client list:=20
> 	c12r15-rhel4.onstor.lab=20
>=20
> 	g5r6 TEST diag>=20

Ed, did you understand what he's trying to say here?  Because I don't.


>=20
>=20
>=20
>=20
>=20
> ________________________________________
> From: Kwan, Ed
> Sent: Wednesday, March 03, 2010 5:36 AM
> To: Shedage, Pravin
> Cc: Agarwal, Anurag; Sawant, Yogesh; Nguyen, Brian; Sharp, Andy
> Subject: RE: Please review the code regarding defect TED00028036.
>=20
> Adding Andy since he's the "Lead" for the "SW-CLI" area per
> ClearQuest.
>=20
>=20
>=20
>=20
>=20
> There's already a pre-defined type boolean, TRUE, FALSE, so I don't
> you need to create your own "False" and "True":
>=20
> 78,82d77
>=20
> < #define False          0
>=20
> < #define True           1
>=20
>=20
>=20
> I believe this assumption is wrong:
>=20
> <     /* Ipaddress should not start with '.'
>=20
> <        '*' not present in Ipaddr, then there should be 3 '.' */
>=20
> <     if (('.' =3D=3D *szIpaddr) ||
>=20
> <             ((NULL =3D=3D strchr(szIpaddr, '*')) && (3 !=3D temp_token)=
))
> {
>=20
> <         return False;
>=20
> <     }
>=20
> 3 '.' are not required; see the inet_addr(3p) man page.
>=20
> I don=E2=80=99t think there=E2=80=99s a problem with inet_aton(), and tha=
t=E2=80=99s what you
> should use.
>=20
>=20
>=20
> Also look at
>=20
> http://wiki.onstor.net/wiki/ONStor_Coding_Style_Guide
>=20
> as your comments are not in the standard style such as:
>=20
> /*
>=20
>  * Comment here.
>=20
>  */
>=20
>=20
>=20
> What are =E2=80=9Csaveptr1=E2=80=9D and =E2=80=9Csaveptr2=E2=80=9D?  Are =
they the ip address and
> mask? Can you use more descriptive names?
>=20
> <     if (NULL !=3D strchr(str1, '/')) {
>=20
> <         token =3D strtok_r(str1, "", &saveptr1);
>=20
>=20
>=20
> Maybe fprintf(stderr, =E2=80=A6) for internal errors?
>=20
> <     if (NULL =3D=3D str1) {
>=20
> <         printf("%s:%d Memory Allocate Error \n", __FILE__,
> __LINE__);
>=20
>=20
>=20
> Should use True or TRUE instead of "1":
>=20
> 577,579c369,372
>=20
> <         if (1 =3D=3D isValidIpaddr(buff)) {
>=20
> <               return(ip.s_addr);
>=20
> <         }
>=20
>=20
>=20
>=20
>=20
>=20
>=20
> -----Original Message-----
> From: Shedage, Pravin
> Sent: Tuesday, March 02, 2010 2:16 AM
> To: Kwan, Ed
> Cc: Agarwal, Anurag; Sawant, Yogesh; Nguyen, Brian
> Subject: Please review the code regarding defect TED00028036.
>=20
>=20
>=20
> Hi Ed,
>=20
>          Please review the code regarding defect TED00028036.
>=20
>=20
>=20
> Problem:  nfs share modify: doesn't check for valid IP for client list
>=20
>=20
>=20
> I added 3 new functions in file
>=20
>       /homes/pshedage/pravin/dev/nfx-tree/code/ssc-nfxsh/cmd_nfs.c
>=20
>=20
>=20
> int countCharInString(char *szSource, char ch);
>=20
> int isNumber(char *szNumber);
>=20
> int isValidIpaddr(char *szIpaddr);
>=20
>=20
>=20
>=20
>=20
> 1) steps to check newly added code
>=20
>     1) P4CLIENT=3Dpravin
>=20
>     2) export P4DIFF=3D
>=20
>     3) p4 diff to see the differences.
>=20
>=20
>=20
>=20
>=20
> Need:
>=20
>        There is problem in inet_aton() function which does not check
> for validation of ip address.
>=20
> Please try following cases:
>=20
>=20
>=20
> 1.
>=20
> g7r203 TEST diag> nfs share modify /Vol_g7r203_test
>=20
> rw=3D10.3.15.12
>=20
> no_root_squash=3D*
>=20
>=20
>=20
> 2.
>=20
> g7r203 TEST diag> nfs share modify /Vol_g7r203_test
>=20
> rw=3D12.912
>=20
> no_root_squash=3Dc12r15-rhel4.onstor.lab
>=20
>=20
>=20
> 3.
>=20
> g7r203 TEST diag> nfs share modify /Vol_g7r203_test
>=20
> rw=3D*
>=20
> no_root_squash=3Dc12r15-rhel4.onstor.lab
>=20
>=20
>=20
>=20
>=20
>=20
>=20
> Used Machine for work:
>=20
>=20
>=20
> Getway:   10.2.6.5
>=20
> Client:   10.2.15.12
>=20
> compileS: 10.0.0.23
>=20
