Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Sep 1999 09:52:46 +0300
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        Evren Yurtesen <yurtesen@ispro.net.tr>
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: finger changed?
Message-ID:  <19990906095246.A11485@relay.ucb.crimea.ua>
In-Reply-To: <37D01BA7.F9419E2C@ispro.net.tr>; from Evren Yurtesen on Fri, Sep 03, 1999 at 10:04:08PM %2B0300
References:  <37D01BA7.F9419E2C@ispro.net.tr>

next in thread | previous in thread | raw e-mail | index | archive | help

--6c2NcOVqGQ03X4Wi
Content-Type: text/plain; charset=us-ascii

On Fri, Sep 03, 1999 at 10:04:08PM +0300, Evren Yurtesen wrote:
> Hello,
> I have recently cvsupped 3.2-STABLE and after the make world
> the finger command was working differently...
> When I search for somebody it was not looking at the real name field
> only the username field just like if I was using -m option but the
> searches
> are made case insensitive...
> 
> What is the problem? I have copied the finger binary from 3.2-RELEASE
> and it was working just fine...
> 
> for example in the old one when I search something like
> finger daemon
> then I was getting 2 entries, now when I search for the same thing
> I get only 1 result which was the username daemon
> 
> Evren

A typo was introduced in finger/util.c, rev 1.6 (CURRENT) and
then imported into RELENG_3 branch in rev 1.5.2.1.  The attached
patch fixes the problem and will be committed later today.
Thanks for the report.


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA of the
ru@ucb.crimea.ua	United Commercial Bank,
ru@FreeBSD.org		FreeBSD committer,
+380.652.247.647	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

--6c2NcOVqGQ03X4Wi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p

Index: util.c
===================================================================
RCS file: /usr/FreeBSD-CVS/src/usr.bin/finger/util.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- util.c	1999/08/21 18:25:38	1.6
+++ util.c	1999/08/22 17:24:25	1.7
@@ -80,7 +80,7 @@
 	 * Why do we skip asterisks!?!?
 	 */
 	(void)strncpy(p = tbuf, pw->pw_gecos, sizeof(tbuf));
-	p[sizeof(tbuf) - 1] = '\0';
+	tbuf[sizeof(tbuf) - 1] = '\0';
 	if (*p == '*')
 		++p;
 
@@ -88,12 +88,13 @@
 	if ((p = strtok(p, ",")) == NULL)
 		return(0);
 
-	for (t = name; (*t = *p) != '\0' && t - name > sizeof(name); ++p) {
+	for (t = name; t < &name[sizeof(name) - 1] && (*t = *p) != '\0'; ++p) {
 		if (*t == '&') { 
 			(void)strncpy(t, pw->pw_name, 
 			    sizeof(name) - (t - name));
 			name[sizeof(name) - 1] = '\0';
-			while (*++t);
+			while (t < &name[sizeof(name) - 1] && *++t)
+				continue;
 		} else {
 			++t;
 		}
@@ -352,21 +353,22 @@
 
 	/* why do we skip asterisks!?!? */
 	(void)strncpy(bp = tbuf, pw->pw_gecos, sizeof(tbuf));
-	bp[sizeof(tbuf) - 1] = '\0';
+	tbuf[sizeof(tbuf) - 1] = '\0';
 	if (*bp == '*')
 		++bp;
 
 	/* ampersands get replaced by the login name */
 	if (!(p = strsep(&bp, ",")))
 		return;
-	for (t = name; (*t = *p) != '\0' && t < name + sizeof(name); ++p) {
+	for (t = name; t < &name[sizeof(name) - 1] && (*t = *p) != '\0'; ++p) {
 		if (*t == '&') {
 			(void)strncpy(t, pw->pw_name, 
 			    sizeof(name) - (t - name));
 			name[sizeof(name) - 1] = '\0';
 			if (islower(*t))
 				*t = toupper(*t);
-			while (*++t);
+			while (t < &name[sizeof(name) - 1] && *++t)
+				continue;
 		} else {
 			++t;
 		}

--6c2NcOVqGQ03X4Wi--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990906095246.A11485>