*/
int CtdlGetUserLen(struct ctdluser *usbuf, const char *name, long len)
{
-
char usernamekey[USERNAME_SIZE];
struct cdbdata *cdbus;
return CtdlGetUserLen(usbuf, name, cutuserkey(name));
}
+
int CtdlLockGetCurrentUser(void)
{
CitContext *CCC = CC;
-
return CtdlGetUserLen(&CCC->user, CCC->curr_user, cutuserkey(CCC->curr_user));
}
+
/*
* CtdlGetUserLock() - same as getuser() but locks the record
*/
{
char usernamekey[USERNAME_SIZE];
- makeuserkey(usernamekey,
- usbuf->fullname,
- cutuserkey(usbuf->fullname));
-
+ makeuserkey(usernamekey, usbuf->fullname, cutuserkey(usbuf->fullname));
usbuf->version = REV_LEVEL;
- cdb_store(CDB_USERS,
- usernamekey, strlen(usernamekey),
- usbuf, sizeof(struct ctdluser));
-
+ cdb_store(CDB_USERS, usernamekey, strlen(usernamekey), usbuf, sizeof(struct ctdluser));
}
+
void CtdlPutCurrentUserLock()
{
CtdlPutUser(&CC->user);
}
-
/*
* rename_user() - this is tricky because the user's display name is the database key
*
syslog(LOG_DEBUG, "user_ops: can not rename user \"Citadel\".");
retcode = RENAMEUSER_NOT_FOUND;
} else {
- syslog(LOG_DEBUG, "user_ops: renaming <%s> to <%s>\n", oldname, newname);
+ syslog(LOG_DEBUG, "user_ops: renaming <%s> to <%s>", oldname, newname);
cdb_delete(CDB_USERS, oldnamekey, strlen(oldnamekey));
safestrncpy(usbuf.fullname, newname, sizeof usbuf.fullname);
CtdlPutUser(&usbuf);
}
-
/*
* Index-generating function used by Ctdl[Get|Set]Relationship
*/
struct ctdluser *rel_user,
struct ctdlroom *rel_room)
{
-
-
/* We don't use these in Citadel because they're implicit by the
* index, but they must be present if the database is exported.
*/
put_visit(newvisit);
}
+
/*
* Locate a relationship between a user and a room
*/
struct ctdluser *rel_user,
struct ctdlroom *rel_room)
{
-
char IndexBuf[32];
int IndexLen;
struct cdbdata *cdbvisit;
return(0);
}
+
/*
* Convenience function.
*/
{
if (CC->internal_pgm) return(0);
if (required_level >= ac_internal) {
- cprintf("%d This is not a user-level command.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
+ cprintf("%d This is not a user-level command.\n", ERROR + HIGHER_ACCESS_REQUIRED);
return(-1);
}
}
-
/*
* Is the user currently logged in an Admin?
*/
syslog(LOG_DEBUG, "user_ops: starting chkpwd daemon for host authentication mode");
if ((stat(file_chkpwd, &filestats)==-1) || (filestats.st_size==0)) {
- printf("didn't find chkpwd daemon in %s: %s\n", file_chkpwd, strerror(errno));
+ syslog(LOG_ERR, "user_ops: %s: %s", file_chkpwd, strerror(errno));
abort();
}
if (pipe(chkpwd_write_pipe) != 0) {
char buf[SIZ];
int retval;
uid_t uid = (-1);
-
safestrncpy(username, newusername, sizeof username);
strproc(username);
-
if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {