From 2f6959aecaaaed4980f7c8740f2fae2c8fc326ca Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 12 Jun 2009 12:22:07 +0000 Subject: * refine cmbbs: move util_passwd.o to cmbbs/passwd.c. * note: in order to workaround the buggy/dirty synchronization hacks, changed 'passwd_query' and 'passwd_update' to passwd_sync_*. * util/* and daemon/* use directly passwd_query/update, and mbbsd should use passwd_sync_*. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4574 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- daemon/logind/Makefile | 2 +- daemon/logind/logind.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'daemon/logind') diff --git a/daemon/logind/Makefile b/daemon/logind/Makefile index 246b6c5e..7666cf95 100644 --- a/daemon/logind/Makefile +++ b/daemon/logind/Makefile @@ -4,7 +4,7 @@ SRCROOT= ../.. PROGRAMS= logind loginc UTILDIR= $(SRCROOT)/util -UTILOBJ= $(UTILDIR)/util_var.o $(UTILDIR)/util_passwd.o +UTILOBJ= $(UTILDIR)/util_var.o LDLIBS+=$(SRCROOT)/common/bbs/libcmbbs.a \ $(SRCROOT)/common/sys/libcmsys.a \ diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c index 8d7a9e16..4c30a49d 100644 --- a/daemon/logind/logind.c +++ b/daemon/logind/logind.c @@ -832,8 +832,8 @@ auth_user_challenge(login_ctx *ctx) { char *uid = ctx->userid, *passbuf = ctx->passwd; - const char *free_uid = auth_is_free_userid(uid); + userec_t user = {0}; if (free_uid) { @@ -841,18 +841,17 @@ auth_user_challenge(login_ctx *ctx) return AUTH_RESULT_FREEID; } - // reuse cuser - memset(&cuser, 0, sizeof(cuser)); - if( initcuser(uid) < 1 || !cuser.userid[0] || - !checkpasswd(cuser.passwd, passbuf) ) + if (passwd_load_user(uid, &user) < 1 || + !user.userid[0] || + !checkpasswd(user.passwd, passbuf) ) { - if (cuser.userid[0]) - strcpy(uid, cuser.userid); + if (user.userid[0]) + strcpy(uid, user.userid); return AUTH_RESULT_FAIL; } // normalize user id - strcpy(uid, cuser.userid); + strcpy(uid, user.userid); return AUTH_RESULT_OK; } -- cgit v1.2.3