X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fuser_ops.c;h=e376c9d32d0ab4de22d6c5daf855ed74d0026926;hb=4784ca02b8038d20477d02e059e753588b3d28a7;hp=e7331e8d246f3f2ff5668202ffbde190ece92a57;hpb=0c8789fa5ddd0c5ed59468db47a681ae15440b68;p=citadel.git diff --git a/citadel/user_ops.c b/citadel/user_ops.c index e7331e8d2..e376c9d32 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -187,12 +187,17 @@ int rename_user(char *oldname, char *newname) { } else { /* Sanity checks succeeded. Now rename the user. */ - - CtdlLogPrintf(CTDL_DEBUG, "Renaming <%s> to <%s>\n", oldname, newname); - cdb_delete(CDB_USERS, oldnamekey, strlen(oldnamekey)); - safestrncpy(usbuf.fullname, newname, sizeof usbuf.fullname); - putuser(&usbuf); - retcode = RENAMEUSER_OK; + if (usbuf.usernum == 0) + { + CtdlLogPrintf (CTDL_DEBUG, "Can not rename user \"Citadel\".\n"); + retcode = RENAMEUSER_NOT_FOUND; + } else { + CtdlLogPrintf(CTDL_DEBUG, "Renaming <%s> to <%s>\n", oldname, newname); + cdb_delete(CDB_USERS, oldnamekey, strlen(oldnamekey)); + safestrncpy(usbuf.fullname, newname, sizeof usbuf.fullname); + putuser(&usbuf); + retcode = RENAMEUSER_OK; + } } } @@ -421,6 +426,12 @@ int CtdlLoginExistingUser(char *authname, char *trythisname) } if (trythisname == NULL) return login_not_found; + + if (!strcasecmp(trythisname, "Citadel")) + { + CtdlLogPrintf(CTDL_DEBUG, "System user \"Citadel\" is not allowed to log in.\n"); + return login_not_found; + } /* If a "master user" is defined, handle its authentication if specified */ CC->is_master = 0;