From bdfa2e9b6af7e32b11461433a28dd6551f830888 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 30 Jul 2019 09:40:51 -0400 Subject: [PATCH] Renamed cutuserkey() to cutusername(). Function has nothing to do with keys. --- citadel/context.c | 2 +- citadel/modules/openid/serv_openid_rp.c | 4 ++-- citadel/modules/upgrade/serv_upgrade.c | 4 ++-- citadel/user_ops.c | 14 +++++++------- citadel/user_ops.h | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/citadel/context.c b/citadel/context.c index f5efd5c1c..8b06ab5c8 100644 --- a/citadel/context.c +++ b/citadel/context.c @@ -568,7 +568,7 @@ void CtdlFillSystemContext(CitContext *context, char *name) 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; diff --git a/citadel/modules/openid/serv_openid_rp.c b/citadel/modules/openid/serv_openid_rp.c index 269240bdd..09fd48e9b 100644 --- a/citadel/modules/openid/serv_openid_rp.c +++ b/citadel/modules/openid/serv_openid_rp.c @@ -1,7 +1,7 @@ /* * 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 @@ -394,7 +394,7 @@ int openid_create_user_via_ax(StrBuf *claimed_id, HashList *sreg_keys) } 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)); diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index 35216e126..4311504a4 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -4,7 +4,7 @@ * 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. @@ -94,7 +94,7 @@ void fix_sys_user_name(void) { 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 { diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 168639ed9..c5eeabd2c 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -34,9 +34,9 @@ int chkpwd_read_pipe[2]; /* - * 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) @@ -75,7 +75,7 @@ int CtdlGetUser(struct ctdluser *usbuf, char *name) { char usernamekey[USERNAME_SIZE]; struct cdbdata *cdbus; - long len = cutuserkey(name); + long len = cutusername(name); if (usbuf != NULL) { memset(usbuf, 0, sizeof(struct ctdluser)); @@ -124,7 +124,7 @@ void CtdlPutUser(struct ctdluser *usbuf) { 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)); } @@ -160,8 +160,8 @@ int rename_user(char *oldname, char *newname) { 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); @@ -947,7 +947,7 @@ int purge_user(char pname[]) 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)) { diff --git a/citadel/user_ops.h b/citadel/user_ops.h index a1904d0ca..040932c1d 100644 --- a/citadel/user_ops.h +++ b/citadel/user_ops.h @@ -69,7 +69,7 @@ void start_chkpwd_daemon(void); 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); -- 2.30.2