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	2B044E14371DA244B71F8BF2514563F504191D5F@cosmail03.lsi.com
X-Sylpheed-End-Special-Headers: 1
Date: Mon, 30 Nov 2009 16:22:01 -0800
From: Andrew Sharp <andy.sharp@lsi.com>
To: "Kwan, Ed" <Ed.Kwan@lsi.com>
Subject: Re: please review code change for TED 27764 Change ICW to require
 local date and time, and optionally ask for NTP server
Message-ID: <20091130162201.347e70df@ripper.onstor.net>
In-Reply-To: <2B044E14371DA244B71F8BF2514563F504191D5F@cosmail03.lsi.com>
References: <2B044E14371DA244B71F8BF2514563F504191D5F@cosmail03.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=US-ASCII
Content-Transfer-Encoding: 7bit

On Mon, 30 Nov 2009 15:28:32 -0700 "Kwan, Ed" <Ed.Kwan@lsi.com> wrote:

> Change 33858


= Change 33858 by edk@edk-dev on 2009/11/18 15:49:31 *pending*
= 
= 	For TED 27764 Change ICW to require local date and time, 
= 	and optionally ask for NTP server
= 	1.  Changed the 2nd paramter of getInputFromUser() from "isIp" to
= 	"dataType", and updated the comments.
= 	2.  Always execute the code section to ask for the date and time.
= 	Added a couple of calls to time() to get the current time.
= 	3.  Added 3 default time servers: ntp2c.mcc.ac.uk (130.88.200.4),
= 	ntp.nict.jp (133.243.238.164) and time.nist.gov (192.43.244.18).
= 	Reviewed by
= 

nfx-tree/code/sm-sct/taskmgr.c

     looks good

nfx-tree/code/ssc-initial-config/initial-config.c

     line 273, there's supposed to be a space around
     operators =, <

     line 479, a bug before you got to it, but if possible let's try to
     spackle it up some now.  INITCONF_MAX_IP_STR_SIZE is too large, an
     NTP ip addr only needs 15 plus a null.  So, 16 for a format
     argument like in line
     475.  If the IP addr is larger, then something should break.
     gracefully, but error out.  Or at the least, truncate it.
     In addition, this test on 479 will succeed when possibly we
     don't want it to, it should be changed to a plain strcmp().
     In other words, the strings should match exactly, not just the
     first strlen(INITCONF_LOCAL_CLOCK_IP_STR) characters.  I'm also
     guessing the same goes for line 473, we want it to match "server"
     not "server-blah-de-blah".  Of course, who knows what will break
     if you fix it.  This is, without doubt, the worst parsing code
     I've ever seen.

     much better:

        while ((fgets(buf, INITCONF_MAX_STR_SIZE, fp) != NULL) &&
               (i < NUM_NTP_SERVERS)) {
	    int rs;
            /* truncate the newline characeter
             */
            buf[strcspn(buf, "\n")] = '\0';
            sprintf(fmt, INITCONF_SERVER_STR " %%%ds",
		INITCONF_MAX_IP_STR_SIZE);
            rs = sscanf(buf, fmt, &conf.ntp[i]);
            /* check if the current line has ntp server entry or
	     * if the ntp server is 127.127.1.0 then skip it
	     */
	    if (((rs < 1) || (rs == EOF)) ||
		!strcmp(conf.ntp[i], INITCONF_LOCAL_CLOCK_IP_STR)) {

		bzero(conf.ntp[i], sizeof(conf.ntp[i]));
		continue;
	    }
	    i++;
        }




nfx-tree/code/ssc-initial-config/initial-config.h

     looks good

nfx-tree/code/ssc-initial-config/openbsd.h

     looks good

nfx-tree/code/ssc-nfxsh/vtysh_initial.c

     line 64-66 uh-oh, not good

     line 494, duh, that is vague/confusing, not your fault, don't
     know how to fix it either

     line 787-935 i have no friggin idea what's going on here. i'll
     just say "I hope you've tested it."

     line 862, didn't you remove the check for that flag?  should the
     check be added back somewhere around line 877?

     line 887, spaces around operators = and <

     line 916, this could match 127.127.1.027, but it shouldn't

     line 926 spaces around << operator

     line 1053 i think you have to keep some kind of check in there,
     because if the user has config'd ntp, then this shouldn't be done.
     it's a bizarre hack anyway. IMHO.

