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

Diff for /src/usr.bin/ssh/servconf.c between version 1.370 and 1.371

version 1.370, 2020/10/16 13:26:13 version 1.371, 2020/10/18 11:32:02
Line 205 
Line 205 
 #define ASSEMBLE(what, defaults, all) \  #define ASSEMBLE(what, defaults, all) \
         do { \          do { \
                 if ((r = kex_assemble_names(&o->what, defaults, all)) != 0) \                  if ((r = kex_assemble_names(&o->what, defaults, all)) != 0) \
                         fatal("%s: %s: %s", __func__, #what, ssh_err(r)); \                          fatal_fr(r, "%s", #what); \
         } while (0)          } while (0)
         ASSEMBLE(ciphers, def_cipher, all_cipher);          ASSEMBLE(ciphers, def_cipher, all_cipher);
         ASSEMBLE(macs, def_mac, all_mac);          ASSEMBLE(macs, def_mac, all_mac);
Line 706 
Line 706 
         if (path_absolute(expanded))          if (path_absolute(expanded))
                 return expanded;                  return expanded;
         if (getcwd(cwd, sizeof(cwd)) == NULL)          if (getcwd(cwd, sizeof(cwd)) == NULL)
                 fatal("%s: getcwd: %s", __func__, strerror(errno));                  fatal_f("getcwd: %s", strerror(errno));
         xasprintf(&ret, "%s/%s", cwd, expanded);          xasprintf(&ret, "%s/%s", cwd, expanded);
         free(expanded);          free(expanded);
         return ret;          return ret;
Line 749 
Line 749 
         if (i >= options->num_listen_addrs) {          if (i >= options->num_listen_addrs) {
                 /* No entry for this rdomain; allocate one */                  /* No entry for this rdomain; allocate one */
                 if (i >= INT_MAX)                  if (i >= INT_MAX)
                         fatal("%s: too many listen addresses", __func__);                          fatal_f("too many listen addresses");
                 options->listen_addrs = xrecallocarray(options->listen_addrs,                  options->listen_addrs = xrecallocarray(options->listen_addrs,
                     options->num_listen_addrs, options->num_listen_addrs + 1,                      options->num_listen_addrs, options->num_listen_addrs + 1,
                     sizeof(*options->listen_addrs));                      sizeof(*options->listen_addrs));
Line 879 
Line 879 
                 ch = '\0';                  ch = '\0';
                 host = hpdelim2(&arg, &ch);                  host = hpdelim2(&arg, &ch);
                 if (host == NULL || ch == '/')                  if (host == NULL || ch == '/')
                         fatal("%s: missing host in %s", __func__, what);                          fatal_f("missing host in %s", what);
                 host = cleanhostname(host);                  host = cleanhostname(host);
                 if (arg == NULL || ((port = permitopen_port(arg)) < 0))                  if (arg == NULL || ((port = permitopen_port(arg)) < 0))
                         fatal("%s: bad port number in %s", __func__, what);                          fatal_f("bad port number in %s", what);
                 /* Send it to channels layer */                  /* Send it to channels layer */
                 channel_add_permission(ssh, FORWARD_ADM,                  channel_add_permission(ssh, FORWARD_ADM,
                     where, host, port);                      where, host, port);
Line 1993 
Line 1993 
                                     item, entry);                                      item, entry);
                         }                          }
                         if (gbuf.gl_pathc > INT_MAX)                          if (gbuf.gl_pathc > INT_MAX)
                                 fatal("%s: too many glob results", __func__);                                  fatal_f("too many glob results");
                         for (n = 0; n < (int)gbuf.gl_pathc; n++) {                          for (n = 0; n < (int)gbuf.gl_pathc; n++) {
                                 debug2("%s line %d: including %s",                                  debug2("%s line %d: including %s",
                                     filename, linenum, gbuf.gl_pathv[n]);                                      filename, linenum, gbuf.gl_pathv[n]);
                                 item = xcalloc(1, sizeof(*item));                                  item = xcalloc(1, sizeof(*item));
                                 item->selector = strdup(arg);                                  item->selector = strdup(arg);
                                 item->filename = strdup(gbuf.gl_pathv[n]);                                  item->filename = strdup(gbuf.gl_pathv[n]);
                                 if ((item->contents = sshbuf_new()) == NULL) {                                  if ((item->contents = sshbuf_new()) == NULL)
                                         fatal("%s: sshbuf_new failed",                                          fatal_f("sshbuf_new failed");
                                             __func__);  
                                 }  
                                 load_server_config(item->filename,                                  load_server_config(item->filename,
                                     item->contents);                                      item->contents);
                                 parse_server_config_depth(options,                                  parse_server_config_depth(options,
Line 2353 
Line 2351 
         FILE *f;          FILE *f;
         int r, lineno = 0;          int r, lineno = 0;
   
         debug2("%s: filename %s", __func__, filename);          debug2_f("filename %s", filename);
         if ((f = fopen(filename, "r")) == NULL) {          if ((f = fopen(filename, "r")) == NULL) {
                 perror(filename);                  perror(filename);
                 exit(1);                  exit(1);
Line 2362 
Line 2360 
         /* grow buffer, so realloc is avoided for large config files */          /* grow buffer, so realloc is avoided for large config files */
         if (fstat(fileno(f), &st) == 0 && st.st_size > 0 &&          if (fstat(fileno(f), &st) == 0 && st.st_size > 0 &&
             (r = sshbuf_allocate(conf, st.st_size)) != 0)              (r = sshbuf_allocate(conf, st.st_size)) != 0)
                 fatal("%s: allocate failed: %s", __func__, ssh_err(r));                  fatal_fr(r, "allocate");
         while (getline(&line, &linesize, f) != -1) {          while (getline(&line, &linesize, f) != -1) {
                 lineno++;                  lineno++;
                 /*                  /*
Line 2374 
Line 2372 
                         memcpy(cp, "\n", 2);                          memcpy(cp, "\n", 2);
                 cp = line + strspn(line, " \t\r");                  cp = line + strspn(line, " \t\r");
                 if ((r = sshbuf_put(conf, cp, strlen(cp))) != 0)                  if ((r = sshbuf_put(conf, cp, strlen(cp))) != 0)
                         fatal("%s: buffer error: %s", __func__, ssh_err(r));                          fatal_fr(r, "sshbuf_put");
         }          }
         free(line);          free(line);
         if ((r = sshbuf_put_u8(conf, 0)) != 0)          if ((r = sshbuf_put_u8(conf, 0)) != 0)
                 fatal("%s: buffer error: %s", __func__, ssh_err(r));                  fatal_fr(r, "sshbuf_put_u8");
         fclose(f);          fclose(f);
         debug2("%s: done config len = %zu", __func__, sshbuf_len(conf));          debug2_f("done config len = %zu", sshbuf_len(conf));
 }  }
   
 void  void
Line 2548 
Line 2546 
         if (depth < 0 || depth > SERVCONF_MAX_DEPTH)          if (depth < 0 || depth > SERVCONF_MAX_DEPTH)
                 fatal("Too many recursive configuration includes");                  fatal("Too many recursive configuration includes");
   
         debug2("%s: config %s len %zu%s", __func__, filename, sshbuf_len(conf),          debug2_f("config %s len %zu%s", filename, sshbuf_len(conf),
             (flags & SSHCFG_NEVERMATCH ? " [checking syntax only]" : ""));              (flags & SSHCFG_NEVERMATCH ? " [checking syntax only]" : ""));
   
         if ((obuf = cbuf = sshbuf_dup_string(conf)) == NULL)          if ((obuf = cbuf = sshbuf_dup_string(conf)) == NULL)
                 fatal("%s: sshbuf_dup_string failed", __func__);                  fatal_f("sshbuf_dup_string failed");
         linenum = 1;          linenum = 1;
         while ((cp = strsep(&cbuf, "\n")) != NULL) {          while ((cp = strsep(&cbuf, "\n")) != NULL) {
                 if (process_server_config_line_depth(options, cp,                  if (process_server_config_line_depth(options, cp,

Legend:
Removed from v.1.370  
changed lines
  Added in v.1.371