From 373dd817c58ed05a0007efeb5b2cb871c6e93705 Mon Sep 17 00:00:00 2001 From: mwolson_admin Date: Fri, 1 Feb 2008 21:54:32 -0500 Subject: [PATCH] Move AFS vmail tokens to preauthuserdbcommon.c. --- authuserdb.c | 17 ----------------- preauthuserdbcommon.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/authuserdb.c b/authuserdb.c index 34630ce..0c719e3 100644 --- a/authuserdb.c +++ b/authuserdb.c @@ -63,8 +63,6 @@ struct callback_info *i=(struct callback_info *)p; return (*i->callback_func)(a, i->callback_arg); } -#define TOKEN_CMD "/etc/courier/get-token " - static int auth_cram(const char *service, const char *authtype, char *authdata, int (*callback_func)(struct authinfo *, void *), void *callback_arg) @@ -162,21 +160,6 @@ int rc; aa.maildir=udb->udb_mailbox; aa.options=udb->udb_options; - /* Get tokens for AFS */ - { char uidstr[32] = ""; - char *token_cmd; - if (aa.sysuserid) - { - snprintf(uidstr, sizeof(uidstr), "%ld", (long)*aa.sysuserid); - if ((token_cmd=malloc(sizeof(TOKEN_CMD)+strlen(uidstr)))) - { - strcat(strcpy(token_cmd, TOKEN_CMD),uidstr); - system(token_cmd); - free(token_cmd); - } - } - } - rc=(*callback_func)(&aa, callback_arg); free(u); diff --git a/preauthuserdbcommon.c b/preauthuserdbcommon.c index 196cfb9..a37d744 100644 --- a/preauthuserdbcommon.c +++ b/preauthuserdbcommon.c @@ -21,6 +21,8 @@ static const char rcsid[]="$Id: preauthuserdbcommon.c,v 1.21 2006/10/28 19:22:52 mrsam Exp $"; +#define TOKEN_CMD "/etc/courier/get-token " + int auth_userdb_pre_common(const char *userid, const char *service, int needpass, int (*callback)(struct authinfo *, void *), @@ -106,6 +108,21 @@ int rc; auth.maildir=udb->udb_mailbox; auth.quota=udb->udb_quota; + /* Get tokens for AFS */ + { char uidstr[32] = ""; + char *token_cmd; + if (auth.sysuserid) + { + snprintf(uidstr, sizeof(uidstr), "%ld", (long)*auth.sysuserid); + if ((token_cmd=malloc(sizeof(TOKEN_CMD)+strlen(uidstr)))) + { + strcat(strcpy(token_cmd, TOKEN_CMD),uidstr); + system(token_cmd); + free(token_cmd); + } + } + } + courier_authdebug_authinfo("DEBUG: authuserdb: ", &auth, 0, passwords); rc= (*callback)(&auth, arg); if (passwords) free(passwords); -- 2.20.1