Deleted Added
full compact
13,14c13,14
< RCSID("$OpenBSD: servconf.c,v 1.130 2003/12/23 16:12:10 jakob Exp $");
< RCSID("$FreeBSD: head/crypto/openssh/servconf.c 126277 2004-02-26 10:52:33Z des $");
---
> RCSID("$OpenBSD: servconf.c,v 1.137 2004/08/13 11:09:24 dtucker Exp $");
> RCSID("$FreeBSD: head/crypto/openssh/servconf.c 137019 2004-10-28 16:11:31Z des $");
22d21
< #include "tildexpand.h"
98a98
> options->max_authtries = -1;
104a105
> options->num_accept_env = 0;
217a219,220
> if (options->max_authtries == -1)
> options->max_authtries = DEFAULT_AUTH_FAIL_MAX;
268c271,272
< sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem, sMaxStartups,
---
> sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem,
> sMaxStartups, sMaxAuthTries,
272c276
< sGssAuthentication, sGssCleanupCreds,
---
> sGssAuthentication, sGssCleanupCreds, sAcceptEnv,
363a368
> { "maxauthtries", sMaxAuthTries },
372a378
> { "acceptenv", sAcceptEnv },
875a882,885
> case sMaxAuthTries:
> intptr = &options->max_authtries;
> goto parse_int;
>
899a910,922
> case sAcceptEnv:
> while ((arg = strdelim(&cp)) && *arg != '\0') {
> if (strchr(arg, '=') != NULL)
> fatal("%s line %d: Invalid environment name.",
> filename, linenum);
> if (options->num_accept_env >= MAX_ACCEPT_ENV)
> fatal("%s line %d: too many allow env.",
> filename, linenum);
> options->accept_env[options->num_accept_env++] =
> xstrdup(arg);
> }
> break;
>
934c957
< read_server_config(ServerOptions *options, const char *filename)
---
> load_server_config(const char *filename, Buffer *conf)
936,937c959
< int linenum, bad_options = 0;
< char line[1024];
---
> char line[1024], *cp;
940,942c962,963
< debug2("read_server_config: filename %s", filename);
< f = fopen(filename, "r");
< if (!f) {
---
> debug2("%s: filename %s", __func__, filename);
> if ((f = fopen(filename, "r")) == NULL) {
946c967
< linenum = 0;
---
> buffer_clear(conf);
948,951c969,978
< /* Update line number counter. */
< linenum++;
< if (process_server_config_line(options, line, filename, linenum) != 0)
< bad_options++;
---
> /*
> * Trim out comments and strip whitespace
> * NB - preserve newlines, they are needed to reproduce
> * line numbers later for error messages
> */
> if ((cp = strchr(line, '#')) != NULL)
> memcpy(cp, "\n", 2);
> cp = line + strspn(line, " \t\r");
>
> buffer_append(conf, cp, strlen(cp));
952a980
> buffer_append(conf, "\0", 1);
953a982,1000
> debug2("%s: done config len = %d", __func__, buffer_len(conf));
> }
>
> void
> parse_server_config(ServerOptions *options, const char *filename, Buffer *conf)
> {
> int linenum, bad_options = 0;
> char *cp, *obuf, *cbuf;
>
> debug2("%s: config %s len %d", __func__, filename, buffer_len(conf));
>
> obuf = cbuf = xstrdup(buffer_ptr(conf));
> linenum = 1;
> while((cp = strsep(&cbuf, "\n")) != NULL) {
> if (process_server_config_line(options, cp, filename,
> linenum++) != 0)
> bad_options++;
> }
> xfree(obuf);