⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readconf.c

📁 OpenSSH 是 SSH (Secure SHell) 协议的免费开源实现。它用安全、加密的网络连接工具代替了 telnet、ftp、 rlogin、rsh 和 rcp 工具。OpenSSH 支持
💻 C
📖 第 1 页 / 共 3 页
字号:
		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 oGssAuthentication:		intptr = &options->gss_authentication;		goto parse_flag;	case oGssDelegateCreds:		intptr = &options->gss_deleg_creds;		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_yesnoask;	case oStrictHostKeyChecking:		intptr = &options->strict_host_key_checking;parse_yesnoask:		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 oTCPKeepAlive:		intptr = &options->tcp_keep_alive;		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:		if (s == NULL)			fatal("%.200s line %d: Missing argument.", filename, linenum);		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 == NULL || *arg == '\0')			fatal("%.200s line %d: Missing port argument.",			    filename, linenum);		arg2 = strdelim(&s);		if (arg2 == NULL || *arg2 == '\0')			fatal("%.200s line %d: Missing target argument.",			    filename, linenum);		/* construct a string for parse_forward */		snprintf(fwdarg, sizeof(fwdarg), "%s:%s", arg, arg2);		if (parse_forward(&fwd, fwdarg) == 0)			fatal("%.200s line %d: Bad forwarding specification.",			    filename, linenum);		if (*activep) {			if (opcode == oLocalForward)				add_local_forward(options, &fwd);			else if (opcode == oRemoteForward)				add_remote_forward(options, &fwd);		}		break;	case oDynamicForward:		arg = strdelim(&s);		if (!arg || *arg == '\0')			fatal("%.200s line %d: Missing port argument.",			    filename, linenum);		memset(&fwd, '\0', sizeof(fwd));		fwd.connect_host = "socks";		fwd.listen_host = hpdelim(&arg);		if (fwd.listen_host == NULL ||		    strlen(fwd.listen_host) >= NI_MAXHOST)			fatal("%.200s line %d: Bad forwarding specification.",			    filename, linenum);		if (arg) {			fwd.listen_port = a2port(arg);			fwd.listen_host = cleanhostname(fwd.listen_host);		} else {			fwd.listen_port = a2port(fwd.listen_host);			fwd.listen_host = "";		}		if (fwd.listen_port == 0)			fatal("%.200s line %d: Badly formatted port number.",			    filename, linenum);		if (*activep)			add_local_forward(options, &fwd);		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 oAddressFamily:		arg = strdelim(&s);		intptr = &options->address_family;		if (strcasecmp(arg, "inet") == 0)			value = AF_INET;		else if (strcasecmp(arg, "inet6") == 0)			value = AF_INET6;		else if (strcasecmp(arg, "any") == 0)			value = AF_UNSPEC;		else			fatal("Unsupported AddressFamily \"%s\"", arg);		if (*activep && *intptr == -1)			*intptr = value;		break;	case oEnableSSHKeysign:		intptr = &options->enable_ssh_keysign;		goto parse_flag;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -