From: Tom C. <tom...@us...> - 2004-06-11 04:55:59
|
Update of /cvsroot/vpopmail/vpopmail In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7421 Modified Files: Tag: stable-5_4 ChangeLog vuserinfo.c Log Message: Fix 'vuserinfo -l' output, based on Bill Shupp's patch (moved code to a single function call). [961742] Index: vuserinfo.c =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/vuserinfo.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -d -r1.4 -r1.4.2.1 --- vuserinfo.c 3 Dec 2003 16:25:01 -0000 1.4 +++ vuserinfo.c 11 Jun 2004 04:55:50 -0000 1.4.2.1 @@ -241,12 +241,36 @@ } } -void display_user(struct vqpasswd *mypw, char *domain) +void display_lastlogin (struct vqpasswd *pw, char *domain) { #ifdef ENABLE_AUTH_LOGGING time_t mytime; char *authip; + + /* There should be a new function that retrieves both + * auth time and IP in a single call (and single DB lookup) + * to reduce overhead. + */ + mytime = vget_lastauth(pw, domain); + authip = vget_lastauthip(pw,domain); + if ( mytime == 0 || authip == 0 || + strcmp(authip, NULL_REMOTE_IP) == 0 ) { + if ( mytime != 0 ) { + printf("account created: %s", asctime(localtime(&mytime))); + } + printf("last auth: Never logged in\n"); + } else { + printf("last auth: %s", asctime(localtime(&mytime))); + if ( authip != NULL ) { + printf("last auth ip: %s\n", authip); + } + } + #endif +} + +void display_user(struct vqpasswd *mypw, char *domain) +{ char maildir[MAX_BUFF]; if ( DisplayAll ) { @@ -290,24 +314,7 @@ } else { printf("usage: %s\n", mypw->pw_shell); } - -#ifdef ENABLE_AUTH_LOGGING - mytime = vget_lastauth(mypw, domain); - authip = vget_lastauthip(mypw,domain); - if ( mytime == 0 || authip == 0 || - strcmp(authip, NULL_REMOTE_IP) == 0 ) { - if ( mytime != 0 ) { - printf("account created: %s", asctime(localtime(&mytime))); - } - printf("last auth: Never logged in\n"); - } else { - printf("last auth: %s", asctime(localtime(&mytime))); - if ( authip != NULL ) { - printf("last auth ip: %s\n", authip); - } - } - -#endif + display_lastlogin (mypw, domain); } else { if ( DisplayName ) printf("%s\n", mypw->pw_name); if ( DisplayPasswd ) printf("%s\n", mypw->pw_passwd); @@ -329,11 +336,6 @@ } } -#ifdef ENABLE_AUTH_LOGGING - if ( DisplayLastAuth ) { - mytime = vget_lastauth(mypw, domain); - printf("%s\n", asctime(localtime(&mytime))); - } -#endif + if ( DisplayLastAuth ) display_lastlogin (mypw, domain); } } Index: ChangeLog =================================================================== RCS file: /cvsroot/vpopmail/vpopmail/ChangeLog,v retrieving revision 1.103.2.14 retrieving revision 1.103.2.15 diff -u -d -r1.103.2.14 -r1.103.2.15 --- ChangeLog 11 Jun 2004 04:39:52 -0000 1.103.2.14 +++ ChangeLog 11 Jun 2004 04:55:50 -0000 1.103.2.15 @@ -7,6 +7,10 @@ - Patch for vpgsql.c fixes bug with Postgres and roaming users (POP before SMTP). [895501] + Tom Collins + - Fix `vuserinfo -l` output, based on Bill Shupp's patch + (moved code to a single function call). [961742] + 5.4.4 - released 26-May-04 Tom Collins |