diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-10-27 09:03:00 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-10-27 09:03:00 +0000 |
commit | c7f2c2739627057a47416f981fbed91444d4ecef (patch) | |
tree | 4e88ec6c40038c357fc9ad154a073be6ce5df442 /lib/gnutls_db.c | |
parent | de10598566b6b17b031f647941c2e4b73b049225 (diff) | |
download | gnutls-c7f2c2739627057a47416f981fbed91444d4ecef.tar.gz |
*** empty log message ***gnutls_0_2_9
Diffstat (limited to 'lib/gnutls_db.c')
-rw-r--r-- | lib/gnutls_db.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gnutls_db.c b/lib/gnutls_db.c index 1dd42e71cc..2e79ceeefd 100644 --- a/lib/gnutls_db.c +++ b/lib/gnutls_db.c @@ -142,6 +142,9 @@ time_t timestamp; } +/* The format of storing data is: + * SECURITY_PARAMETERS + AUTH_INFO_SIZE + AUTH_INFO + */ int _gnutls_server_register_current_session( GNUTLS_STATE state) { #ifdef HAVE_LIBGDBM @@ -164,13 +167,16 @@ int ret = 0; return GNUTLS_E_DB_ERROR; /* allocate space for data */ - content.dsize = sizeof(SecurityParameters) + state->gnutls_key->auth_info_size; + content.dsize = sizeof(SecurityParameters) + state->gnutls_key->auth_info_size + + sizeof(state->gnutls_key->auth_info_size); content.dptr = gnutls_malloc( content.dsize); if (content.dptr==NULL) return GNUTLS_E_MEMORY_ERROR; /* copy data */ memcpy( content.dptr, (void*)&state->security_parameters, sizeof(SecurityParameters)); - memcpy( &content.dptr[sizeof(SecurityParameters)], state->gnutls_key->auth_info, state->gnutls_key->auth_info_size); + memcpy( &content.dptr[sizeof(SecurityParameters)], &state->gnutls_key->auth_info_size, sizeof(state->gnutls_key->auth_info_size)); + memcpy( &content.dptr[sizeof(state->gnutls_key->auth_info_size)+sizeof(SecurityParameters)], + state->gnutls_key->auth_info, state->gnutls_key->auth_info_size); dbf = gdbm_open(GNUTLS_DBNAME, 0, GDBM_WRITER, 0600, NULL); if (dbf==NULL) { |