示例#1
0
int nntpdriver_authenticate_user(mailsession * session)
{
    struct nntp_session_state_data * data;
    int r;

    data = session_get_data(session);

    if (data->nntp_userid == NULL)
        return MAIL_ERROR_LOGIN;

    r = newsnntp_authinfo_username(session_get_nntp_session(session),
                                   data->nntp_userid);

    switch (r) {
    case NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_PASSWORD:
        return nntpdriver_authenticate_password(session);

    default:
        return nntpdriver_nntp_error_to_mail_error(r);
    }
}
示例#2
0
static void login_run(struct etpan_thread_op * op)
{
	struct login_param * param;
	struct login_result * result;
	int r;
#ifdef DISABLE_LOG_DURING_LOGIN
	int old_debug;
#endif
	
	param = op->param;
	result = op->result;

	CHECK_NNTP();

#ifdef DISABLE_LOG_DURING_LOGIN
	old_debug = mailstream_debug;
	mailstream_debug = 0;
#endif

	r = newsnntp_authinfo_username(param->nntp, param->login);
	/* libetpan returning NO_ERROR means it received resp.code 281:
	   in this case auth. is already successful, no password is needed. */
	if (r == NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_PASSWORD) {
		r = newsnntp_authinfo_password(param->nntp, param->password);
	}
	


#ifdef DISABLE_LOG_DURING_LOGIN
	mailstream_debug = old_debug;
#endif
	
	result->error = r;
	if (param->nntp->nntp_response)
		nntp_logger(0, param->nntp->nntp_response, strlen(param->nntp->nntp_response));

	debug_print("nntp login run - end %i\n", r);
}