finished implementation of DirectoryServices storing/retrieving
This commit is contained in:
parent
168f43d4ec
commit
a73c8142af
@ -143,6 +143,11 @@ bool initialize()
|
|||||||
|
|
||||||
void deinitialize()
|
void deinitialize()
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for( i = 0; i < config.numDirectoryServers; ++i ) {
|
||||||
|
_gpgme_free( (char *)config.directoryServers[i].servername );
|
||||||
|
_gpgme_free( (char *)config.directoryServers[i].description );
|
||||||
|
}
|
||||||
_gpgme_free( config.directoryServers );
|
_gpgme_free( config.directoryServers );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,28 +579,56 @@ int encryptionCRLNearExpiryInterval()
|
|||||||
|
|
||||||
const char* directoryServiceConfigurationDialog(){ return 0; }
|
const char* directoryServiceConfigurationDialog(){ return 0; }
|
||||||
|
|
||||||
void appendDirectoryServer( const char* servername, int port,
|
void appendDirectoryServer( const char* servername,
|
||||||
|
int port,
|
||||||
const char* description )
|
const char* description )
|
||||||
{
|
{
|
||||||
struct DirectoryServer *servers = NULL;
|
struct DirectoryServer *newServers = NULL;
|
||||||
servers = xtryrealloc( config.directoryServers,
|
newServers = xtryrealloc( config.directoryServers,
|
||||||
(1+config.numDirectoryServers) * sizeof *servers );
|
(1+config.numDirectoryServers) * sizeof *newServers );
|
||||||
if( servers ) {
|
if( newServers ) {
|
||||||
config.directoryServers = servers;
|
config.directoryServers = newServers;
|
||||||
servers[ config.numDirectoryServers ].servername = servername;
|
newServers[ config.numDirectoryServers ].servername =
|
||||||
servers[ config.numDirectoryServers ].port = port;
|
xtrymalloc( strlen( servername ) );
|
||||||
servers[ config.numDirectoryServers ].description = description;
|
if( newServers[ config.numDirectoryServers ].servername ) {
|
||||||
|
strcpy( (char *)newServers[ config.numDirectoryServers ].servername,
|
||||||
|
servername );
|
||||||
|
newServers[ config.numDirectoryServers ].description =
|
||||||
|
xtrymalloc( strlen( description ) );
|
||||||
|
if( newServers[ config.numDirectoryServers ].description ) {
|
||||||
|
strcpy( (char *)newServers[ config.numDirectoryServers ].description,
|
||||||
|
description );
|
||||||
|
newServers[ config.numDirectoryServers ].port = port;
|
||||||
config.numDirectoryServers += 1;
|
config.numDirectoryServers += 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDirectoryServers( struct DirectoryServer server[], unsigned int size )
|
void setDirectoryServers( struct DirectoryServer server[], unsigned int size )
|
||||||
{
|
{
|
||||||
struct DirectoryServer *servers = NULL;
|
unsigned int i;
|
||||||
servers = xtrycalloc ( size, sizeof *servers );
|
int oldSize = config.numDirectoryServers;
|
||||||
if( servers ) {
|
struct DirectoryServer *newServers = NULL;
|
||||||
|
newServers = xtrycalloc ( size, sizeof *newServers );
|
||||||
|
if( newServers ) {
|
||||||
|
for( i=0; i < oldSize; ++i ) {
|
||||||
|
_gpgme_free( (char *)config.directoryServers[i].servername );
|
||||||
|
_gpgme_free( (char *)config.directoryServers[i].description );
|
||||||
|
}
|
||||||
_gpgme_free( config.directoryServers );
|
_gpgme_free( config.directoryServers );
|
||||||
config.directoryServers = servers;
|
for( i=0; i < size; ++i ) {
|
||||||
|
newServers[ i ].servername = xtrymalloc( strlen( server[i].servername ) );
|
||||||
|
if( newServers[ i ].servername ) {
|
||||||
|
strcpy( (char *)newServers[ i ].servername, server[i].servername );
|
||||||
|
newServers[ i ].description = xtrymalloc( strlen( server[i].description ) );
|
||||||
|
if( newServers[ i ].description ) {
|
||||||
|
strcpy( (char *)newServers[ i ].description, server[i].description );
|
||||||
|
newServers[ i ].port = server[i].port;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config.directoryServers = newServers;
|
||||||
config.numDirectoryServers = size;
|
config.numDirectoryServers = size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user