From: <ton...@us...> - 2003-12-14 09:47:51
|
Update of /cvsroot/serverfilters/script In directory sc8-pr-cvs1:/tmp/cvs-serv4444 Modified Files: Makefile filtercmd.c Log Message: Use c-client library for authentication (not fully working) Index: Makefile =================================================================== RCS file: /cvsroot/serverfilters/script/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 13 Dec 2003 19:47:38 -0000 1.1 --- Makefile 13 Dec 2003 23:42:30 -0000 1.2 *************** *** 1,8 **** all: filtercmd filtercmd: filtercmd.c filtercmd.opts ! gcc -o filtercmd filtercmd.c `cat filtercmd.opts` chmod 4750 filtercmd ! chown root:apache filtercmd test: test.sh filtercmd --- 1,10 ---- + LIBS=-lc-client -lssl -lpam -L/usr/kerberos/lib/ -lgssapi_krb5 + all: filtercmd filtercmd: filtercmd.c filtercmd.opts ! gcc -o filtercmd filtercmd.c `cat filtercmd.opts` $(LIBS) chmod 4750 filtercmd ! chown root:http filtercmd test: test.sh filtercmd Index: filtercmd.c =================================================================== RCS file: /cvsroot/serverfilters/script/filtercmd.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filtercmd.c 13 Dec 2003 19:47:39 -0000 1.3 --- filtercmd.c 13 Dec 2003 23:42:30 -0000 1.4 *************** *** 15,18 **** --- 15,21 ---- #include <pwd.h> + // c-client library + #include <imap/mail.h> + void eperror(register char *); int rcexists(char *); *************** *** 226,229 **** --- 229,234 ---- } + static char *callback_user, *callback_passwd; + int checkcredentials(imapserver, user, passwd) char *imapserver; *************** *** 231,242 **** char *passwd; { /*DEBUG*/ printf("checkcredentials: imap://%s:%s@%s\n", user, passwd, imapserver); ! /*FIXME*/ ! printf("WARNING: credentials not checked\n"); ! return 1; } int parsephpstring(varname, line, dest, destlen) char *varname; --- 236,284 ---- char *passwd; { + char mailboxname[STR_MAX]; + int result, debug = 1; + MAILSTREAM *stream; + /*DEBUG*/ printf("checkcredentials: imap://%s:%s@%s\n", user, passwd, imapserver); ! /* we expect these to be accessed before this function returns */ ! callback_user = user; ! callback_passwd = passwd; ! ! snprintf(mailboxname, STR_MAX, "{%s/service=imap}", imapserver); ! ! stream = mail_open(NIL, mailboxname, debug); ! ! return stream != NIL; ! } ! ! /* we must store user and password when this is called */ ! void mm_login (NETMBX *mb,char *user,char *pwd,long trial) { ! /* we hope the buffers are big enough */ ! strcpy(user, callback_user); ! strcpy(pwd, callback_passwd); ! } ! void mm_log (char *string,long errflg) { ! /*DEBUG*/ ! printf("mm_log: %s\n", string); } + + /* c-client callbacks */ + void mm_flags (MAILSTREAM *stream,unsigned long number){} + void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status){} + void mm_searched (MAILSTREAM *stream,unsigned long number){} + void mm_exists (MAILSTREAM *stream,unsigned long number){} + void mm_expunged (MAILSTREAM *stream,unsigned long number){} + void mm_list (MAILSTREAM *stream,int delimiter,char *name,long attributes) {} + void mm_lsub (MAILSTREAM *stream,int delimiter,char *name,long attributes) {} + void mm_notify (MAILSTREAM *stream,char *string,long errflg){} + void mm_dlog (char *string){} + void mm_critical (MAILSTREAM *stream) {} + void mm_nocritical (MAILSTREAM *stream) {} + long mm_diskerror (MAILSTREAM *stream,long errcode,long serious) {} + void mm_fatal (char *string) {} + int parsephpstring(varname, line, dest, destlen) char *varname; *************** *** 338,342 **** /* Path checking code. To limit the files that this command will touch, * define RCHECK1,2,3 to be a path with a single '*', ! * e.g. "/home/ * /.procmailrc" (take spaces out) * * At least one check must pass for a given file to be touched. --- 380,384 ---- /* Path checking code. To limit the files that this command will touch, * define RCHECK1,2,3 to be a path with a single '*', ! * e.g. "/home/ * /.procmailrc" (without the spaces) * * At least one check must pass for a given file to be touched. |