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
[EMAIL PROTECTED]        United Commercial Bank,
[EMAIL PROTECTED]          FreeBSD committer,
+380.652.247.647        Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age
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;
                }

Reply via email to