diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-03-08 10:33:00 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-03-08 10:33:00 +0800 |
commit | bf85ed1d1979c65a6bb93ae965dd50282e6326a5 (patch) | |
tree | 4876079b39216faf595aa52b439b82443862c383 | |
parent | 3345b9246e647a9080038ad91c2440de864147f3 (diff) | |
download | pttbbs-bf85ed1d1979c65a6bb93ae965dd50282e6326a5.tar pttbbs-bf85ed1d1979c65a6bb93ae965dd50282e6326a5.tar.gz pttbbs-bf85ed1d1979c65a6bb93ae965dd50282e6326a5.tar.bz2 pttbbs-bf85ed1d1979c65a6bb93ae965dd50282e6326a5.tar.lz pttbbs-bf85ed1d1979c65a6bb93ae965dd50282e6326a5.tar.xz pttbbs-bf85ed1d1979c65a6bb93ae965dd50282e6326a5.tar.zst pttbbs-bf85ed1d1979c65a6bb93ae965dd50282e6326a5.zip |
remove personal ident for registration.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2580 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/pttstruct.h | 2 | ||||
-rw-r--r-- | mbbsd/admin.c | 2 | ||||
-rw-r--r-- | mbbsd/user.c | 74 | ||||
-rw-r--r-- | util/cleanident.c | 19 | ||||
-rw-r--r-- | util/indexuser.c | 6 |
5 files changed, 20 insertions, 83 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h index 5e686a8b..b08e9bbe 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -97,7 +97,7 @@ typedef struct userec_t { unsigned short chc_tie; /* 象棋戰績 和 */ int mobile; /* 手機號碼 */ char mind[4]; /* 心情 not a null-terminate string */ - char ident[11]; /* 身分證字號 / 護照 */ + char pad0[11]; unsigned char signature; /* 慣用簽名檔 */ unsigned char goodpost; /* 評價為好文章數 */ diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 41977616..ff53fd45 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -95,8 +95,6 @@ search_key_user(char *passwdfile, int mode) keymatch = user.justify; else if(strstr(user.mychicken.name, key)) keymatch = user.mychicken.name; - else if(strstr(user.ident, key)) - keymatch = user.ident; } if(keymatch) { move(1, 0); diff --git a/mbbsd/user.c b/mbbsd/user.c index b39ea63f..3200777e 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -386,11 +386,6 @@ uinfo_query(userec_t * u, int real, int unum) if (real) { getdata_buf(i++, 0, "真實姓名:", x.realname, sizeof(x.realname), DOECHO); -#ifdef FOREIGN_REG - getdata_buf(i++, 0, cuser.uflag2 & FOREIGN ? "護照號碼" : "身分證號:", x.ident, sizeof(x.ident), DOECHO); -#else - getdata_buf(i++, 0, "身分證號:", x.ident, sizeof(x.ident), DOECHO); -#endif getdata_buf(i++, 0, "居住地址:", x.address, sizeof(x.address), DOECHO); } @@ -1023,42 +1018,6 @@ removespace(char *s) return index; } -static int -ispersonalid(char *inid) -{ - char *lst = "ABCDEFGHJKLMNPQRSTUVXYWZIO", id[20]; - int i, j, cksum; - - strlcpy(id, inid, sizeof(id)); - i = cksum = 0; - if (!isalpha((int)id[0]) && (strlen(id) != 10)) - return 0; - if (!(id[1] == '1' || id[1] == '2')) - return 0; - id[0] = toupper(id[0]); - - if( strcmp(id, "A100000001") == 0 || - strcmp(id, "A200000003") == 0 || - strcmp(id, "A123456789") == 0 || - strcmp(id, "F222222222") == 0 ) - return 0; - /* A->10, B->11, ..H->17,I->34, J->18... */ - while (lst[i] != id[0]) - i++; - i += 10; - id[0] = i % 10 + '0'; - if (!isdigit((int)id[9])) - return 0; - cksum += (id[9] - '0') + (i / 10); - - for (j = 0; j < 9; ++j) { - if (!isdigit((int)id[j])) - return 0; - cksum += (id[j] - '0') * (9 - j); - } - return (cksum % 10) == 0; -} - static char * getregcode(char *buf) { @@ -1358,7 +1317,6 @@ u_register(void) } fclose(fn); } - strlcpy(ident, cuser.ident, sizeof(ident)); strlcpy(rname, cuser.realname, sizeof(rname)); strlcpy(addr, cuser.address, sizeof(addr)); strlcpy(email, cuser.email, sizeof(email)); @@ -1481,37 +1439,6 @@ u_register(void) fore[0] |= FOREIGN; else fore[0] = 0; - if (!fore[0]){ -#endif - while( 1 ){ - getfield(3, "D123456789", "身分證號", ident, sizeof(ident)); - if ('a' <= ident[0] && ident[0] <= 'z') - ident[0] -= 32; - if( ispersonalid(ident) ) - break; - vmsg("您的輸入不正確(若有問題麻煩至SYSOP板)"); - } -#ifdef FOREIGN_REG - } - else{ - int i; - while( 1 ){ - getfield(4, "0123456789","身分證號 護照號碼 或 SSN", ident, sizeof(ident)); - move(6, 2); - outs("號碼有誤者將無法取得進一步的權限!"); - getdata(7, 2, "是否確定(Y/N)", ans, 3, LCECHO); - if (ans[0] == 'y' || ans[0] == 'Y') - break; - vmsg("請重新輸入(若有問題麻煩至SYSOP板)"); - } - for(i = 0; ans[i] != 0; i++) - if ('a' <= ident[0] && ident[0] <= 'z') - ident[0] -= 32; - if( ispersonalid(ident) ){ - fore[0] = 0; - vmsg("您的身份已更改為台灣居民"); - } - } #endif while (1) { getfield(8, @@ -1595,7 +1522,6 @@ u_register(void) if (ans[0] == 'y') break; } - strlcpy(cuser.ident, ident, sizeof(cuser.ident)); strlcpy(cuser.realname, rname, sizeof(cuser.realname)); strlcpy(cuser.address, addr, sizeof(cuser.address)); strlcpy(cuser.email, email, sizeof(cuser.email)); diff --git a/util/cleanident.c b/util/cleanident.c new file mode 100644 index 00000000..0d32374c --- /dev/null +++ b/util/cleanident.c @@ -0,0 +1,19 @@ +/* $Id$ */ +#include "bbs.h" + +int main(int argc, char **argv) +{ + userec_t usr; + int fd, i; + if( argc == 1 || (fd = open(argv[1], O_RDWR)) < 0 ){ + fprintf(stderr, "usage: cleanident path_to_passwd\n"); + return 1; + } + for( i = 0 ; read(fd, &usr, sizeof(usr)) == sizeof(usr) ; ++ i ){ + memset(usr.pad0, 0, sizeof(usr.pad0)); + if( lseek(fd, i * sizeof(usr), SEEK_SET) != -1 ) + write(fd, &usr, sizeof(usr)); + } + printf("%d users cleaned\n", i); + return 0; +} diff --git a/util/indexuser.c b/util/indexuser.c index cc5ba78a..9807197b 100644 --- a/util/indexuser.c +++ b/util/indexuser.c @@ -32,7 +32,6 @@ int main(int argc, char **argv) system("rm -rf "INDEXPATH"/ident"); mkdir(INDEXPATH"/realname",0700); mkdir(INDEXPATH"/email",0700); - mkdir(INDEXPATH"/ident",0700); for(j = 1; j <= MAX_USERS; j++) { passwd_query(j, &u); if(!u.userid[0]) continue; @@ -46,11 +45,6 @@ int main(int argc, char **argv) sprintf(buf,INDEXPATH"/email/%X",string_hash(u.email)); append_record(buf, (fileheader_t*)&j, sizeof(j)); } - if(u.ident[0]) - { - sprintf(buf,INDEXPATH"/ident/%X",string_hash(u.ident)); - append_record(buf, (fileheader_t*)&j, sizeof(j)); - } } return 0; } |