Renamed cutuserkey() to cutusername(). Function has nothing to do with keys.
authorArt Cancro <ajc@citadel.org>
Tue, 30 Jul 2019 13:40:51 +0000 (09:40 -0400)
committerArt Cancro <ajc@citadel.org>
Tue, 30 Jul 2019 13:40:51 +0000 (09:40 -0400)
citadel/context.c
citadel/modules/openid/serv_openid_rp.c
citadel/modules/upgrade/serv_upgrade.c
citadel/user_ops.c
citadel/user_ops.h

index f5efd5c1c5c2781db643f91e5cd27fa024c93267..8b06ab5c811b1d352edd8c30673a2c6fdff45321 100644 (file)
@@ -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;
index 269240bddb31d7013aa7ec688980285cff6e0a0a..09fd48e9bba59d4ec41c6d7ac33a5a02b8f81870 100644 (file)
@@ -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));
index 35216e126ed97ae73e685dfa04eee36de530c170..4311504a4e94346fddaaa339b8000a00978cd81d 100644 (file)
@@ -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 {
index 168639ed91da8c3a93e6d84f2668e4c04c63b589..c5eeabd2cbca8bd9fec607d7d10fc542f15af69d 100644 (file)
@@ -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)) {
index a1904d0cabbb98cd71ce4c97b50303eaa74819fb..040932c1df29d33c5b196ead00d5ab9c900cd784 100644 (file)
@@ -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);