From 4370dd5a94a80d21a9bcb7d5e464d4653f021dff Mon Sep 17 00:00:00 2001 From: piaip Date: Mon, 8 Jun 2009 16:24:39 +0000 Subject: * define size of fromhost as IPV4LEN(15)+NUL. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4526 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/logind.h | 2 +- include/pttstruct.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/logind.h b/include/logind.h index aebbffea..f489f08c 100644 --- a/include/logind.h +++ b/include/logind.h @@ -17,7 +17,7 @@ typedef struct login_data // user authentication char userid[IDLEN+1]; - char hostip[32+1]; + char hostip[IPV4LEN+1]; } login_data; diff --git a/include/pttstruct.h b/include/pttstruct.h index 33f4febc..fdfbb9c3 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -5,9 +5,10 @@ #include #include "cmsys.h" // for time4_t #include "config.h" // various sizes in SHM -#include "statistic.h" // for MAX_STATS +#include "statistic.h" // for MAX_STATS -#define IDLEN 12 /* Length of bid/uid */ +#define IDLEN (12) /* Length of bid/uid */ +#define IPV4LEN (15) /* a.b.c.d form */ // GCC pragma to prevent paddings #define PACKSTRUCT __attribute__ ((packed)) @@ -80,7 +81,7 @@ typedef struct userec_t { uint32_t numposts; /* 文章篇數 */ time4_t firstlogin; /* 註冊時間 */ time4_t lastlogin; /* 最近上站時間 */ - char lasthost[16]; /* 上次上站來源 */ + char lasthost[IPV4LEN+1];/* 上次上站來源 */ int32_t money; /* Ptt幣 */ char unused[4]; char email[50]; /* Email */ -- cgit v1.2.3