[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.4 and 1.5

version 1.4, 1997/02/03 01:02:42 version 1.5, 1997/02/03 01:05:44
Line 1 
Line 1 
   /*      $OpenBSD$       */
 /*      $NetBSD: ruserpass.c,v 1.11 1997/01/19 14:19:16 lukem Exp $     */  /*      $NetBSD: ruserpass.c,v 1.11 1997/01/19 14:19:16 lukem Exp $     */
   
 /*  /*
Line 37 
Line 38 
 #if 0  #if 0
 static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95";  static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95";
 #else  #else
 static char rcsid[] = "$NetBSD: ruserpass.c,v 1.11 1997/01/19 14:19:16 lukem Exp $";  static char rcsid[] = "$OpenBSD$";
 #endif  #endif
 #endif /* not lint */  #endif /* not lint */
   
Line 95 
Line 96 
         if (hdir == NULL)          if (hdir == NULL)
                 hdir = ".";                  hdir = ".";
         if (strlen(hdir) + sizeof(".netrc") < sizeof(buf)) {          if (strlen(hdir) + sizeof(".netrc") < sizeof(buf)) {
                 (void) sprintf(buf, "%s/.netrc", hdir);                  (void)sprintf(buf, "%s/.netrc", hdir);
         } else {          } else {
                 warnx("%s/.netrc: %s", hdir, strerror(ENAMETOOLONG));                  warnx("%s/.netrc: %s", hdir, strerror(ENAMETOOLONG));
                 return (0);                  return (0);
Line 150 
Line 151 
                                 if (*aname == 0) {                                  if (*aname == 0) {
                                         *aname = malloc((unsigned)                                          *aname = malloc((unsigned)
                                             strlen(tokval) + 1);                                              strlen(tokval) + 1);
                                         (void) strcpy(*aname, tokval);                                          (void)strcpy(*aname, tokval);
                                 } else {                                  } else {
                                         if (strcmp(*aname, tokval))                                          if (strcmp(*aname, tokval))
                                                 goto next;                                                  goto next;
Line 166 
Line 167 
                         }                          }
                         if (token() && *apass == 0) {                          if (token() && *apass == 0) {
                                 *apass = malloc((unsigned) strlen(tokval) + 1);                                  *apass = malloc((unsigned) strlen(tokval) + 1);
                                 (void) strcpy(*apass, tokval);                                  (void)strcpy(*apass, tokval);
                         }                          }
                         break;                          break;
                 case ACCOUNT:                  case ACCOUNT:
Line 178 
Line 179 
                         }                          }
                         if (token() && *aacct == 0) {                          if (token() && *aacct == 0) {
                                 *aacct = malloc((unsigned) strlen(tokval) + 1);                                  *aacct = malloc((unsigned) strlen(tokval) + 1);
                                 (void) strcpy(*aacct, tokval);                                  (void)strcpy(*aacct, tokval);
                         }                          }
                         break;                          break;
                 case MACDEF:                  case MACDEF:
                         if (proxy) {                          if (proxy) {
                                 (void) fclose(cfile);                                  (void)fclose(cfile);
                                 return (0);                                  return (0);
                         }                          }
                         while ((c=getc(cfile)) != EOF)                          while ((c=getc(cfile)) != EOF)
                                 if (c != ' ' && c != '\t')                                  if (c != ' ' && c != '\t')
                                         break;                                          break;
                         if (c == EOF || c == '\n') {                          if (c == EOF || c == '\n') {
                                 printf("Missing macdef name argument.\n");                                  puts("Missing macdef name argument.");
                                 goto bad;                                  goto bad;
                         }                          }
                         if (macnum == 16) {                          if (macnum == 16) {
                                 printf(                                  puts(
 "Limit of 16 macros have already been defined\n");  "Limit of 16 macros have already been defined");
                                 goto bad;                                  goto bad;
                         }                          }
                         tmp = macros[macnum].mac_name;                          tmp = macros[macnum].mac_name;
Line 205 
Line 206 
                                 *tmp++ = c;                                  *tmp++ = c;
                         }                          }
                         if (c == EOF) {                          if (c == EOF) {
                                 printf(                                  puts(
 "Macro definition missing null line terminator.\n");  "Macro definition missing null line terminator.");
                                 goto bad;                                  goto bad;
                         }                          }
                         *tmp = '\0';                          *tmp = '\0';
Line 214 
Line 215 
                                 while ((c=getc(cfile)) != EOF && c != '\n');                                  while ((c=getc(cfile)) != EOF && c != '\n');
                         }                          }
                         if (c == EOF) {                          if (c == EOF) {
                                 printf(                                  puts(
 "Macro definition missing null line terminator.\n");  "Macro definition missing null line terminator.");
                                 goto bad;                                  goto bad;
                         }                          }
                         if (macnum == 0) {                          if (macnum == 0) {
Line 228 
Line 229 
                         tmp = macros[macnum].mac_start;                          tmp = macros[macnum].mac_start;
                         while (tmp != macbuf + 4096) {                          while (tmp != macbuf + 4096) {
                                 if ((c=getc(cfile)) == EOF) {                                  if ((c=getc(cfile)) == EOF) {
                                 printf(                                  puts(
 "Macro definition missing null line terminator.\n");  "Macro definition missing null line terminator.");
                                         goto bad;                                          goto bad;
                                 }                                  }
                                 *tmp = c;                                  *tmp = c;
Line 243 
Line 244 
                                 tmp++;                                  tmp++;
                         }                          }
                         if (tmp == macbuf + 4096) {                          if (tmp == macbuf + 4096) {
                                 printf("4K macro buffer exceeded\n");                                  puts("4K macro buffer exceeded");
                                 goto bad;                                  goto bad;
                         }                          }
                         break;                          break;
Line 254 
Line 255 
                 goto done;                  goto done;
         }          }
 done:  done:
         (void) fclose(cfile);          (void)fclose(cfile);
         return (0);          return (0);
 bad:  bad:
         (void) fclose(cfile);          (void)fclose(cfile);
         return (-1);          return (-1);
 }  }
   

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5