char *password;
ssh_userauth2(int host_key_valid, RSA *own_host_key,    uid_t original_real_uid, char *host){	int type;	int plen;	unsigned int dlen;	int partial;	struct passwd *pw;	char prompt[80];	char *server_user, *local_user;	char *auths;	char *password;	char *service = "ssh-connection";		/* service name */	debug("send SSH2_MSG_SERVICE_REQUEST");	packet_start(SSH2_MSG_SERVICE_REQUEST);	packet_put_cstring("ssh-userauth");	packet_send();	packet_write_wait();	type = packet_read(&plen);	if (type != SSH2_MSG_SERVICE_ACCEPT) {		fatal("denied SSH2_MSG_SERVICE_ACCEPT: %d", type);	}	if (packet_remaining() > 0) {		char *reply = packet_get_string(&plen);		debug("service_accept: %s", reply);		xfree(reply);	} else {		/* payload empty for ssh-2.0.13 ?? */		log("buggy server: service_accept w/o service");	}	packet_done();	debug("got SSH2_MSG_SERVICE_ACCEPT");	/*XX COMMONCODE: */	/* Get local user name.  Use it as server user if no user name was given. */	pw = getpwuid(original_real_uid);	if (!pw)		fatal("User id %d not found from user database.", original_real_uid);	local_user = xstrdup(pw->pw_name);	server_user = options.user ? options.user : local_user;	/* INITIAL request for auth */	packet_start(SSH2_MSG_USERAUTH_REQUEST);	packet_put_cstring(server_user);	packet_put_cstring(service);	packet_put_cstring("none");	packet_send();	packet_write_wait();	for (;;) {		type = packet_read(&plen);		if (type == SSH2_MSG_USERAUTH_SUCCESS)			break;		if (type != SSH2_MSG_USERAUTH_FAILURE)			fatal("access denied: %d", type);		/* SSH2_MSG_USERAUTH_FAILURE means: try again */		auths = packet_get_string(&dlen);		debug("authentications that can continue: %s", auths);		partial = packet_get_char();		packet_done();		if (partial)			debug("partial success");		if (strstr(auths, "password") == NULL)			fatal("passwd auth not supported: %s", auths);		xfree(auths);		/* try passwd */		snprintf(prompt, sizeof(prompt), "%.30s@%.40s's password: ",		    server_user, host);		password = read_passphrase(prompt, 0);		packet_start(SSH2_MSG_USERAUTH_REQUEST);		packet_put_cstring(server_user);		packet_put_cstring(service);		packet_put_cstring("password");		packet_put_char(0);		packet_put_cstring(password);		memset(password, 0, strlen(password));		xfree(password);		packet_send();		packet_write_wait();	}	packet_done();	debug("ssh-userauth2 successfull");}