-#if USE_AUTH_MSG
- Auth_Msg *m = new Auth_Msg;
- m->m_proxy = this;
- z_APDU(odr_encode(), &apdu, 0, "encode");
- char *apdu_buf = odr_getbuf(odr_encode(), &m->m_apdu_len, 0);
- m->m_apdu_buf = (char*) nmem_malloc(m->m_nmem, m->m_apdu_len);
- memcpy(m->m_apdu_buf, apdu_buf, m->m_apdu_len);
- odr_reset(odr_encode());
-
- inc_ref();
- m_my_thread->put(m);
-#else
- int ret = handle_authentication(apdu);
- result_authentication(apdu, ret);
-#endif
+ if (m_num_msg_threads && m_my_thread)
+ {
+ Auth_Msg *m = new Auth_Msg;
+ m->m_proxy = this;
+ z_APDU(odr_encode(), &apdu, 0, "encode");
+ char *apdu_buf = odr_getbuf(odr_encode(), &m->m_apdu_len, 0);
+ m->m_apdu_buf = (char*) nmem_malloc(m->m_nmem, m->m_apdu_len);
+ memcpy(m->m_apdu_buf, apdu_buf, m->m_apdu_len);
+ odr_reset(odr_encode());
+
+ inc_ref();
+ m_my_thread->put(m);
+ }
+ else
+ {
+ int ret = handle_authentication(apdu);
+ result_authentication(apdu, ret);
+ }