}
-/* This function will return the appropriate certificate to use. The return
- * value depends on the side (client or server).
+/* This function will return the appropriate certificate to use.
+ * Fills in the apr_cert_list, apr_cert_list_length and apr_pkey.
+ * The return value is a negative value on error.
+ *
+ * It is normal to return 0 with no certificates in client side.
+ *
*/
int _gnutls_find_apr_cert(gnutls_session session,
gnutls_cert ** apr_cert_list,
int pos=0;
uint16 type;
const opaque* sdata;
-int (*ext_func_recv)( gnutls_session, const opaque*, int);
+ext_recv_func ext_recv;
uint16 size;
#ifdef DEBUG
sdata = &data[pos];
pos+=size;
- ext_func_recv = _gnutls_ext_func_recv(type);
- if (ext_func_recv == NULL) continue;
- if ( (ret=ext_func_recv( session, sdata, size)) < 0) {
+ ext_recv = _gnutls_ext_func_recv(type);
+ if (ext_recv == NULL) continue;
+ if ( (ret=ext_recv( session, sdata, size)) < 0) {
gnutls_assert();
return ret;
}
uint16 pos=0;
opaque sdata[1024];
int sdata_size = sizeof(sdata);
-int (*ext_func_send)( gnutls_session, opaque*, int);
+ext_send_func ext_send;
(*data) = gnutls_malloc(2); /* allocate size for size */
next = MAX_EXT_TYPES; /* maximum supported extensions */
do {
next--;
- ext_func_send = _gnutls_ext_func_send(next);
- if (ext_func_send == NULL) continue;
- size = ext_func_send( session, sdata, sdata_size);
+ ext_send = _gnutls_ext_func_send(next);
+ if (ext_send == NULL) continue;
+ size = ext_send( session, sdata, sdata_size);
if (size > 0) {
(*data) = gnutls_realloc_fast( (*data), pos+size+4);
if ((*data)==NULL) {
typedef struct AUTH_CRED {
gnutls_credentials_type algorithm;
- /* the type of credentials depends on algorithm */
+
+ /* the type of credentials depends on algorithm
+ */
void* credentials;
struct AUTH_CRED* next;
} AUTH_CRED;
ret = send(socket.fd, buffer, buffer_size, 0);
} while (ret == -1 && errno == EINTR);
+ if (ret > 0 && ret != buffer_size && quiet)
+ fprintf(stderr,
+ "*** Only sent %d bytes instead of %d.\n", ret, buffer_size);
return ret;
}