X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fuser_ops.c;h=370d00811f55022adf025fc9bf89b287597e41aa;hb=a9d212c452ddc4c041c6b1ca30670dde9a321a07;hp=17aa4e7710254adb8581558623971ec992be3f99;hpb=e26a8dee20d1726b4995821f717f867f50fc5659;p=citadel.git diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 17aa4e771..370d00811 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -712,40 +712,42 @@ void cmd_user(char *cmdbuf) */ void do_login(void) { - CC->logged_in = 1; - syslog(LOG_NOTICE, "<%s> logged in\n", CC->curr_user); + struct CitContext *CCC = CC; - CtdlGetUserLock(&CC->user, CC->curr_user); - ++(CC->user.timescalled); - CC->previous_login = CC->user.lastcall; - time(&CC->user.lastcall); + CCC->logged_in = 1; + syslog(LOG_NOTICE, "<%s> logged in\n", CCC->curr_user); + + CtdlGetUserLock(&CCC->user, CCC->curr_user); + ++(CCC->user.timescalled); + CCC->previous_login = CCC->user.lastcall; + time(&CCC->user.lastcall); /* If this user's name is the name of the system administrator * (as specified in setup), automatically assign access level 6. */ - if (!strcasecmp(CC->user.fullname, config.c_sysadm)) { - CC->user.axlevel = AxAideU; + if (!strcasecmp(CCC->user.fullname, config.c_sysadm)) { + CCC->user.axlevel = AxAideU; } /* If we're authenticating off the host system, automatically give * root the highest level of access. */ if (config.c_auth_mode == AUTHMODE_HOST) { - if (CC->user.uid == 0) { - CC->user.axlevel = AxAideU; + if (CCC->user.uid == 0) { + CCC->user.axlevel = AxAideU; } } - CtdlPutUserLock(&CC->user); + CtdlPutUserLock(&CCC->user); /* - * Populate CC->cs_inet_email with a default address. This will be + * Populate CCC->cs_inet_email with a default address. This will be * overwritten with the user's directory address, if one exists, when * the vCard module's login hook runs. */ - snprintf(CC->cs_inet_email, sizeof CC->cs_inet_email, "%s@%s", - CC->user.fullname, config.c_fqdn); - convert_spaces_to_underscores(CC->cs_inet_email); + snprintf(CCC->cs_inet_email, sizeof CCC->cs_inet_email, "%s@%s", + CCC->user.fullname, config.c_fqdn); + convert_spaces_to_underscores(CCC->cs_inet_email); /* Create any personal rooms required by the system. * (Technically, MAILROOM should be there already, but just in case...) @@ -801,7 +803,7 @@ void CtdlUserLogout(void) * If we were talking to a network node, we're not anymore... */ if (!IsEmptyStr(CCC->net_node)) { - network_talking_to(CCC->net_node, NTT_REMOVE); + network_talking_to(CCC->net_node, strlen(CCC->net_node), NTT_REMOVE); } /* Run any hooks registered by modules... */ @@ -1275,7 +1277,7 @@ void cmd_newu(char *cmdbuf) { int a; long len; - char username[26]; + char username[SIZ]; if (config.c_auth_mode != AUTHMODE_NATIVE) { cprintf("%d This system does not use native mode authentication.\n", @@ -1397,26 +1399,16 @@ void cmd_creu(char *cmdbuf) } extract_token(username, cmdbuf, 0, '|', sizeof username); - extract_token(password, cmdbuf, 1, '|', sizeof password); - ////username[25] = 0; - //password[31] = 0; strproc(username); strproc(password); - len = strlen(username); - if (len >= USERNAME_SIZE) - { - syslog(LOG_EMERG, "Username to long: %s", username); - cit_backtrace (); - len = USERNAME_SIZE - 1; - username[63]='\0'; - } - - len = cutuserkey(username); - if (IsEmptyStr(username)) { cprintf("%d You must supply a user name.\n", ERROR + USERNAME_REQUIRED); return; } + len = cutuserkey(username); + + + extract_token(password, cmdbuf, 1, '|', sizeof password); a = create_user(username, len, 0); @@ -1585,7 +1577,8 @@ int CtdlInvtKick(char *iuser, int op) { iuser, ((op == 1) ? "invited to" : "kicked out of"), CC->room.QRname, - CC->user.fullname); + (CC->logged_in ? CC->user.fullname : "an administrator") + ); CtdlAideMessage(bbb,"User Admin Message"); return(0); @@ -1964,7 +1957,9 @@ void cmd_asup(char *cmdbuf) if (deleted) { snprintf(notify, SIZ, "User \"%s\" has been deleted by %s.\n", - usbuf.fullname, CC->user.fullname); + usbuf.fullname, + (CC->logged_in ? CC->user.fullname : "an administrator") + ); CtdlAideMessage(notify, "User Deletion Message"); } @@ -2110,18 +2105,18 @@ CTDL_MODULE_INIT(user_ops) CtdlRegisterProtoHook(cmd_invt, "INVT", "Invite a user to a room"); CtdlRegisterProtoHook(cmd_kick, "KICK", "Kick a user out of a room"); CtdlRegisterProtoHook(cmd_forg, "FORG", "Forget a room"); - CtdlRegisterProtoHook(cmd_gnur, "GNUR", "Autoconverted. TODO: document me."); + CtdlRegisterProtoHook(cmd_gnur, "GNUR", "Get Next Unregistered User"); CtdlRegisterProtoHook(cmd_vali, "VALI", "Validate new users"); CtdlRegisterProtoHook(cmd_list, "LIST", "List users"); - CtdlRegisterProtoHook(cmd_chek, "CHEK", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_qusr, "QUSR", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_agup, "AGUP", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_asup, "ASUP", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_seen, "SEEN", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_gtsn, "GTSN", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_view, "VIEW", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_renu, "RENU", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_newu, "NEWU", "Autoconverted. TODO: document me."); + CtdlRegisterProtoHook(cmd_chek, "CHEK", "assorted info we need to check at login"); + CtdlRegisterProtoHook(cmd_qusr, "QUSR", "check to see if a user exists"); + CtdlRegisterProtoHook(cmd_agup, "AGUP", "Administratively Get User Parameters"); + CtdlRegisterProtoHook(cmd_asup, "ASUP", "Administratively Set User Parameters"); + CtdlRegisterProtoHook(cmd_seen, "SEEN", "Manipulate seen/unread message flags"); + CtdlRegisterProtoHook(cmd_gtsn, "GTSN", "Fetch seen/unread message flags"); + CtdlRegisterProtoHook(cmd_view, "VIEW", "Set preferred view for user/room combination"); + CtdlRegisterProtoHook(cmd_renu, "RENU", "Rename a user"); + CtdlRegisterProtoHook(cmd_newu, "NEWU", "Log in as a new user"); } /* return our Subversion id for the Log */ return "user_ops";