mirror of
https://gitlab.kit.edu/kit/scc/sys/mail/exim-encrypt-dlfunc.git
synced 2025-12-06 09:43:55 +01:00
Convert exim variable name to uppercase.
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sodium.h>
|
||||
|
||||
bool key_contains_zero(unsigned char *key, unsigned int keylen)
|
||||
@ -48,7 +50,14 @@ dump_key_as_exim_config(FILE * f, const char *name, unsigned char *key,
|
||||
sodium_bin2base64((char *const) b64string, b64len,
|
||||
key, keylen,
|
||||
sodium_base64_VARIANT_ORIGINAL);
|
||||
fprintf(f, "%s = \"%s\"\n", name, b64string);
|
||||
// generate uppercase version of variable name
|
||||
size_t namelen = strlen(name);
|
||||
char * nameupper = malloc(namelen);
|
||||
for (unsigned int i = 0; i < namelen; i++) {
|
||||
nameupper[i] = toupper((unsigned char) name[i]);
|
||||
}
|
||||
|
||||
fprintf(f, "%s=%s\n", nameupper, b64string);
|
||||
|
||||
free(b64string);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user