Пример #1
0
void
pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...)
{
	char *fp, *extra;
	va_list ap;
	int i;

	extra = NULL;
	if (fmt != NULL) {
		va_start(ap, fmt);
		i = vasprintf(&extra, fmt, ap);
		va_end(ap);
		if (i < 0 || extra == NULL)
			fatal("%s: vasprintf failed", __func__);	
	}

	if (key_is_cert(key)) {
		fp = key_fingerprint(key->cert->signature_key,
		    SSH_FP_MD5, SSH_FP_HEX);
		auth_info(authctxt, "%s ID %s (serial %llu) CA %s %s%s%s", 
		    key_type(key), key->cert->key_id,
		    (unsigned long long)key->cert->serial,
		    key_type(key->cert->signature_key), fp,
		    extra == NULL ? "" : ", ", extra == NULL ? "" : extra);
		free(fp);
	} else {
		fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
		auth_info(authctxt, "%s %s%s%s", key_type(key), fp,
		    extra == NULL ? "" : ", ", extra == NULL ? "" : extra);
		free(fp);
	}
	free(extra);
}
Пример #2
0
void User::set_removed(bool removed) {
    if (removed) {
        set_rights(NONE);
    } else {
        set_rights(Options::instance()->regular_user_rights());
    }
    if (!auth_info()) {
        return;
    }
    Wt::Auth::User::Status status = removed ?
                                    Wt::Auth::User::Disabled :
                                    Wt::Auth::User::Normal;
    auth_info().reread();
    auth_info().modify()->setStatus(status);
}
Пример #3
0
void
pubkey_auth_info(Authctxt *authctxt, const Key *key)
{
	char *fp;

	if (key_is_cert(key)) {
		fp = key_fingerprint(key->cert->signature_key,
		    SSH_FP_MD5, SSH_FP_HEX);
		auth_info(authctxt, "%s ID %s (serial %llu) CA %s %s", 
		    key_type(key), key->cert->key_id,
		    (unsigned long long)key->cert->serial,
		    key_type(key->cert->signature_key), fp);
		free(fp);
	} else {
		fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
		auth_info(authctxt, "%s %s", key_type(key), fp);
		free(fp);
	}
}
Пример #4
0
/*ARGSUSED*/
static int
auth1_process_rhosts_rsa(Authctxt *authctxt)
{
	int keybits, authenticated = 0;
	u_int bits;
	char *client_user;
	Key *client_host_key;
	u_int ulen;

	/*
	 * Get client user name.  Note that we just have to
	 * trust the client; root on the client machine can
	 * claim to be any user.
	 */
	client_user = packet_get_cstring(&ulen);

	/* Get the client host key. */
	client_host_key = key_new(KEY_RSA1);
	bits = packet_get_int();
	packet_get_bignum(client_host_key->rsa->e);
	packet_get_bignum(client_host_key->rsa->n);

	keybits = BN_num_bits(client_host_key->rsa->n);
	if (keybits < 0 || bits != (u_int)keybits) {
		verbose("Warning: keysize mismatch for client_host_key: "
		    "actual %d, announced %d",
		    BN_num_bits(client_host_key->rsa->n), bits);
	}
	packet_check_eom();

	authenticated = auth_rhosts_rsa(authctxt, client_user,
	    client_host_key);
	key_free(client_host_key);

	auth_info(authctxt, "ruser %.100s", client_user);
	free(client_user);

	return (authenticated);
}
Пример #5
0
std::string User::email() const {
    return auth_info() ? auth_info()->email() : "";
}
Пример #6
0
Wt::Auth::User User::auth_user() const {
    return tApp->session().user_database().find(auth_info());
}