int result, size;
int indx = -1;
uint i, j;
- int try = 0, *ij_map = NULL;
+ int *ij_map = NULL;
const gnutls_certificate_credentials cred;
opaque *data = _data;
ssize_t data_size = _data_size;
return GNUTLS_E_INSUFICIENT_CREDENTIALS;
}
- if (session->internals.client_cert_callback != NULL) {
- /* if try>=0 then the client wants automatic
- * choose of certificate, otherwise (-1), he
- * will be prompted to choose one.
- */
- try =
- session->internals.client_cert_callback(session,
- NULL, 0,
- NULL, 0);
- }
-
-
- if (try >= 0) {
+ /* If we have no callback.
+ */
+ if (session->internals.client_cert_callback == NULL) {
result = 0;
if (session->security_parameters.cert_type ==
gnutls_assert();
return result;
}
- }
-
-
- /* use the callback
- */
- if (indx == -1 && session->internals.client_cert_callback != NULL && try == -1) {
+ } else /* If the callback is set, then use it. */
+ if (session->internals.client_cert_callback != NULL) {
/* use a callback to get certificate
*/
gnutls_datum *my_certs = NULL;
* @session: is a &gnutls_session structure.
* @func: is the callback function
*
- * The callback's function form is:
- * int (*callback)(gnutls_session, gnutls_datum *client_cert, int ncerts, gnutls_datum* req_ca_dn, int nreqs);
+ * The callback's function prototype is:
+ * int (*callback)(gnutls_session, const gnutls_datum *client_cert, int ncerts, const gnutls_datum* req_ca_dn, int nreqs);
*
* 'client_cert' contains 'ncerts' gnutls_datum structures which hold
* the raw certificates (DER for X.509 or binary for OpenPGP), of the
* is chosen based on the CAs sent by the server, and the requested
* public key algorithms.
*
- * If the callback function is provided then gnutls will call it
- * once with NULL parameters (except for the sesion). If the callback function returns
- * a positive or zero number then gnutls will attempt to automaticaly
- * choose the appropriate certificate. If gnutls fails to find an appropriate
- * certificate, then it will call the callback function again with the
- * appropriate parameters.
- *
- * In case the callback returned a negative number then gnutls will
- * not attempt to choose the appropriate certificate and will call again
- * the callback function with the appropriate parameters, and rely
- * only to the return value of the callback function.
+ * If the callback function is provided then gnutls will call it, in the
+ * handshake, after the certificate request message has been received.
*
* The callback function should return the index of the certificate
* choosen by the user. The index is relative to the certificates in the