user = packet_get_string(NULL);
service = packet_get_string(NULL);
method = packet_get_string(NULL);
+
+ if(strcmp(method,"external-keyx") == 0 && strcmp(user,"") == 0) {
+ char *gridmapped_name = NULL;
+ struct passwd *pw = NULL;
+
+ gssapi_setup_env();
+ if(globus_gss_assist_gridmap(gssapi_client_name.value,
+ &gridmapped_name) == 0) {
+ user = gridmapped_name;
+ debug("I gridmapped and got %s", user);
+ pw = getpwnam(user);
+ if (pw && allowed_user(pw)) {
+ authctxt->user = user;
+ authctxt->pw = pwcopy(pw);
+ authctxt->valid = 1;
+ }
+ } else {
+ debug("I gridmapped and got null, reverting to %s", authctxt->user);
+ user = authctxt->user;
+ }
+ }
+
debug("userauth-request for user %s service %s method %s", user, service, method);
debug("attempt %d failures %d", authctxt->attempt, authctxt->failures);
char *host_key_alias; /* hostname alias for .ssh/known_hosts */
char *proxy_command; /* Proxy command for connecting the host. */
char *user; /* User to log in as. */
+ int implicit;
int escape_char; /* Escape character; -2 = none */
char *system_hostfile;/* Path for /etc/ssh/ssh_known_hosts. */
seed_rng();
- if (options.user == NULL)
- options.user = xstrdup(pw->pw_name);
+ if (options.user == NULL) {
+ options.user = xstrdup(pw->pw_name);
+ options.implicit = 1;
+ }
+ else options.implicit = 0;
if (options.hostname != NULL)
host = options.hostname;
authctxt->methoddata=(void *)gssctxt;
packet_start(SSH2_MSG_USERAUTH_REQUEST);
- packet_put_cstring(authctxt->server_user);
+ if(options.implicit) packet_put_cstring("");
+ else packet_put_cstring(authctxt->server_user);
packet_put_cstring(authctxt->service);
packet_put_cstring(authctxt->method->name);