fakepop-10/0000775000000000000000000000000011733507545007623 5ustar fakepop-10/retrieve.h0000644000000000000000000000036711733475663011632 0ustar /* $Id: retrieve.h,v 1.1.1.1 2004/11/30 19:34:52 pzn Exp $ */ #ifndef _retrieve_h #define _retrieve_h #include void retrieve_partial (int msg, FILE * out, int bodylines); #define retrieve_full(i,f) retrieve_partial(i,f,-1) #endif fakepop-10/INSTALL0000644000000000000000000000077611733475663010671 0ustar --- Instructions --- Easy way: if you use Debian, just install package "fakepop" :-) fakepop runs with inetd, xinetd or other superdaemon tools. Instructions come with inetd configuration. Please adapt to other superdaemon if you do not use inetd. (as a regular user) make (as root) make install DESTDIR=/ add the following line to /etc/inetd.conf pop-3 stream tcp nowait nobody /usr/sbin/tcpd /usr/sbin/in.fakepop remember to restart inetd configuration instructions are in /etc/fakepop/README fakepop-10/common.h0000644000000000000000000000046711733475663011276 0ustar /* $Id: common.h,v 1.1.1.1 2004/11/30 19:34:52 pzn Exp $ */ #ifndef _common_h #define _common_h #define PROGRAM_VERSION "9" #define URL "http://vztech.com.br/link.php?id=fakepop" #define MSG_MAX_LINE_SIZE 4100 #define MSGDIR "/etc/fakepop/" /* MSGDIR must end with a slash */ #define CMD_MAX_SIZE 64 #endif fakepop-10/fakepop.c0000644000000000000000000000574011733475663011425 0ustar /* $Id: fakepop.c,v 1.3 2004/12/01 17:13:02 pzn Exp $ */ #include #include #include #include #include #include "msg.h" #include "header.h" #include "id.h" #include "retrieve.h" #include "common.h" /* process a POP3 command. return 0 if command is "quit" */ int process_cmd (char * cmd) { int ret = 1; int known = 0; if ((strncasecmp ("dele", cmd, 4) == 0) || (strncasecmp ("rset", cmd, 4) == 0) || (strncasecmp ("user", cmd, 4) == 0) || (strncasecmp ("pass", cmd, 4) == 0) || (strncasecmp ("apop", cmd, 4) == 0) || (strncasecmp ("noop", cmd, 4) == 0)){ known = 1; printf("+OK\r\n"); } if (strcasecmp ("stat", cmd) == 0) { known = 1; printf("+OK %d %d\r\n", msg_gettotalmsgs(), msg_gettotalsize()); } if (strncasecmp ("list", cmd, 4) == 0) { known = 1; if (strlen(cmd) > 5) { /* single message list */ int i; i = atoi(cmd+5); if (msg_exist(i)) { printf("+OK %d %d\r\n", i, msg_getsize(i)); } else { printf("-ERR no such message\r\n"); } } else { /* all messages list */ int i, j; j = msg_gettotalmsgs(); printf("+OK\r\n"); for (i = 1; i <= j; i++) { printf("%d %d\r\n", i, msg_getsize(i)); } printf(".\r\n"); } } if (strncasecmp ("uidl", cmd, 4) == 0) { char s[71]; int i; known = 1; if (strlen(cmd) > 5) { /* single message uidl */ i = atoi(cmd+5); id_get_uidl (i, s); printf("+OK %d %s\r\n",i,s); } else { /* all messages uidl */ int j; j = msg_gettotalmsgs(); printf("+OK\r\n"); for (i = 1; i <= j; i++) { id_get_uidl (i, s); printf("%d %s\r\n",i,s); } printf(".\r\n"); } } if (strncasecmp ("retr", cmd, 4) == 0) { int i; known = 1; i = atoi(cmd+5); if (msg_exist(i)) { printf("+OK\r\n"); retrieve_full (i, stdout); printf(".\r\n"); } else { printf("-ERR no such message\r\n"); } } if (strncasecmp ("top", cmd, 3) == 0) { int i = 0, lines = 0; known = 1; sscanf(cmd+4, "%d %d", &i, &lines); if (msg_exist(i)) { printf("+OK\r\n"); retrieve_partial (i, stdout, lines); printf(".\r\n"); } else { printf("-ERR no such message\r\n"); } } if (strcasecmp ("quit", cmd) == 0) { known = 1; printf("+OK\r\n"); ret = 0; } if (! known) { printf("-ERR Unknown command: \"%s\".\r\n", cmd); } return ret; } int main (void) { char cmd[CMD_MAX_SIZE+1]; int i, j, running = 1; msg_init(); printf ("+OK fakepop V%s %s <1234.5678901234@fakepop.invalid>\r\n", PROGRAM_VERSION, URL); fflush(stdout); while ((running == 1) && (fgets(cmd, CMD_MAX_SIZE, stdin) != NULL)) { cmd[CMD_MAX_SIZE-1] = 0; j = strlen(cmd); for (i=0; i $(DESTDIR)/etc/fakepop/README # install -o root -g root -m 0644 COPYRIGHT $(DESTDIR)/usr/share/doc/fakepop/copyright install -o root -g root -m 0644 in.fakepop.8 $(DESTDIR)/usr/share/man/man8 gzip -9 $(DESTDIR)/usr/share/man/man8/in.fakepop.8 cd $(DESTDIR)/usr/share/man/man8/; ln -s in.fakepop.8.gz fakepop.8.gz tgz-aux: make install DESTDIR=`pwd`/install-tmp cd install-tmp; tar -zcvf ../install.tgz * rm -rf install-tmp tgz: all rm -rfv install.tgz install-tmp mkdir install-tmp fakeroot make tgz-aux src-tgz: distclean tar -zcvf fakepop-src.tgz `find . -type f | grep -v CVS | sort` fakepop-10/fakepop0000755000000000000000000003336311733507053011176 0ustar ELFP48$4 (444444p!p!p!pp!HHHDDPtdDDDQtd/lib/ld-linux.so.2GNUGNUT\ @[cҭ9%,  !*# (&%")$ +'$ p $'+BE|)KfUaqX;{=5 0B:T BS$! i|D lDpc$ ] libglib-2.0.so.0__gmon_start___Jv_RegisterClassesg_slist_freeg_slist_nth_datag_slist_appendlibc.so.6_IO_stdin_usedfflushreaddirsrandfopen__strdupclosedirstdingetpidstrftime__assert_failstrtolfgetsstrlenstdoutfputcfputsfclosemallocstrcasecmpasprintfopendirsscanfstrncasecmplocaltimefprintf__libc_start_mainsnprintf_fini_init_edata__bss_start_endGLIBC_2.1GLIBC_2.0bii ii \ ( &lptx|     IJȲ̲вԲزܲ !"#US[0)tX[5d%h%lh%ph%th%xh%|h %h(%h0%h8p%h@`%hHP%hP@%hX0%h` %hh%hp%hx%h%h%h%h%h%h%IJh%Ȳhp%̲h`%вhP%Բh@%زh0%ܲh %h%h%h%h%hUVS`@ \$D$D$ݛ$  $vD$@$D$tL$D$^V~1Ҁ|$?&<~29u$ơ $Lte1[^]ÍDΐ1^PTRhphQVhUS=$u?(|x9s(x(9r$[]Ít&'Utt $ÐUWVSl$D$$Ht$t D$t$$M$ft$$kD$t$$|Uue4$+ $f=~,t&$ \$$tD$9}$D$t$$up4$( $f~7|$&$|$\$|$$9}$pD$t$$H`D$t$$(t$$Xۿut$$ol[^_]Ðt&D$t$$R*D$t$$W D$t$$\D$1ۉt$$afFD$ D$$É$$#\$$pD$t&FD$ |$D$$1|$É$C\$|$$:Ut&$f1l[^_]|\$$pD$D$\D$ D$XD$FD$XD$\D$$uD$X$$f D$\D$ D$D$X$$fFD$ D$$É$t?$f $D$D$$D$$<<[^_]Ít&؋!ʁ t€u҃)0f11^D$ D$5D$֝$D$ D$[D$֝$ܝ&T$1~ 1;<É'<Ív'1T$ ~;<~ Í&8T$$Ð&1T$ ~;<~ Í&4T$$lÐ&@ÐUWVSLt&;?琍t&l$$.멍뙍v<$t&\$P<[^_][v<[^_]D$ 3D$D$($U]Ít&'UWVSO)t$1ED$E D$E$9rރ[^_]Ë$ÐUSptpfЋu[]ÐUS[H\Y[delersetuserpassapopnoop+OK stat+OK %d %d list-ERR no such message . uidl+OK %d %s retrtop%d %dquit-ERR Unknown command: "%s". 9http://vztech.com.br/link.php?id=fakepop+OK fakepop V%s %s <1234.5678901234@fakepop.invalid> header.cdate != ((void *)0)%a, %d %b %Y %H:%M:%S %zself != ((void *)0)00:16:58Mar 25 2012Message-Id: <%s@fakepop.invalid> Date: %s X-UIDL: %s X-fakepop-version: %s X-fakepop-build: %s %s X-fakepop-url: %s X-Message-Flag: message delivered by fakepop - %s header_create0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzxB0/etc/fakepop/msg.cdp != ((void *)0)readmemsgline != ((void *)0)%s%smsg_initmsg_calc_sizeretrieve.cretrieve_partial;L|H p\|Th|,<zR|  x0F J tx?;*2$"X@AA AAC CA AAF A CA AAA ((AB H AA G $,FUR A (PAC0L AG vAKC MHn(<mAA E0c AA(h,uAA E0k AA<AA AACP@ AA AAE  ,(8C U H WH8C U H W<hTPdAA AACP AA AAH C AA AAA b $ o؂܅  `ȯoorvƉ։&6FVfvƊ֊&6FVfvGCC: (Debian 4.6.3-1) 4.6.3GCC: (Debian 4.4.6-14) 4.4.6.symtab.strtab.shstrtab.interp.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rel.dyn.rel.plt.init.text.fini.rodata.eh_frame_hdr.eh_frame.ctors.dtors.jcr.dynamic.got.got.plt.data.bss.comment44#HH 1hh$HLDo؂DN V܅^orrXkȯ0z   $$ 0`` 0 |  @@ DDȞpp!xx!!!\\"``"" #D 0#99#)> 14Hh؂܅ṙ   $ `  @DȞpx\` px(5K$Z(httl,T0? 48(<4@B\ v3pp`pښ !081CS`qxPP |8K ' 6CDRf{Z"3G[D`Pg@n " 6`uBTev$ |mpcrtstuff.c__CTOR_LIST____DTOR_LIST____JCR_LIST____do_global_dtors_auxcompleted.5514dtor_idx.5516frame_dummy__CTOR_END____FRAME_END____JCR_END____do_global_ctors_auxfakepop.cheader.cdate.2921__PRETTY_FUNCTION__.2927self.2931id.crnd_base.2708id_charmsg.cmsg_filenamemsg_sizemsg_countermsg_totalsize__PRETTY_FUNCTION__.10173__PRETTY_FUNCTION__.10185retrieve.c__PRETTY_FUNCTION__.2822__init_array_end_DYNAMIC__init_array_start_GLOBAL_OFFSET_TABLE___libc_csu_fini__i686.get_pc_thunk.bxdata_startprintf@@GLIBC_2.0msg_getfilenamefflush@@GLIBC_2.0free@@GLIBC_2.0g_slist_freefgets@@GLIBC_2.0_edatafclose@@GLIBC_2.1time@@GLIBC_2.0header_size_finimsg_exist__DTOR_END__getpid@@GLIBC_2.0msg_getsizernd_initmalloc@@GLIBC_2.0__data_startheader_createputs@@GLIBC_2.0__gmon_start____dso_handle_IO_stdin_usedstrftime@@GLIBC_2.0localtime@@GLIBC_2.0srand@@GLIBC_2.0process_cmdstrlen@@GLIBC_2.0__libc_start_main@@GLIBC_2.0fprintf@@GLIBC_2.0strcasecmp@@GLIBC_2.0__libc_csu_initstdin@@GLIBC_2.0msg_gettotalmsgsfopen@@GLIBC_2.1snprintf@@GLIBC_2.0__strdup@@GLIBC_2.0_end_start_fp_hwasprintf@@GLIBC_2.0g_slist_nth_datag_slist_appendstrncasecmp@@GLIBC_2.0rand@@GLIBC_2.0stdout@@GLIBC_2.0__bss_startmainreaddir@@GLIBC_2.0fputc@@GLIBC_2.0sscanf@@GLIBC_2.0_Jv_RegisterClassesid_get_uidlstrtol@@GLIBC_2.0fputs@@GLIBC_2.0retrieve_partial_initid_get_msgidclosedir@@GLIBC_2.0msg_initopendir@@GLIBC_2.0__assert_fail@@GLIBC_2.0msg_gettotalsizefakepop-10/header.h0000644000000000000000000000026411733475663011231 0ustar /* $Id: header.h,v 1.1.1.1 2004/11/30 19:34:52 pzn Exp $ */ #ifndef _header_h #define _header_h char * header_create (int uid, int refresh_date); int header_size (void); #endif fakepop-10/id.c0000644000000000000000000000142211733475663010365 0ustar /* $Id: id.c,v 1.1.1.1 2004/11/30 19:34:52 pzn Exp $ */ #include #include #include #include #include "id.h" static char id_char[] = { "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" }; void rnd_init (int init_value) { static int rnd_base = 0; if (rnd_base == 0) { rnd_base = (getpid() << 8) + time(NULL); } srand(rnd_base + init_value); } void id_get_msgid (int n, char * msgid) { int i; rnd_init(n); for (i=0; i<20; i++) { msgid[i] = id_char[(int) (62.0*rand()/(RAND_MAX+1.0))]; } msgid[i] = 0; } void id_get_uidl (int n, char * uidl) { int i; rnd_init(n ^ 0xabcd); for (i=0; i<20; i++) { uidl[i] = id_char[(int) (62.0*rand()/(RAND_MAX+1.0))]; } uidl[i] = 0; } fakepop-10/msg.c0000644000000000000000000000623711733475663010570 0ustar /* $Id: msg.c,v 1.2 2004/11/30 21:26:37 pzn Exp $ */ #include #include #include #include #include #include #ifndef _DIRENT_HAVE_D_TYPE # error "sorry, _DIRENT_HAVE_D_TYPE is not defined..." #endif #include #include #include #include #include "header.h" #include "common.h" static GSList * msg_filename = NULL; static GSList * msg_size = NULL; static int msg_counter = 0; static int msg_totalsize = 0; /* return 1 if filename is a valid message, else 0 */ static int msg_check_name (char * filename) { if (filename[0] == '.') /* is a hidden file... not allowed */ return 0; if (filename[strlen(filename)-1] == '~') /* is a backup... not allowed */ return 0; if (strncasecmp(filename, "readme", 6) == 0) return 0; return 1; } /* return the real size of a message * included in size: fakepop added header size * "\n" -> "\r\n" end of line conversions */ static int msg_calc_size(char * msgfilename) { FILE * fh; char * filename; char * msgline; int i, j, size = 0; asprintf (&filename, "%s%s", MSGDIR, msgfilename); fh = fopen (filename,"r"); free (filename); if (fh == NULL) return 0; msgline = malloc (MSG_MAX_LINE_SIZE + 1); assert (msgline != NULL); while (fgets(msgline,MSG_MAX_LINE_SIZE,fh) != NULL) { msgline[MSG_MAX_LINE_SIZE] = 0; j = strlen(msgline); if (j < 2) j = 2; for (i = j-2; i < j; i++) { if ((msgline[i] == '\r') || (msgline[i] == '\n')) { msgline[i] = 0; break; } } size += strlen(msgline) + 2; /* 2 is strlen("\r\n") */ } fclose(fh); free (msgline); size += header_size(); return size; } /* initialize gslists, calculate total messages and sizes */ void msg_init (void) { DIR *dp; struct dirent *ep; /* free lists if msg_init called again */ if (msg_filename != NULL) { g_slist_free(msg_filename); msg_filename = NULL; } if (msg_size != NULL) { g_slist_free(msg_size); msg_size = NULL; } msg_counter = 0; msg_totalsize = 0; dp = opendir (MSGDIR); assert(dp != NULL); while ((ep = readdir (dp))) { if ((ep->d_type == DT_REG) || (ep->d_type == DT_LNK)) { if (msg_check_name(ep->d_name)) { int size; msg_counter++; size = msg_calc_size(ep->d_name); msg_size = g_slist_append(msg_size, GINT_TO_POINTER (size)); msg_filename = g_slist_append(msg_filename, strdup(ep->d_name)); msg_totalsize += size; } } } closedir (dp); } /* return if a message exist */ int msg_exist (int msg) { if ((msg < 1) || (msg > msg_counter)) { return 0; } return 1; } /* return the total number of messages */ int msg_gettotalmsgs (void) { return msg_counter; } /* return the size of a message */ int msg_getsize (int msg) { if (! msg_exist(msg)) return 0; return GPOINTER_TO_INT(g_slist_nth_data (msg_size, msg - 1)); } /* return the filename of a message */ char * msg_getfilename (int msg) { if (! msg_exist(msg)) return NULL; return g_slist_nth_data(msg_filename, msg - 1); } /* return the sum of the sizes of all messages */ int msg_gettotalsize (void) { return msg_totalsize; } fakepop-10/README.example10000644000000000000000000000034511733475663012223 0ustar From: System Administrator Subject: example message - text only Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This is a simple message. It contains only text. fakepop-10/debian/0000775000000000000000000000000011733507545011045 5ustar fakepop-10/debian/dirs0000644000000000000000000000001111733475663011724 0ustar usr/sbin fakepop-10/debian/copyright0000644000000000000000000000306211733506463012775 0ustar fakepop -- fake pop daemon. returns always the same messages to all users Author: Pedro Zorzenon Neto - email: pznAvztechDcomDbr (A=@ D=.) Copyright (C) 2004-2006 - VZTECH tecnologia em informatica ltda. This program can be downloaded from: http://vztech.com.br/link.php?id=fakepop fakepop is a fake pop3 daemon. It returns always the same messages to all users, it does not care about usernames and passwords. All user/pass combinations are accepted. The main purpose of fakepop is to advice users that your server only accepts pop3-ssl and they have wrongly configured pop3 without ssl. You can customize messages in /etc/fakepop/ directory to teach your users how they should configure their mail clients to use pop3-ssl instead of pop3. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. You can also download a copy of GNU GPL License at http://fsf.org On Debian Systems, you can find a copy of GNU GPL license at /usr/share/common-licenses/GPL fakepop-10/debian/changelog0000644000000000000000000000256111733505776012725 0ustar fakepop (11) unstable; urgency=low * Fixed a fail-to-build-from-source bug. Thanks to Stefan Potyra for reporting it. (closes: #607457) * Fixed a typo in description. Thanks to Pascal De Vuyst for reporting it. (closes: #557466) * Changed #include for compatibility with new glib version. Thanks to Michael Biebl for reporting it. (closes: #665524) * Upgraded dh_version and standards-version. -- Pedro Zorzenon Neto Sat, 24 Mar 2012 22:02:57 -0300 fakepop (10) unstable; urgency=low * fixed dependency on update-inetd * msg.c, in function 'msg_getsize', fixed compile warning -- Pedro Zorzenon Neto Sun, 29 Jul 2007 12:19:08 -0300 fakepop (9) unstable; urgency=low * fixed spelling mistake in package description. (closes: #363404) * upgraded debian standards version to 3.7.2 * bugfix - msg.c - msg_exists was being called without args -- Pedro Zorzenon Neto Wed, 15 Nov 2006 19:14:38 -0200 fakepop (8) unstable; urgency=low * Bugfix: added "\r\n" to output of POP command LIST. Thanks to Robert L Mathews (closes: #340170) -- Pedro Zorzenon Neto Mon, 21 Nov 2005 13:35:51 -0200 fakepop (7) unstable; urgency=low * Initial Release. * First package upload, closing ITP. (closes: #283751) -- Pedro Zorzenon Neto Wed, 1 Dec 2004 15:26:45 -0200 fakepop-10/debian/control0000644000000000000000000000220311733505706012440 0ustar Source: fakepop Section: mail Priority: extra Maintainer: Pedro Zorzenon Neto Build-Depends: debhelper (>= 8.0.0), libglib2.0-dev Standards-Version: 3.9.3 Package: fakepop Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, openbsd-inetd | inet-superserver Description: fake pop3 daemon. delivers same messages to all users fakepop is a fake pop3 daemon. It returns always the same messages to all users, it does not care about usernames and passwords. All user/pass combinations are accepted. . The main purpose of fakepop is to advice users that your server only accepts pop3-ssl and they have wrongly configured pop3 without ssl. You can customize messages in /etc/fakepop/ directory to teach your users how they should configure their mail clients to use pop3-ssl instead of pop3. . WARNING: some pop3-ssl daemons require a pop3 non-ssl package to be installed. That is why fakepop does not conflicts with pop3-server. courier-pop-ssl is one of these packages (it requires courier-pop). Before installing fakepop, be sure to disable other pop3 daemons. For courier, set POP3DSTART=NO in /etc/courier/pop3d fakepop-10/debian/rules0000755000000000000000000000277211733503701012121 0ustar #!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif configure: configure-stamp configure-stamp: dh_testdir touch configure-stamp build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: configure-stamp dh_testdir $(MAKE) touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp [ ! -f Makefile ] || $(MAKE) clean dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/fakepop # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs dh_installdocs dh_installexamples README.* dh_installman dh_link dh_strip dh_compress dh_makeshlibs dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure fakepop-10/debian/source/0000755000000000000000000000000011733501640012331 5ustar fakepop-10/debian/source/format0000644000000000000000000000001511733501640013540 0ustar 3.0 (native) fakepop-10/debian/compat0000644000000000000000000000000211733502306012227 0ustar 8 fakepop-10/debian/prerm0000644000000000000000000000163711733475663012127 0ustar #! /bin/sh # prerm script for fakepop # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `upgrade' # * `failed-upgrade' # * `remove' `in-favour' # * `deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in remove|upgrade|deconfigure) update-inetd --remove '^pop-3[[:blank:]]' ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 fakepop-10/debian/postinst0000644000000000000000000000201111733475663012650 0ustar #! /bin/sh # postinst script for fakepop # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # case "$1" in configure) update-inetd --group MAIL --add 'pop-3\t\tstream\ttcp\tnowait\tnobody\t/usr/sbin/tcpd\t/usr/sbin/in.fakepop' ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 fakepop-10/README.example20000644000000000000000000000140011733475663012215 0ustar System Administrator Subject: example message - with attachment Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qDbXVdCdHGoSgWSk" Content-Disposition: inline --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This is a simple message with one attached file. --qDbXVdCdHGoSgWSk Content-Type: image/png Content-Disposition: attachment; filename="green.png" Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAGFBMVEUAAAAAPwAAQAAAfwAA gAAAvwAAwAAA/wAzKRFfAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1AseEwQI9rq1 OwAAAEZJREFUKBVjYHItRwEMjGYo/HIGJlM0AUZ0LRhmECFAhqEYDiPsDnRbMPyCIYDpOQwz CLuDGlrQPceIbiimSwk7jLAKNFsALXrYId7wvhwAAAAASUVORK5CYII= --qDbXVdCdHGoSgWSk-- fakepop-10/header.c0000644000000000000000000000252111733475663011222 0ustar /* $Id: header.c,v 1.1.1.1 2004/11/30 19:34:52 pzn Exp $ */ #include #include #include #include #include #include "id.h" #include "common.h" #define HEADER_MAXSIZE 512 #define DATE_MAXSIZE 40 char * header_create (int uid, int refresh_date) { static char * date = NULL; char * self; char msg_id [32]; char uidl [32]; if (refresh_date) { if (date != NULL) free (date); date = NULL; } if (date == NULL) { struct tm * t; time_t tt; date = malloc(DATE_MAXSIZE); assert (date != NULL); time(&tt); t = localtime(&tt); strftime(date, DATE_MAXSIZE - 1, "%a, %d %b %Y %H:%M:%S %z", t); } id_get_msgid (uid, msg_id); id_get_uidl (uid, uidl); self = malloc(HEADER_MAXSIZE); assert (self != NULL); snprintf (self, HEADER_MAXSIZE - 1, "Message-Id: <%s@fakepop.invalid>\r\n" "Date: %s\r\n" "X-UIDL: %s\r\n" "X-fakepop-version: %s\r\n" "X-fakepop-build: %s %s\r\n" "X-fakepop-url: %s\r\n" "X-Message-Flag: message delivered by fakepop - %s\r\n", msg_id, date, uidl, PROGRAM_VERSION, __DATE__, __TIME__, URL, URL); return self; } int header_size (void) { static int self = -1; if (self < 0) { char * s; s = header_create (1, 0); self = strlen (s); free (s); } return self; } fakepop-10/msg.h0000644000000000000000000000042511733475663010566 0ustar /* $Id: msg.h,v 1.1.1.1 2004/11/30 19:34:52 pzn Exp $ */ #ifndef _msg_h #define _msg_h void msg_init (void); int msg_exist (int msg); int msg_gettotalmsgs (void); int msg_getsize (int msg); char * msg_getfilename (int msg); int msg_gettotalsize (void); #endif fakepop-10/README.config0000644000000000000000000000071011733475663011750 0ustar --- configuring directory /etc/fakepop/ --- Put all messages that you want fakepop to deliver in /etc/fakepop/ directory some filenames are not considered as messages: - filenames begining with '.' (hidden files) - filenames begining with 'readme' (case insensitive) - filenames ending in '~' (backup files) check message examples at README.EXAMPLE* assure that files under /etc/fakepop can be read by the user that runs fakepop (usually nobody) fakepop-10/id.h0000644000000000000000000000025611733475663010376 0ustar /* $Id: id.h,v 1.1.1.1 2004/11/30 19:34:52 pzn Exp $ */ #ifndef _id_h #define _id_h void id_get_msgid (int i, char * msgid); void id_get_uidl (int i, char * uidl); #endif fakepop-10/CHANGELOG0000644000000000000000000000005511733475663011040 0ustar You can find a changelog at debian/changelog fakepop-10/in.fakepop.80000644000000000000000000000305611733475663011755 0ustar .\" Hey, EMACS: -*- nroff -*- .TH FAKEPOP 8 "2004 Dec 01" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME fakepop \- a fake pop3 daemon .SH SYNOPSIS .B /usr/sbin/in.fakepop .SH DESCRIPTION fakepop is a fake pop3 daemon. It returns always the same messages to all users, it does not care about usernames and passwords. All user/pass combinations are accepted. .br The main purpose of fakepop is to advice users that your server only accepts pop3-ssl and they have wrongly configured pop3 without ssl. You can customize messages in /etc/fakepop/ directory to teach your users how they should configure their mail clients to use pop3-ssl instead of pop3. .br You can also use it to: advice users that the server is under maintenance; teach the users how to configure the mail client to use another new server; or any other usage you can imagine :\-) .SH OPTIONS This program discards any command line option. .SH CONFIGURATION You can put all the messages you want to deliver to the users that connect to fakepop at /etc/fakepop/ for more information see /usr/share/doc/fakepop/examples/ .SH AUTHOR fakepop was written by Pedro Zorzenon Neto . fakepop-10/retrieve.c0000644000000000000000000000255711733475663011630 0ustar /* $Id: retrieve.c,v 1.2 2004/11/30 21:26:37 pzn Exp $ */ #include #include #include #include #include "msg.h" #include "header.h" #include "retrieve.h" #include "common.h" /* retrieve a message, convert end of lines to CR+LF. convert dots at the begining of a line to two dots */ void retrieve_partial (int msg, FILE * out, int bodylines) { FILE * fh; char * filename; int i, j, linecount = 0, bodyflag = 0; char * header; char * msgline; asprintf(&filename, "%s%s", MSGDIR, msg_getfilename(msg)); fh = fopen(filename,"r"); free(filename); if (fh == NULL) return; msgline = malloc (MSG_MAX_LINE_SIZE + 1); assert (msgline != NULL); header = header_create (msg, 0); fprintf (out, "%s", header); free (header); while (fgets(msgline,MSG_MAX_LINE_SIZE,fh) != NULL) { msgline[MSG_MAX_LINE_SIZE] = 0; j = strlen(msgline); if (j < 2) j = 2; for (i = j-2; i < j; i++) { if ((msgline[i] == '\r') || (msgline[i] == '\n')) { msgline[i] = 0; break; } } if (msgline[0] == '.') { fputc('.',out); } fprintf(out,"%s\r\n",msgline); if (bodyflag) { linecount++; if (linecount == bodylines) { /* end of partial message content */ break; } } else { if (msgline[0] == 0) { bodyflag = 1; } } } fclose (fh); free (msgline); }