[BACK]Return to ruserpass.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ftp

Diff for /src/usr.bin/ftp/ruserpass.c between version 1.20 and 1.21

version 1.20, 2006/05/16 23:43:16 version 1.21, 2007/03/22 11:35:02
Line 108 
Line 108 
         if ((mydomain = strchr(myname, '.')) == NULL)          if ((mydomain = strchr(myname, '.')) == NULL)
                 mydomain = "";                  mydomain = "";
 next:  next:
         while ((t = token())) switch(t) {          while ((t = token()) > 0) switch(t) {
   
         case DEFAULT:          case DEFAULT:
                 usedefault = 1;                  usedefault = 1;
Line 116 
Line 116 
   
         case MACH:          case MACH:
                 if (!usedefault) {                  if (!usedefault) {
                         if (token() != ID)                          if ((t = token()) == -1)
                                   goto bad;
                           if (t != ID)
                                 continue;                                  continue;
                         /*                          /*
                          * Allow match either for user's input host name                           * Allow match either for user's input host name
Line 142 
Line 144 
                         continue;                          continue;
                 }                  }
         match:          match:
                 while ((t = token()) && t != MACH && t != DEFAULT) switch(t) {                  while ((t = token()) > 0 &&
                       t != MACH && t != DEFAULT) switch(t) {
   
                 case LOGIN:                  case LOGIN:
                         if (token()) {                          if ((t = token()) == -1)
                                   goto bad;
                           if (t) {
                                 if (*aname == 0)                                  if (*aname == 0)
                                         *aname = strdup(tokval);                                          *aname = strdup(tokval);
                                 else {                                  else {
Line 162 
Line 167 
         warnx("Remove password or make file unreadable by others.");          warnx("Remove password or make file unreadable by others.");
                                 goto bad;                                  goto bad;
                         }                          }
                         if (token() && *apass == 0)                          if ((t = token()) == -1)
                                   goto bad;
                           if (t && *apass == 0)
                                 *apass = strdup(tokval);                                  *apass = strdup(tokval);
                         break;                          break;
                 case ACCOUNT:                  case ACCOUNT:
Line 172 
Line 179 
         warnx("Remove account or make file unreadable by others.");          warnx("Remove account or make file unreadable by others.");
                                 goto bad;                                  goto bad;
                         }                          }
                         if (token() && *aacct == 0)                          if ((t = token()) == -1)
                                   goto bad;
                           if (t && *aacct == 0)
                                 *aacct = strdup(tokval);                                  *aacct = strdup(tokval);
                         break;                          break;
                 case MACDEF:                  case MACDEF:
Line 248 
Line 257 
                 goto done;                  goto done;
         }          }
 done:  done:
           if (t == -1)
                   goto bad;
         (void)fclose(cfile);          (void)fclose(cfile);
         return (0);          return (0);
 bad:  bad:
Line 275 
Line 286 
                         if (c == '\\')                          if (c == '\\')
                                 c = fgetc(cfile);                                  c = fgetc(cfile);
                         *cp++ = c;                          *cp++ = c;
                           if (cp == tokval + sizeof(tokval)) {
                                   warnx("Token in .netrc too long");
                                   return (-1);
                           }
                 }                  }
         } else {          } else {
                 *cp++ = c;                  *cp++ = c;
Line 283 
Line 298 
                         if (c == '\\')                          if (c == '\\')
                                 c = fgetc(cfile);                                  c = fgetc(cfile);
                         *cp++ = c;                          *cp++ = c;
                           if (cp == tokval + sizeof(tokval)) {
                                   warnx("Token in .netrc too long");
                                   return (-1);
                           }
                 }                  }
         }          }
         *cp = 0;          *cp = 0;

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21