summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/servconf.c b/servconf.c
index 6583829e7..0e323231d 100644
--- a/servconf.c
+++ b/servconf.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$Id: servconf.c,v 1.18 2000/06/07 09:55:44 djm Exp $"); 15RCSID("$Id: servconf.c,v 1.19 2000/06/18 04:50:44 djm Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "servconf.h" 18#include "servconf.h"
@@ -75,6 +75,7 @@ initialize_server_options(ServerOptions *options)
75 options->ciphers = NULL; 75 options->ciphers = NULL;
76 options->protocol = SSH_PROTO_UNKNOWN; 76 options->protocol = SSH_PROTO_UNKNOWN;
77 options->gateway_ports = -1; 77 options->gateway_ports = -1;
78 options->num_subsystems = 0;
78} 79}
79 80
80void 81void
@@ -160,7 +161,7 @@ fill_default_server_options(ServerOptions *options)
160 options->gateway_ports = 0; 161 options->gateway_ports = 0;
161} 162}
162 163
163#define WHITESPACE " \t\r\n" 164#define WHITESPACE " \t\r\n="
164 165
165/* Keyword tokens. */ 166/* Keyword tokens. */
166typedef enum { 167typedef enum {
@@ -182,7 +183,7 @@ typedef enum {
182 sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail, 183 sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail,
183 sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, 184 sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
184 sIgnoreUserKnownHosts, sHostDSAKeyFile, sCiphers, sProtocol, sPidFile, 185 sIgnoreUserKnownHosts, sHostDSAKeyFile, sCiphers, sProtocol, sPidFile,
185 sGatewayPorts, sDSAAuthentication, sXAuthLocation 186 sGatewayPorts, sDSAAuthentication, sXAuthLocation, sSubsystem
186} ServerOpCodes; 187} ServerOpCodes;
187 188
188/* Textual representation of the tokens. */ 189/* Textual representation of the tokens. */
@@ -237,6 +238,7 @@ static struct {
237 { "ciphers", sCiphers }, 238 { "ciphers", sCiphers },
238 { "protocol", sProtocol }, 239 { "protocol", sProtocol },
239 { "gatewayports", sGatewayPorts }, 240 { "gatewayports", sGatewayPorts },
241 { "subsystem", sSubsystem },
240 { NULL, 0 } 242 { NULL, 0 }
241}; 243};
242 244
@@ -302,6 +304,7 @@ read_server_config(ServerOptions *options, const char *filename)
302 int linenum, *intptr, value; 304 int linenum, *intptr, value;
303 int bad_options = 0; 305 int bad_options = 0;
304 ServerOpCodes opcode; 306 ServerOpCodes opcode;
307 int i;
305 308
306 f = fopen(filename, "r"); 309 f = fopen(filename, "r");
307 if (!f) { 310 if (!f) {
@@ -613,6 +616,28 @@ parse_flag:
613 *intptr = value; 616 *intptr = value;
614 break; 617 break;
615 618
619 case sSubsystem:
620 if(options->num_subsystems >= MAX_SUBSYSTEMS) {
621 fatal("%s line %d: too many subsystems defined.",
622 filename, linenum);
623 }
624 cp = strtok(NULL, WHITESPACE);
625 if (!cp)
626 fatal("%s line %d: Missing subsystem name.",
627 filename, linenum);
628 for (i = 0; i < options->num_subsystems; i++)
629 if(strcmp(cp, options->subsystem_name[i]) == 0)
630 fatal("%s line %d: Subsystem '%s' already defined.",
631 filename, linenum, cp);
632 options->subsystem_name[options->num_subsystems] = xstrdup(cp);
633 cp = strtok(NULL, WHITESPACE);
634 if (!cp)
635 fatal("%s line %d: Missing subsystem command.",
636 filename, linenum);
637 options->subsystem_command[options->num_subsystems] = xstrdup(cp);
638 options->num_subsystems++;
639 break;
640
616 default: 641 default:
617 fprintf(stderr, "%s line %d: Missing handler for opcode %s (%d)\n", 642 fprintf(stderr, "%s line %d: Missing handler for opcode %s (%d)\n",
618 filename, linenum, cp, opcode); 643 filename, linenum, cp, opcode);