Commits (2)
......@@ -34,7 +34,7 @@ typedef struct {
uint16_t port; /* TCP port number */
time32_t time; /* connect time */
const char* protocol; /* protocol description */
const char* user; /* user name */
char user[32]; /* user name */
uint32_t usernum; /* user number (authenticated when non-zero) */
} client_t;
......
......@@ -2267,7 +2267,7 @@ static void ctrl_thread(void* arg)
SAFECOPY(client.host,host_name);
client.port=inet_addrport(&ftp.client_addr);
client.protocol="FTP";
client.user=STR_UNKNOWN_USER;
SAFECOPY(client.user, STR_UNKNOWN_USER);
client.usernum = 0;
client_on(sock,&client,FALSE /* update */);
......@@ -2529,11 +2529,10 @@ static void ctrl_thread(void* arg)
/* Update client display */
if(user.pass[0]) {
client.user=user.alias;
SAFECOPY(client.user, user.alias);
loginSuccess(startup->login_attempt_list, &ftp.client_addr);
} else { /* anonymous */
sprintf(str,"%s <%.32s>",user.alias,password);
client.user=str;
SAFEPRINTF2(client.user, "%s <%.32s>", user.alias, password);
}
client.usernum = user.number;
client_on(sock,&client,TRUE /* update */);
......
......@@ -46,7 +46,7 @@ bool sbbs_t::logon()
if(!useron.number)
return(false);
client.user=useron.alias;
SAFECOPY(client.user, useron.alias);
client.usernum = useron.number;
client_on(client_socket,&client,TRUE /* update */);
......
......@@ -1170,7 +1170,7 @@ static void pop3_thread(void* arg)
SAFECOPY(client.addr,host_ip);
SAFECOPY(client.host,host_name);
client.port=inet_addrport(&pop3.client_addr);
client.user=STR_UNKNOWN_USER;
SAFECOPY(client.user, STR_UNKNOWN_USER);
client.usernum = 0;
client_on(socket,&client,FALSE /* update */);
......@@ -1355,7 +1355,7 @@ static void pop3_thread(void* arg)
putuserstr(&scfg, user.number, USER_IPADDR, host_ip);
/* Update client display */
client.user=user.alias;
SAFECOPY(client.user, user.alias);
client.usernum = user.number;
client_on(socket,&client,TRUE /* update */);
activity=FALSE;
......@@ -3178,7 +3178,7 @@ static void smtp_thread(void* arg)
SAFECOPY(client.addr,host_ip);
SAFECOPY(client.host,host_name);
client.port=inet_addrport(&smtp.client_addr);
client.user=STR_UNKNOWN_USER;
SAFECOPY(client.user, STR_UNKNOWN_USER);
client.usernum = 0;
client_on(socket,&client,FALSE /* update */);
......@@ -4231,7 +4231,7 @@ static void smtp_thread(void* arg)
}
/* Update client display */
client.user=relay_user.alias;
SAFECOPY(client.user, relay_user.alias);
client.usernum = relay_user.number;
client_on(socket,&client,TRUE /* update */);
......@@ -4329,7 +4329,7 @@ static void smtp_thread(void* arg)
}
/* Update client display */
client.user=relay_user.alias;
SAFECOPY(client.user, relay_user.alias);
client.usernum = relay_user.number;
client_on(socket,&client,TRUE /* update */);
......@@ -4419,7 +4419,7 @@ static void smtp_thread(void* arg)
/* Update client display */
if(relay_user.number==0) {
client.user=reverse_path;
SAFECOPY(client.user, reverse_path);
client_on(socket,&client,TRUE /* update */);
}
......
......@@ -5570,7 +5570,7 @@ NO_SSH:
SAFECOPY(client.addr,host_ip);
SAFECOPY(client.host,host_name);
client.port=inet_addrport(&client_addr);
client.user=STR_UNKNOWN_USER;
SAFECOPY(client.user, STR_UNKNOWN_USER);
client.usernum = 0;
client_on(client_socket,&client,FALSE /* update */);
......
......@@ -285,9 +285,6 @@ SMBACTIV_OBJS = $(LOAD_CFG_OBJS) \
READSAUCE_OBJS = \
$(OBJODIR)/readsauce$(OFILE)
SHOWSTAT_OBJS = \
$(OBJODIR)/showstat$(OFILE)
PKTDUMP_OBJS = $(OBJODIR)/pktdump$(OFILE)
FMSGDUMP_OBJS = $(OBJODIR)/fmsgdump$(OFILE)
......
......@@ -378,7 +378,7 @@ extern "C" int msg_client_hfields(smbmsg_t* msg, client_t* client)
if(client==NULL)
return(-1);
if(client->user!=NULL && client->usernum && (i=smb_hfield_str(msg,SENDERUSERID,client->user))!=SMB_SUCCESS)
if(client->usernum && (i=smb_hfield_str(msg,SENDERUSERID,client->user))!=SMB_SUCCESS)
return(i);
if(client->time
&& (i=smb_hfield_str(msg,SENDERTIME,xpDateTime_to_isoDateTimeStr(gmtime_to_xpDateTime(client->time)
......
......@@ -454,7 +454,7 @@ js_login(JSContext *cx, uintN argc, jsval *arglist)
,client->socket,client->service->protocol);
if(client->client!=NULL) {
client->client->user=client->user.alias;
SAFECOPY(client->client->user, client->user.alias);
client->client->usernum = client->user.number;
client_on(client->socket,client->client,TRUE /* update */);
}
......@@ -646,7 +646,7 @@ js_client_add(JSContext *cx, uintN argc, jsval *arglist)
client.size=sizeof(client);
client.protocol=service_client->service->protocol;
client.time=time32(NULL);
client.user=STR_UNKNOWN_USER;
SAFECOPY(client.user, STR_UNKNOWN_USER);
client.usernum = 0;
SAFECOPY(client.host,client.user);
......@@ -663,7 +663,7 @@ js_client_add(JSContext *cx, uintN argc, jsval *arglist)
if(argc>1) {
JSVALUE_TO_MSTRING(cx, argv[1], cstr, NULL);
HANDLE_PENDING(cx, cstr);
client.user=cstr;
SAFECOPY(client.user, cstr);
}
if(argc>2)
......@@ -702,7 +702,7 @@ js_client_update(JSContext *cx, uintN argc, jsval *arglist)
memset(&client,0,sizeof(client));
client.size=sizeof(client);
client.protocol=service_client->service->protocol;
client.user=STR_UNKNOWN_USER;
SAFECOPY(client.user, STR_UNKNOWN_USER);
SAFECOPY(client.host,client.user);
sock=js_socket(cx,argv[0]);
......@@ -717,7 +717,7 @@ js_client_update(JSContext *cx, uintN argc, jsval *arglist)
if(argc>1) {
JSVALUE_TO_MSTRING(cx, argv[1], cstr, NULL);
client.user=cstr;
SAFECOPY(client.user, cstr);
}
if(argc>2)
......@@ -1123,7 +1123,7 @@ static void js_service_thread(void* arg)
SAFECOPY(client.host,host_name);
client.port=inet_addrport(&service_client.addr);
client.protocol=service->protocol;
client.user=STR_UNKNOWN_USER;
SAFECOPY(client.user, STR_UNKNOWN_USER);
client.usernum = 0;
service_client.client=&client;
......@@ -1491,7 +1491,7 @@ static void native_service_thread(void* arg)
SAFECOPY(client.host,host_name);
client.port=inet_addrport(&service_client.addr);
client.protocol=service->protocol;
client.user=STR_UNKNOWN_USER;
SAFECOPY(client.user, STR_UNKNOWN_USER);
client.usernum = 0;
#ifdef _WIN32
......
......@@ -33,7 +33,6 @@ DELFILES = $(EXEODIR)/delfiles$(EXEFILE)
DUPEFIND = $(EXEODIR)/dupefind$(EXEFILE)
SMBACTIV = $(EXEODIR)/smbactiv$(EXEFILE)
READSAUCE = $(EXEODIR)/readsauce$(EXEFILE)
SHOWSTAT = $(EXEODIR)/showstat$(EXEFILE)
PKTDUMP = $(EXEODIR)/pktdump$(EXEFILE)
FMSGDUMP = $(EXEODIR)/fmsgdump$(EXEFILE)
UPGRADE_TO_V319 = $(EXEODIR)/upgrade_to_v319$(EXEFILE)
......
......@@ -1696,7 +1696,6 @@ int getnodeclient(scfg_t* cfg, uint number, client_t* client, time_t* done)
if(client->size == sizeof(client)) {
free((char*)client->protocol);
free((char*)client->user);
}
memset(client, 0, sizeof(*client));
client->size = sizeof(client);
......@@ -1712,8 +1711,7 @@ int getnodeclient(scfg_t* cfg, uint number, client_t* client, time_t* done)
SAFECOPY(client->host, iniReadString(fp, ROOT_SECTION, "host", "<none>", value));
if((p = iniReadString(fp, ROOT_SECTION, "prot", NULL, value)) != NULL)
client->protocol = strdup(p);
if((p = iniReadString(fp, ROOT_SECTION, "name", NULL, value)) != NULL)
client->user = strdup(p);
SAFECOPY(client->user, iniReadString(fp, ROOT_SECTION, "name", "<unknown>", value));
*done = iniReadInteger(fp, ROOT_SECTION, "done", client->time);
fclose(fp);
return sock;
......
......@@ -1624,7 +1624,7 @@ void http_logon(http_session_t * session, user_t *usr)
session->user.logontime = (time32_t)session->logon_time;
putuserdat(&scfg, &session->user);
}
session->client.user=session->username;
SAFECOPY(session->client.user, session->username);
session->client.usernum = session->user.number;
client_on(session->socket, &session->client, /* update existing client record? */TRUE);
......@@ -6640,7 +6640,7 @@ void http_session_thread(void* arg)
SAFECOPY(session.client.host, host_name);
session.client.port=inet_addrport(&session.addr);
session.client.time=time32(NULL);
session.client.user=session.username;
SAFECOPY(session.client.user, session.username);
session.client.size=sizeof(session.client);
session.client.usernum = 0;
client_on(session.socket, &session.client, /* update existing client record? */FALSE);
......