X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fuser_ops.c;h=168639ed91da8c3a93e6d84f2668e4c04c63b589;hp=7f6ed1c15309ba3d8f7bde5efefbc77132968480;hb=03b525bdbd5fa51c1b5a56c5fdecfdb8200cb046;hpb=80a659e06168b4cb0755c8b77cae8fb0d89c0ea6 diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 7f6ed1c15..168639ed9 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -32,6 +32,41 @@ int chkpwd_write_pipe[2]; int chkpwd_read_pipe[2]; + +/* + * Figure out what this does and make it cleaner + */ +long cutuserkey(char *username) { + long len; + len = strlen(username); + if (len >= USERNAME_SIZE) + { + syslog(LOG_INFO, "Username too long: %s", username); + len = USERNAME_SIZE - 1; + username[len]='\0'; + } + return len; +} + + +/* + * makeuserkey() - convert a username into the format used as a database key + * (it's just the username converted into lower case) + */ +void makeuserkey(char *key, const char *username, long len) { + int i; + + if (len >= USERNAME_SIZE) + { + syslog(LOG_INFO, "Username too long: %s", username); + len = USERNAME_SIZE - 1; + } + for (i=0; i<=len; ++i) { + key[i] = tolower(username[i]); + } +} + + /* * CtdlGetUser() retrieve named user into supplied buffer. * returns 0 on success