diff -urN v4.2p1/openssh-4.2p1/gss-genr.c openssh-4.2p1/gss-genr.c --- v4.2p1/openssh-4.2p1/gss-genr.c Sun Jul 17 02:22:45 2005 +++ openssh-4.2p1/gss-genr.c Wed Sep 28 09:43:50 2005 @@ -37,6 +37,10 @@ #include "ssh-gss.h" +#include "servconf.h" +/* import */ +extern ServerOptions options; + extern u_char *session_id2; extern u_int session_id2_len; @@ -206,15 +210,17 @@ { gss_buffer_desc gssbuf; - gssbuf.length = sizeof("host@") + strlen(host); - gssbuf.value = xmalloc(gssbuf.length); - snprintf(gssbuf.value, gssbuf.length, "host@%s", host); - - if ((ctx->major = gss_import_name(&ctx->minor, - &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name))) - ssh_gssapi_error(ctx); + if ( host ) { + gssbuf.length = sizeof("host@") + strlen(host); + gssbuf.value = xmalloc(gssbuf.length); + snprintf(gssbuf.value, gssbuf.length, "host@%s", host); + + if ((ctx->major = gss_import_name(&ctx->minor, + &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name))) + ssh_gssapi_error(ctx); + xfree(gssbuf.value); + } - xfree(gssbuf.value); return (ctx->major); } diff -urN v4.2p1/openssh-4.2p1/servconf.c openssh-4.2p1/servconf.c --- v4.2p1/openssh-4.2p1/servconf.c Fri Aug 12 07:11:37 2005 +++ openssh-4.2p1/servconf.c Wed Sep 28 09:43:50 2005 @@ -73,6 +73,7 @@ options->kerberos_get_afs_token = -1; options->gss_authentication=-1; options->gss_cleanup_creds = -1; + options->gss_import_hostname = -1; options->password_authentication = -1; options->kbd_interactive_authentication = -1; options->challenge_response_authentication = -1; @@ -186,6 +187,8 @@ options->kerberos_get_afs_token = 0; if (options->gss_authentication == -1) options->gss_authentication = 0; + if (options->gss_import_hostname == -1) + options->gss_import_hostname = GSS_IMPORT_HOSTNAME; if (options->gss_cleanup_creds == -1) options->gss_cleanup_creds = 1; if (options->password_authentication == -1) @@ -270,7 +273,7 @@ sBanner, sUseDNS, sHostbasedAuthentication, sHostbasedUsesNameFromPacketOnly, sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2, - sGssAuthentication, sGssCleanupCreds, sAcceptEnv, + sGssAuthentication, sGssCleanupCreds, sGssImportHostname, sAcceptEnv, sUsePrivilegeSeparation, sDeprecated, sUnsupported } ServerOpCodes; @@ -325,9 +328,11 @@ #ifdef GSSAPI { "gssapiauthentication", sGssAuthentication }, { "gssapicleanupcredentials", sGssCleanupCreds }, + { "gssapiimporthostname", sGssImportHostname}, #else { "gssapiauthentication", sUnsupported }, { "gssapicleanupcredentials", sUnsupported }, + { "gssapiimporthostname", sUnsupported}, #endif { "passwordauthentication", sPasswordAuthentication }, { "kbdinteractiveauthentication", sKbdInteractiveAuthentication }, @@ -672,6 +677,28 @@ case sGssCleanupCreds: intptr = &options->gss_cleanup_creds; goto parse_flag; + + case sGssImportHostname: + intptr = &options->gss_import_hostname; + arg = strdelim(&cp); + if (!arg || *arg == '\0') + fatal("%s line %d: missing hostname/" + "connection-ip/gss-c-no-name " + "argument.", filename, linenum); + value = 0; /* silence compiler */ + if (strcmp(arg, "hostname") == 0) + value = GSS_IMPORT_HOSTNAME; + else if (strcmp(arg, "connection-ip") == 0) + value = GSS_IMPORT_CONNECTION_IP; + else if (strcmp(arg, "gss-c-no-name") == 0) + value = GSS_IMPORT_NO_NAME; + else + fatal("%s line %d: Bad hostname/" + "connection-ip/gss-c-no-name " + "argument: %s", filename, linenum, arg); + if (*intptr == -1) + *intptr = value; + break; case sPasswordAuthentication: intptr = &options->password_authentication; diff -urN v4.2p1/openssh-4.2p1/servconf.h openssh-4.2p1/servconf.h --- v4.2p1/openssh-4.2p1/servconf.h Wed Jan 19 17:57:56 2005 +++ openssh-4.2p1/servconf.h Wed Sep 28 09:43:50 2005 @@ -37,6 +37,11 @@ #define DEFAULT_AUTH_FAIL_MAX 6 /* Default for MaxAuthTries */ +/* gss_import_hostname flags */ +#define GSS_IMPORT_HOSTNAME 0 +#define GSS_IMPORT_CONNECTION_IP 1 +#define GSS_IMPORT_NO_NAME 2 + typedef struct { u_int num_ports; u_int ports_from_cmdline; @@ -89,6 +94,7 @@ * authenticated with Kerberos. */ int gss_authentication; /* If true, permit GSSAPI authentication */ int gss_cleanup_creds; /* If true, destroy cred cache on logout */ + int gss_import_hostname; /* Possible values 0,1,2 */ int password_authentication; /* If true, permit password * authentication. */ int kbd_interactive_authentication; /* If true, permit */