context->cs_pid = 0;
strcpy (sysname, "SYS_");
strcat (sysname, name);
- len = cutuserkey(sysname);
+ len = cutusername(sysname);
memcpy(context->curr_user, sysname, len + 1);
context->client_socket = (-1);
context->state = CON_SYS;
/*
* This is an implementation of OpenID 2.0 relying party support in stateless mode.
*
- * Copyright (c) 2007-2017 by the citadel.org team
+ * Copyright (c) 2007-2019 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
syslog(LOG_DEBUG, "openid: the desired account name is <%s>", nickname);
- len = cutuserkey(nickname);
+ len = cutusername(nickname);
if (!CtdlGetUser(&CC->user, nickname)) {
syslog(LOG_DEBUG, "openid: <%s> is already taken by another user.", nickname);
memset(&CC->user, 0, sizeof(struct ctdluser));
* guesses about what kind of data format changes need to be applied, and
* we apply them transparently.
*
- * Copyright (c) 1987-2018 by the citadel.org team
+ * Copyright (c) 1987-2019 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 3.
{
if (strncmp(usbuf.fullname, "SYS_", 4))
{ /* Delete any user 0 that doesn't start with SYS_ */
- makeuserkey(usernamekey, usbuf.fullname, cutuserkey(usbuf.fullname));
+ makeuserkey(usernamekey, usbuf.fullname, cutusername(usbuf.fullname));
cdb_delete(CDB_USERS, usernamekey, strlen(usernamekey));
}
else {
/*
- * Figure out what this does and make it cleaner
+ * Trim a string down to the maximum username size and return the new length
*/
-long cutuserkey(char *username) {
+long cutusername(char *username) {
long len;
len = strlen(username);
if (len >= USERNAME_SIZE)
{
char usernamekey[USERNAME_SIZE];
struct cdbdata *cdbus;
- long len = cutuserkey(name);
+ long len = cutusername(name);
if (usbuf != NULL) {
memset(usbuf, 0, sizeof(struct ctdluser));
{
char usernamekey[USERNAME_SIZE];
- makeuserkey(usernamekey, usbuf->fullname, cutuserkey(usbuf->fullname));
+ makeuserkey(usernamekey, usbuf->fullname, cutusername(usbuf->fullname));
usbuf->version = REV_LEVEL;
cdb_store(CDB_USERS, usernamekey, strlen(usernamekey), usbuf, sizeof(struct ctdluser));
}
char newnamekey[USERNAME_SIZE];
/* Create the database keys... */
- makeuserkey(oldnamekey, oldname, cutuserkey(oldname));
- makeuserkey(newnamekey, newname, cutuserkey(newname));
+ makeuserkey(oldnamekey, oldname, cutusername(oldname));
+ makeuserkey(newnamekey, newname, cutusername(newname));
/* Lock up and get going */
begin_critical_section(S_USERS);
struct ctdluser usbuf;
char usernamekey[USERNAME_SIZE];
- makeuserkey(usernamekey, pname, cutuserkey(pname));
+ makeuserkey(usernamekey, pname, cutusername(pname));
/* If the name is empty we can't find them in the DB any way so just return */
if (IsEmptyStr(pname)) {
int rename_user(char *oldname, char *newname);
-long cutuserkey(char *username);
+long cutusername(char *username);
void makeuserkey(char *key, const char *username, long len);
int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid);