case oAddressFamily: arg = strdelim(&s); if (strcasecmp(arg, "inet") == 0) IPv4or6 = AF_INET; else if (strcasecmp(arg, "inet6") == 0) IPv4or6 = AF_INET6; else if (strcasecmp(arg, "any") == 0) IPv4or6 = AF_UNSPEC; else fatal("Unsupported AddressFamily \"%s\"", arg); break;
process_config_line(Options *options, const char *host,		    char *line, const char *filename, int linenum,		    int *activep){	char buf[256], *s, **charptr, *endofnumber, *keyword, *arg;	int opcode, *intptr, value;	size_t len;	u_short fwd_port, fwd_host_port;	char sfwd_host_port[6];	/* Strip trailing whitespace */	for(len = strlen(line) - 1; len > 0; len--) {		if (strchr(WHITESPACE, line[len]) == NULL)			break;		line[len] = '\0';	}	s = line;	/* Get the keyword. (Each line is supposed to begin with a keyword). */	keyword = strdelim(&s);	/* Ignore leading whitespace. */	if (*keyword == '\0')		keyword = strdelim(&s);	if (keyword == NULL || !*keyword || *keyword == '\n' || *keyword == '#')		return 0;	opcode = parse_token(keyword, filename, linenum);	switch (opcode) {	case oBadOption:		/* don't panic, but count bad options */		return -1;		/* NOTREACHED */	case oConnectTimeout:		intptr = &options->connection_timeout;/* parse_time: */		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%s line %d: missing time value.",			    filename, linenum);		if ((value = convtime(arg)) == -1)			fatal("%s line %d: invalid time value.",			    filename, linenum);		if (*intptr == -1)			*intptr = value;		break;	case oForwardAgent:		intptr = &options->forward_agent;parse_flag:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing yes/no argument.", filename, linenum);		value = 0;	/* To avoid compiler warning... */		if (strcmp(arg, "yes") == 0 || strcmp(arg, "true") == 0)			value = 1;		else if (strcmp(arg, "no") == 0 || strcmp(arg, "false") == 0)			value = 0;		else			fatal("%.200s line %d: Bad yes/no argument.", filename, linenum);		if (*activep && *intptr == -1)			*intptr = value;		break;	case oForwardX11:		intptr = &options->forward_x11;		goto parse_flag;	case oGatewayPorts:		intptr = &options->gateway_ports;		goto parse_flag;	case oUsePrivilegedPort:		intptr = &options->use_privileged_port;		goto parse_flag;	case oRhostsAuthentication:		intptr = &options->rhosts_authentication;		goto parse_flag;	case oPasswordAuthentication:		intptr = &options->password_authentication;		goto parse_flag;	case oKbdInteractiveAuthentication:		intptr = &options->kbd_interactive_authentication;		goto parse_flag;	case oKbdInteractiveDevices:		charptr = &options->kbd_interactive_devices;		goto parse_string;	case oPubkeyAuthentication:		intptr = &options->pubkey_authentication;		goto parse_flag;	case oRSAAuthentication:		intptr = &options->rsa_authentication;		goto parse_flag;	case oRhostsRSAAuthentication:		intptr = &options->rhosts_rsa_authentication;		goto parse_flag;	case oHostbasedAuthentication:		intptr = &options->hostbased_authentication;		goto parse_flag;	case oChallengeResponseAuthentication:		intptr = &options->challenge_response_authentication;		goto parse_flag;	case oKerberosAuthentication:		intptr = &options->kerberos_authentication;		goto parse_flag;	case oKerberosTgtPassing:		intptr = &options->kerberos_tgt_passing;		goto parse_flag;	case oAFSTokenPassing:		intptr = &options->afs_token_passing;		goto parse_flag;	case oBatchMode:		intptr = &options->batch_mode;		goto parse_flag;	case oCheckHostIP:		intptr = &options->check_host_ip;		goto parse_flag;	case oVerifyHostKeyDNS:		intptr = &options->verify_host_key_dns;		goto parse_flag;	case oStrictHostKeyChecking:		intptr = &options->strict_host_key_checking;		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing yes/no/ask argument.",			    filename, linenum);		value = 0;	/* To avoid compiler warning... */		if (strcmp(arg, "yes") == 0 || strcmp(arg, "true") == 0)			value = 1;		else if (strcmp(arg, "no") == 0 || strcmp(arg, "false") == 0)			value = 0;		else if (strcmp(arg, "ask") == 0)			value = 2;		else			fatal("%.200s line %d: Bad yes/no/ask argument.", filename, linenum);		if (*activep && *intptr == -1)			*intptr = value;		break;	case oCompression:		intptr = &options->compression;		goto parse_flag;	case oKeepAlives:		intptr = &options->keepalives;		goto parse_flag;	case oNoHostAuthenticationForLocalhost:		intptr = &options->no_host_authentication_for_localhost;		goto parse_flag;	case oNumberOfPasswordPrompts:		intptr = &options->number_of_password_prompts;		goto parse_int;	case oCompressionLevel:		intptr = &options->compression_level;		goto parse_int;	case oRekeyLimit:		intptr = &options->rekey_limit;		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		if (arg[0] < '0' || arg[0] > '9')			fatal("%.200s line %d: Bad number.", filename, linenum);		value = strtol(arg, &endofnumber, 10);		if (arg == endofnumber)			fatal("%.200s line %d: Bad number.", filename, linenum);		switch (toupper(*endofnumber)) {		case 'K':			value *= 1<<10;			break;		case 'M':			value *= 1<<20;			break;		case 'G':			value *= 1<<30;			break;		}		if (*activep && *intptr == -1)			*intptr = value;		break;	case oIdentityFile:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		if (*activep) {			intptr = &options->num_identity_files;			if (*intptr >= SSH_MAX_IDENTITY_FILES)				fatal("%.200s line %d: Too many identity files specified (max %d).",				    filename, linenum, SSH_MAX_IDENTITY_FILES);			charptr =  &options->identity_files[*intptr];			*charptr = xstrdup(arg);			*intptr = *intptr + 1;		}		break;	case oXAuthLocation:		charptr=&options->xauth_location;		goto parse_string;	case oUser:		charptr = &options->user;parse_string:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		if (*activep && *charptr == NULL)			*charptr = xstrdup(arg);		break;	case oGlobalKnownHostsFile:		charptr = &options->system_hostfile;		goto parse_string;	case oUserKnownHostsFile:		charptr = &options->user_hostfile;		goto parse_string;	case oGlobalKnownHostsFile2:		charptr = &options->system_hostfile2;		goto parse_string;	case oUserKnownHostsFile2:		charptr = &options->user_hostfile2;		goto parse_string;	case oHostName:		charptr = &options->hostname;		goto parse_string;	case oHostKeyAlias:		charptr = &options->host_key_alias;		goto parse_string;	case oPreferredAuthentications:		charptr = &options->preferred_authentications;		goto parse_string;	case oBindAddress:		charptr = &options->bind_address;		goto parse_string;	case oSmartcardDevice:		charptr = &options->smartcard_device;		goto parse_string;	case oProxyCommand:		charptr = &options->proxy_command;		len = strspn(s, WHITESPACE "=");		if (*activep && *charptr == NULL)			*charptr = xstrdup(s + len);		return 0;	case oPort:		intptr = &options->port;parse_int:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		if (arg[0] < '0' || arg[0] > '9')			fatal("%.200s line %d: Bad number.", filename, linenum);		/* Octal, decimal, or hex format? */		value = strtol(arg, &endofnumber, 0);		if (arg == endofnumber)			fatal("%.200s line %d: Bad number.", filename, linenum);		if (*activep && *intptr == -1)			*intptr = value;		break;	case oConnectionAttempts:		intptr = &options->connection_attempts;		goto parse_int;	case oCipher:		intptr = &options->cipher;		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		value = cipher_number(arg);		if (value == -1)			fatal("%.200s line %d: Bad cipher '%s'.",			    filename, linenum, arg ? arg : "<NONE>");		if (*activep && *intptr == -1)			*intptr = value;		break;	case oCiphers:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		if (!ciphers_valid(arg))			fatal("%.200s line %d: Bad SSH2 cipher spec '%s'.",			    filename, linenum, arg ? arg : "<NONE>");		if (*activep && options->ciphers == NULL)			options->ciphers = xstrdup(arg);		break;	case oMacs:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		if (!mac_valid(arg))			fatal("%.200s line %d: Bad SSH2 Mac spec '%s'.",			    filename, linenum, arg ? arg : "<NONE>");		if (*activep && options->macs == NULL)			options->macs = xstrdup(arg);		break;	case oHostKeyAlgorithms:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		if (!key_names_valid2(arg))			fatal("%.200s line %d: Bad protocol 2 host key algorithms '%s'.",			    filename, linenum, arg ? arg : "<NONE>");		if (*activep && options->hostkeyalgorithms == NULL)			options->hostkeyalgorithms = xstrdup(arg);		break;	case oProtocol:		intptr = &options->protocol;		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		value = proto_spec(arg);		if (value == SSH_PROTO_UNKNOWN)			fatal("%.200s line %d: Bad protocol spec '%s'.",			    filename, linenum, arg ? arg : "<NONE>");		if (*activep && *intptr == SSH_PROTO_UNKNOWN)			*intptr = value;		break;	case oLogLevel:		intptr = (int *) &options->log_level;		arg = strdelim(&s);		value = log_level_number(arg);		if (value == SYSLOG_LEVEL_NOT_SET)			fatal("%.200s line %d: unsupported log level '%s'",			    filename, linenum, arg ? arg : "<NONE>");		if (*activep && (LogLevel) *intptr == SYSLOG_LEVEL_NOT_SET)			*intptr = (LogLevel) value;		break;	case oLocalForward:	case oRemoteForward:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing port argument.",			    filename, linenum);		if ((fwd_port = a2port(arg)) == 0)			fatal("%.200s line %d: Bad listen port.",			    filename, linenum);		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing second argument.",			    filename, linenum);		if (sscanf(arg, "%255[^:]:%5[0-9]", buf, sfwd_host_port) != 2 &&		    sscanf(arg, "%255[^/]/%5[0-9]", buf, sfwd_host_port) != 2)			fatal("%.200s line %d: Bad forwarding specification.",			    filename, linenum);		if ((fwd_host_port = a2port(sfwd_host_port)) == 0)			fatal("%.200s line %d: Bad forwarding port.",			    filename, linenum);		if (*activep) {			if (opcode == oLocalForward)				add_local_forward(options, fwd_port, buf,				    fwd_host_port);			else if (opcode == oRemoteForward)				add_remote_forward(options, fwd_port, buf,				    fwd_host_port);		}		break;	case oDynamicForward:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing port argument.",			    filename, linenum);		fwd_port = a2port(arg);		if (fwd_port == 0)			fatal("%.200s line %d: Badly formatted port number.",			    filename, linenum);		if (*activep)			add_local_forward(options, fwd_port, "socks4", 0);		break;	case oClearAllForwardings:		intptr = &options->clear_forwardings;		goto parse_flag;	case oHost:		*activep = 0;		while ((arg = strdelim(&s)) != NULL && *arg != '\0')			if (match_pattern(host, arg)) {				debug("Applying options for %.100s", arg);				*activep = 1;				break;			}		/* Avoid garbage check below, as strdelim is done. */		return 0;	case oEscapeChar:		intptr = &options->escape_char;		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing argument.", filename, linenum);		if (arg[0] == '^' && arg[2] == 0 &&		    (u_char) arg[1] >= 64 && (u_char) arg[1] < 128)			value = (u_char) arg[1] & 31;		else if (strlen(arg) == 1)			value = (u_char) arg[0];		else if (strcmp(arg, "none") == 0)			value = SSH_ESCAPECHAR_NONE;		else {			fatal("%.200s line %d: Bad escape character.",			    filename, linenum);			/* NOTREACHED */			value = 0;	/* Avoid compiler warning. */		}		if (*activep && *intptr == -1)			*intptr = value;		break;	case oEnableSSHKeysign:		intptr = &options->enable_ssh_keysign;		goto parse_flag;	case oDeprecated:		debug("%s line %d: Deprecated option \"%s\"",		    filename, linenum, keyword);		return 0;	case oUnsupported:		error("%s line %d: Unsupported option \"%s\"",		    filename, linenum, keyword);		return 0;	default:		fatal("process_config_line: Unimplemented opcode %d", opcode);	}	/* Check that there is no garbage at end of line. */	if ((arg = strdelim(&s)) != NULL && *arg != '\0') {		fatal("%.200s line %d: garbage at end of line; \"%.200s\".",		     filename, linenum, arg);	}	return 0;}