]> andersk Git - openssh.git/blobdiff - servconf.c
- jakob@cvs.openbsd.org 2001/08/02 16:14:05
[openssh.git] / servconf.c
index 55b0b0039731ba73fb93c33f6a9270eb447e4c80..0f16c851e4064b756b02a58f1e297b7eed9afa0d 100644 (file)
@@ -10,9 +10,9 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: servconf.c,v 1.84 2001/06/23 15:12:19 itojun Exp $");
+RCSID("$OpenBSD: servconf.c,v 1.88 2001/07/11 00:24:53 itojun Exp $");
 
-#ifdef KRB4
+#if defined(KRB4) || defined(KRB5)
 #include <krb.h>
 #endif
 #ifdef AFS
@@ -70,13 +70,15 @@ initialize_server_options(ServerOptions *options)
        options->hostbased_uses_name_from_packet_only = -1;
        options->rsa_authentication = -1;
        options->pubkey_authentication = -1;
-#ifdef KRB4
+#if defined(KRB4) || defined(KRB5)
        options->kerberos_authentication = -1;
        options->kerberos_or_local_passwd = -1;
        options->kerberos_ticket_cleanup = -1;
 #endif
-#ifdef AFS
+#if defined(AFS) || defined(KRB5)
        options->kerberos_tgt_passing = -1;
+#endif
+#ifdef AFS
        options->afs_token_passing = -1;
 #endif
        options->password_authentication = -1;
@@ -170,20 +172,22 @@ fill_default_server_options(ServerOptions *options)
                options->rsa_authentication = 1;
        if (options->pubkey_authentication == -1)
                options->pubkey_authentication = 1;
-#ifdef KRB4
+#if defined(KRB4) || defined(KRB5)
        if (options->kerberos_authentication == -1)
                options->kerberos_authentication = (access(KEYFILE, R_OK) == 0);
        if (options->kerberos_or_local_passwd == -1)
                options->kerberos_or_local_passwd = 1;
        if (options->kerberos_ticket_cleanup == -1)
                options->kerberos_ticket_cleanup = 1;
-#endif /* KRB4 */
-#ifdef AFS
+#endif
+#if defined(AFS) || defined(KRB5)
        if (options->kerberos_tgt_passing == -1)
                options->kerberos_tgt_passing = 0;
+#endif
+#ifdef AFS     
        if (options->afs_token_passing == -1)
                options->afs_token_passing = k_hasafs();
-#endif /* AFS */
+#endif
        if (options->password_authentication == -1)
                options->password_authentication = 1;
        if (options->kbd_interactive_authentication == -1)
@@ -211,9 +215,9 @@ fill_default_server_options(ServerOptions *options)
        if (options->client_alive_count_max == -1)
                options->client_alive_count_max = 3;
        if (options->authorized_keys_file == NULL)
-               options->authorized_keys_file = _PATH_SSH_USER_PERMITTED_KEYS;  
+               options->authorized_keys_file = _PATH_SSH_USER_PERMITTED_KEYS;
        if (options->authorized_keys_file2 == NULL)
-               options->authorized_keys_file2 = _PATH_SSH_USER_PERMITTED_KEYS2;
+               options->authorized_keys_file2 = _PATH_SSH_USER_PERMITTED_KEYS2;
        if (options->pam_authentication_via_kbd_int == -1)
                options->pam_authentication_via_kbd_int = 0;
 }
@@ -224,11 +228,14 @@ typedef enum {
        sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime,
        sPermitRootLogin, sLogFacility, sLogLevel,
        sRhostsAuthentication, sRhostsRSAAuthentication, sRSAAuthentication,
-#ifdef KRB4
+#if defined(KRB4) || defined(KRB5)
        sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
 #endif
+#if defined(AFS) || defined(KRB5)
+       sKerberosTgtPassing,
+#endif
 #ifdef AFS
-       sKerberosTgtPassing, sAFSTokenPassing,
+       sAFSTokenPassing,
 #endif
        sChallengeResponseAuthentication,
        sPasswordAuthentication, sKbdInteractiveAuthentication, sListenAddress,
@@ -267,13 +274,15 @@ static struct {
        { "rsaauthentication", sRSAAuthentication },
        { "pubkeyauthentication", sPubkeyAuthentication },
        { "dsaauthentication", sPubkeyAuthentication },                 /* alias */
-#ifdef KRB4
+#if defined(KRB4) || defined(KRB5)
        { "kerberosauthentication", sKerberosAuthentication },
        { "kerberosorlocalpasswd", sKerberosOrLocalPasswd },
        { "kerberosticketcleanup", sKerberosTicketCleanup },
 #endif
-#ifdef AFS
+#if defined(AFS) || defined(KRB5)
        { "kerberostgtpassing", sKerberosTgtPassing },
+#endif
+#ifdef AFS
        { "afstokenpassing", sAFSTokenPassing },
 #endif
        { "passwordauthentication", sPasswordAuthentication },
@@ -380,7 +389,7 @@ read_server_config(ServerOptions *options, const char *filename)
        int linenum, *intptr, value;
        int bad_options = 0;
        ServerOpCodes opcode;
-       int i;
+       int i, n;
 
        f = fopen(filename, "r");
        if (!f) {
@@ -584,8 +593,7 @@ parse_flag:
                case sPubkeyAuthentication:
                        intptr = &options->pubkey_authentication;
                        goto parse_flag;
-
-#ifdef KRB4
+#if defined(KRB4) || defined(KRB5)
                case sKerberosAuthentication:
                        intptr = &options->kerberos_authentication;
                        goto parse_flag;
@@ -598,12 +606,12 @@ parse_flag:
                        intptr = &options->kerberos_ticket_cleanup;
                        goto parse_flag;
 #endif
-
-#ifdef AFS
+#if defined(AFS) || defined(KRB5)
                case sKerberosTgtPassing:
                        intptr = &options->kerberos_tgt_passing;
                        goto parse_flag;
-
+#endif
+#ifdef AFS
                case sAFSTokenPassing:
                        intptr = &options->afs_token_passing;
                        goto parse_flag;
@@ -793,20 +801,22 @@ parse_flag:
                        if (!arg || *arg == '\0')
                                fatal("%s line %d: Missing MaxStartups spec.",
                                      filename, linenum);
-                       if (sscanf(arg, "%d:%d:%d",
+                       if ((n = sscanf(arg, "%d:%d:%d",
                            &options->max_startups_begin,
                            &options->max_startups_rate,
-                           &options->max_startups) == 3) {
+                           &options->max_startups)) == 3) {
                                if (options->max_startups_begin >
                                    options->max_startups ||
                                    options->max_startups_rate > 100 ||
                                    options->max_startups_rate < 1)
+                                       fatal("%s line %d: Illegal MaxStartups spec.",
+                                           filename, linenum);
+                       } else if (n != 1)
                                fatal("%s line %d: Illegal MaxStartups spec.",
-                                     filename, linenum);
-                               break;
-                       }
-                       intptr = &options->max_startups;
-                       goto parse_int;
+                                   filename, linenum);
+                       else
+                               options->max_startups = options->max_startups_begin;
+                       break;
 
                case sBanner:
                        charptr = &options->banner;
This page took 0.035588 seconds and 4 git commands to generate.