1 // makeuserkey() - convert a username into the format used as a database key
3 // Copyright (c) 1987-2024 by the citadel.org team
5 // This program is open source software. Use, duplication, or disclosure
6 // is subject to the terms of the GNU General Public License, version 3.
13 #include <libcitadel.h>
19 // makeuserkey() - convert a username into the format used as a database key
20 // "key" must be a buffer of at least USERNAME_SIZE
21 // (Key format is the username with all non-alphanumeric characters removed, and converted to lower case.)
22 void makeuserkey(char *key, const char *username) {
26 if (IsEmptyStr(username)) {
31 int len = strlen(username);
32 for (i=0; ((i<=len) && (i<USERNAME_SIZE-1)); ++i) {
33 if (isalnum((username[i]))) {
34 key[keylen++] = tolower(username[i]);