#include <fcntl.h>
#include <signal.h>
#include <pwd.h>
+#include <ctype.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "server.h"
#include "database.h"
#include "user_ops.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
#include "sysdep_decls.h"
#include "support.h"
#include "room_ops.h"
int getuser(struct usersupp *usbuf, char name[])
{
- char lowercase_name[32];
+ char lowercase_name[USERNAME_SIZE];
int a;
struct cdbdata *cdbus;
*/
void putuser(struct usersupp *usbuf)
{
- char lowercase_name[32];
+ char lowercase_name[USERNAME_SIZE];
int a;
for (a = 0; a <= strlen(usbuf->fullname); ++a) {
*/
void session_startup(void)
{
+ int i;
+
syslog(LOG_NOTICE, "session %d: user <%s> logged in",
CC->cs_pid, CC->curr_user);
}
lputuser(&CC->usersupp);
- /* Run any startup routines registered by loadable modules */
- PerformSessionHooks(EVT_LOGIN);
+ /*
+ * Populate CC->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->usersupp.fullname, config.c_fqdn);
+ for (i=0; i<strlen(CC->cs_inet_email); ++i) {
+ if (isspace(CC->cs_inet_email[i])) {
+ CC->cs_inet_email[i] = '_';
+ }
+ }
/* Create any personal rooms required by the system.
* (Technically, MAILROOM should be there already, but just in case...)
create_room(MAILROOM, 4, "", 0, 1, 0);
create_room(SENTITEMS, 4, "", 0, 1, 0);
+ /* Run any startup routines registered by loadable modules */
+ PerformSessionHooks(EVT_LOGIN);
+
/* Enter the lobby */
usergoto(config.c_baseroom, 0, 0, NULL, NULL);
network_talking_to(who->net_node, NTT_REMOVE);
}
- /*
- * Yes, we really need to free EVERY LAST BYTE we allocated.
- */
- if (who->cs_inet_email != NULL) {
- phree(who->cs_inet_email);
- who->cs_inet_email = NULL;
- }
-
/* Do modular stuff... */
PerformSessionHooks(EVT_LOGOUT);
}
{
char filename[64];
struct usersupp usbuf;
- char lowercase_name[32];
+ char lowercase_name[USERNAME_SIZE];
int a;
struct CitContext *ccptr;
int user_is_logged_in = 0;
/* check for mail */
mail = InitialMailCheck();
- cprintf("%d %d|%d|%d\n", CIT_OK, mail, regis, vali);
+ cprintf("%d %d|%d|%d|%s|\n", CIT_OK, mail, regis, vali, CC->cs_inet_email);
}
{
struct usersupp usbuf;
char requested_user[SIZ];
+ char notify[SIZ];
int np;
int newax;
int deleted = 0;
deleted = 1;
}
}
+
+ if (deleted) {
+ sprintf(notify, "User <%s> deleted by %s\n",
+ usbuf.fullname, CC->usersupp.fullname);
+ aide_message(notify);
+ }
+
cprintf("%d Ok", CIT_OK);
if (deleted)
cprintf(" (%s deleted)", requested_user);