Paulo Roberto | 27 Jul 16:07 2002
Picon

[fetchmail] starting fetchmail from ppp.linkup on FreeBSD 4.6

Hello,

I am having some trouble trying to run fetchmail in daemon mode, being
started from /etc/ppp/ppp.linkup in FreeBSD 4.6.
At the /var/log/ppp.log I get:
ppp[56]: tun0: Command: papchap: ! sh /usr/local/bin/fetchmail -v -f
/root/.fetchmailrc >> /tmp/FETCHMAIL.LOG
But no mail is retrieved (yup, I sent myself dozens of emails to test
it) and even no output is directed to my test file.
Does fetchmail needs any special parameter to be run at ppp.linkup?

thanks

Paulo Roberto

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

Paulo Roberto | 27 Jul 16:07 2002
Picon

[fetchmail] starting fetchmail from ppp.linkup on FreeBSD 4.6

Hello,

I am having some trouble trying to run fetchmail in daemon mode, being
started from /etc/ppp/ppp.linkup in FreeBSD 4.6.
At the /var/log/ppp.log I get:
ppp[56]: tun0: Command: papchap: ! sh /usr/local/bin/fetchmail -v -f
/root/.fetchmailrc >> /tmp/FETCHMAIL.LOG
But no mail is retrieved (yup, I sent myself dozens of emails to test
it) and even no output is directed to my test file.
Does fetchmail needs any special parameter to be run at ppp.linkup?

thanks

Paulo Roberto

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

To Unsubscribe: send mail to majordomo <at> FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message

Arndt Stajta | 1 Jul 08:55 2002
Picon

[fetchmail] Re: Fetchmail-friends digest, Vol 1 #415 - 4 msgs

Hello,

Thanks to Oliver Fuchs and Bill Michell and all others.

I missunderstood the feature ESMTP AUTH, thank you for the explaination.

I have to configure my MTA 

Kind regards 

Arndt

> --__--__--
> From: "Bill Michell" <bill <at> mics.org.uk>
> To: fetchmail-friends <at> lists.ccil.org
> Date: Fri, 28 Jun 2002 16:11:21 GMT
> Subject: [fetchmail]Re: How to use SMTP AUTH
> 
> Arndt Stajta writes:
> 
> > Hello,
> > I saw that there is ESMTP AUTH in the feature list of fetchmail. 
> > 
> > I need SMTP AUTH to send my emails over my ISP, how can i do this
> > with fetchmail or is this not possible? Please with an example from the
> > fetchmailrc 
> > 
> > I get the mails by POP3 out of the mailboxes very fine. I have only a 
> > dialin connection.
> 
(Continue reading)

Sunil Shetye | 1 Jul 14:15 2002

[fetchmail] directory change

fetchmail sometimes fails in daemon mode when the rcfile is modified.
This can occur if some files mentioned in the rcfile are not absolute.

Case 1: If fetchmail is run with a relative rcfile on command line,
reexection never occurs!

$ pwd
/home/shetye
$ fetchmail -f .fetchmailrc -vv
$ touch .fetchmailrc
$ fetchmail
(does not reexecute)

Case 2: If the rcfile contains a relative logfile, say

set logfile "fetchmail.logs"

$ pwd
/home/shetye
$ fetchmail -vv
(opens "/home/shetye/fetchmail.logs")
$ touch .fetchmailrc
$ fetchmail
(tries to open "/fetchmail.logs")

Case 3: If the rcfile contains any relative file which is opened after
chdir(), it cannot not open it at all.

set idfile "testidfile"

(Continue reading)

Toto Gamez | 2 Jul 09:15 2002
Picon

[fetchmail] cant send email

hi
Im new to Linux and try to install fetchmail and installed it, my problem I successfully retrieved my email using Outlook Express but when I tried to send an email. is fetchamil also capable of doing this if yes how would i configure it to send an email.
 
Thanks,
Toto
Sunil Shetye | 2 Jul 10:09 2002

[fetchmail] Re: directory change

Quoting from Sunil Shetye's mail on Mon, Jul 01, 2002 at 05:45:41PM +0530:
> All this can be traced back to the innocuous looking chdir("/") in the
> daemonize() function. There are several possible alternatives:

Here is a solution which is different from the solutions suggested
before:

1) save the current directory.

2) parse the command line arguments. any relative file mentioned
should be expanded with respect to the current directory.

3) parse the rcfile. any relative file mentioned should be expanded
with respect to the location of the rcfile.

4) do a chdir("/").

5) when reexecing, restore to the saved directory first.

Note that "fetchmail -V" should now always show the full pathnames!

When getcwd() is not available, steps 1, 4, and 5 above are skipped.
So, reexecing will not cause any problems as chdir() is now skipped.

Please ignore the previous patches in this thread while applying this
patch.

e.g.:

If rcfile has

set logfile "tmp/fetchmail.logs"

$ echo $HOME
/home/shetye
$ pwd
/var
$ fetchmail
    (logs to "/home/shetye/tmp/fetchmail.logs")
    (previously logged to "/var/tmp/fetchmail.logs")
$ touch ~/.fetchmailrc
$ fetchmail
    (continues logging there)
    (previously logged to "/tmp/fetchmail.logs")
$ fetchmail -q
$ fetchmail -L tmp/fetchmail.logs
    (logs to "/var/tmp/fetchmail.logs")
    (previously logged to "/var/tmp/fetchmail.logs")
$ touch ~/.fetchmailrc
$ fetchmail
    (continues logging there)
    (previously logged to "/tmp/fetchmail.logs")

Sunil Shetye.
diff -Naur fetchmail-5.9.13.orig/daemon.c fetchmail-5.9.13/daemon.c
--- fetchmail-5.9.13.orig/daemon.c	Mon Apr  1 13:25:18 2002
+++ fetchmail-5.9.13/daemon.c	Tue Jul  2 12:42:04 2002
 <at>  <at>  -252,8 +252,10  <at>  <at> 
     return(PS_IOERR);
   }

+#ifdef HAVE_GETCWD
   /* move to root directory, so we don't prevent filesystem unmounts */
   chdir("/");
+#endif

   /* set our umask to something reasonable (we hope) */
 #if defined(DEF_UMASK)
diff -Naur fetchmail-5.9.13.orig/fetchmail.c fetchmail-5.9.13/fetchmail.c
--- fetchmail-5.9.13.orig/fetchmail.c	Sun Jun 23 01:33:11 2002
+++ fetchmail-5.9.13/fetchmail.c	Tue Jul  2 12:53:25 2002
 <at>  <at>  -154,10 +154,7  <at>  <at> 
     }

 #define IDFILE_NAME	".fetchids"
-    run.idfile = (char *) xmalloc(strlen(fmhome)+sizeof(IDFILE_NAME)+2);
-    strcpy(run.idfile, fmhome);
-    strcat(run.idfile, "/");
-    strcat(run.idfile, IDFILE_NAME);
+    run.idfile = prependdir (IDFILE_NAME, fmhome);

     outlevel = O_NORMAL;

 <at>  <at>  -171,6 +168,14  <at>  <at> 
      */
     lock_dispose();

+#ifdef HAVE_GETCWD
+    /* save the current directory */
+    if (getcwd (currentwd, sizeof (currentwd)) == NULL) {
+	report(stderr, GT_("could not get current working directory\n"));
+	currentwd[0] = 0;
+    }
+#endif
+
     if ((parsestatus = parsecmdline(argc,argv, &cmd_run, &cmd_opts)) < 0)
 	exit(PS_SYNTAX);

 <at>  <at>  -276,10 +281,7  <at>  <at> 

 #define	NETRC_FILE	".netrc"
     /* parse the ~/.netrc file (if present) for future password lookups. */
-    xalloca(netrc_file, char *, strlen(home) + sizeof(NETRC_FILE) + 2);
-    strcpy (netrc_file, home);
-    strcat (netrc_file, "/");
-    strcat (netrc_file, NETRC_FILE);
+    netrc_file = prependdir (NETRC_FILE, home);
     netrc_list = parse_netrc(netrc_file);
 #undef NETRC_FILE

 <at>  <at>  -541,6 +543,13  <at>  <at> 
 	else if (rcstat.st_mtime > parsetime)
 	{
 	    report(stdout, GT_("restarting fetchmail (%s changed)\n"), rcfile);
+
+#ifdef HAVE_GETCWD
+	    /* restore the startup directory */
+	    if (!currentwd[0] || chdir (currentwd) == -1)
+		report(stderr, GT_("attempt to re-exec may fail as directory has not been restored\n"));
+#endif
+
 	    /*
 	     * Matthias Andree: Isn't this prone to introduction of
 	     * "false" programs by interfering with PATH? Those
 <at>  <at>  -863,6 +872,7  <at>  <at> 
     struct passwd *pw;
     struct query def_opts, *ctl;
     struct stat rcstat;
+    char *p;

     run.bouncemail = TRUE;
     run.spambounce = FALSE;	/* don't bounce back to innocent bystanders */
 <at>  <at>  -884,6 +894,17  <at>  <at> 
     def_opts.warnings = WARNING_INTERVAL;
     def_opts.remotename = user;
     def_opts.listener = SMTP_MODE;
+
+    /* get the location of rcfile */
+    rcfiledir[0] = 0;
+    p = strrchr (rcfile, '/');
+    if (p && (p - rcfile) < sizeof (rcfiledir)) {
+	*p = 0;			/* replace '/' by '0' */
+	strcpy (rcfiledir, rcfile);
+	*p = '/';		/* restore '/' */
+	if (!rcfiledir[0])	/* "/.fetchmailrc" case */
+	    strcpy (rcfiledir, "/");
+    }

     /* note the parse time, so we can pick up on modifications */
     parsetime = 0;	/* foil compiler warnings */
diff -Naur fetchmail-5.9.13.orig/fetchmail.h fetchmail-5.9.13/fetchmail.h
--- fetchmail-5.9.13.orig/fetchmail.h	Thu Jun 27 10:59:11 2002
+++ fetchmail-5.9.13/fetchmail.h	Tue Jul  2 12:42:04 2002
 <at>  <at>  -588,8 +588,13  <at>  <at> 
 int do_otp(int sock, char *command, struct query *ctl);

 /* miscellanea */
+
+/* these should be of size PATH_MAX */
+extern char currentwd[1024], rcfiledir[1024];
+
 struct query *hostalloc(struct query *); 
 int parsecmdline (int, char **, struct runctl *, struct query *);
+char *prependdir (const char *, const char *);
 char *MD5Digest (unsigned char *);
 void hmac_md5 (unsigned char *, size_t, unsigned char *, size_t, unsigned char *, size_t);
 int POP3_auth_rpa(unsigned char *, unsigned char *, int socket);
diff -Naur fetchmail-5.9.13.orig/options.c fetchmail-5.9.13/options.c
--- fetchmail-5.9.13.orig/options.c	Sun Sep 30 20:00:51 2001
+++ fetchmail-5.9.13/options.c	Tue Jul  2 12:42:04 2002
 <at>  <at>  -313,7 +313,7  <at>  <at> 
 	    break;
 	case 'L':
 	case LA_LOGFILE:
-	    rctl->logfile = optarg;
+	    rctl->logfile = prependdir (optarg, currentwd);
 	    break;
 	case LA_INVISIBLE:
 	    rctl->invisible = TRUE;
 <at>  <at>  -323,11 +323,11  <at>  <at> 
 	    break;
 	case 'f':
 	case LA_RCFILE:
-	    rcfile = (char *) xstrdup(optarg);
+	    rcfile = prependdir (optarg, currentwd);
 	    break;
 	case 'i':
 	case LA_IDFILE:
-	    rctl->idfile = (char *) xstrdup(optarg);
+	    rctl->idfile = prependdir (optarg, currentwd);
 	    break;
 	case LA_POSTMASTER:
 	    rctl->postmaster = (char *) xstrdup(optarg);
 <at>  <at>  -538,7 +538,7  <at>  <at> 
 	    ocount++;
 	    break;
 	case LA_BSMTP:
-	    ctl->bsmtp = xstrdup(optarg);
+	    ctl->bsmtp = prependdir (optarg, currentwd);
 	    ocount++;
 	    break;
 	case LA_LMTP:
 <at>  <at>  -578,11 +578,11  <at>  <at> 
 	    break;

 	case LA_SSLKEY:
-	    ctl->sslkey = xstrdup(optarg);
+	    ctl->sslkey = prependdir (optarg, currentwd);
 	    break;

 	case LA_SSLCERT:
-	    ctl->sslcert = xstrdup(optarg);
+	    ctl->sslcert = prependdir (optarg, currentwd);
 	    break;

 	case LA_SSLPROTO:
diff -Naur fetchmail-5.9.13.orig/rcfile_y.y fetchmail-5.9.13/rcfile_y.y
--- fetchmail-5.9.13.orig/rcfile_y.y	Mon Apr  1 13:17:00 2002
+++ fetchmail-5.9.13/rcfile_y.y	Tue Jul  2 12:55:11 2002
 <at>  <at>  -47,6 +47,9  <at>  <at> 
 static void user_reset(void);
 static void reset_server(const char *name, int skip);

+/* these should be of size PATH_MAX */
+char currentwd[1024] = "", rcfiledir[1024] = "";
+
 /* using Bison, this arranges that yydebug messages will show actual tokens */
 extern char * yytext;
 #define YYPRINT(fp, type, val)	fprintf(fp, " = \"%s\"", yytext)
 <at>  <at>  -90,8 +93,8  <at>  <at> 
 optmap		: MAP | /* EMPTY */;

 /* future global options should also have the form SET <name> optmap <value> */
-statement	: SET LOGFILE optmap STRING	{run.logfile = xstrdup($4);}
-		| SET IDFILE optmap STRING	{run.idfile = xstrdup($4);}
+statement	: SET LOGFILE optmap STRING	{run.logfile = prependdir ($4, rcfiledir);}
+		| SET IDFILE optmap STRING	{run.idfile = prependdir ($4, rcfiledir);}
 		| SET DAEMON optmap NUMBER	{run.poll_interval = $4;}
 		| SET POSTMASTER optmap STRING	{run.postmaster = xstrdup($4);}
 		| SET BOUNCEMAIL		{run.bouncemail = TRUE;}
 <at>  <at>  -323,7 +326,7  <at>  <at> 
 		| SMTPNAME STRING	{current.smtpname = xstrdup($2);}
 		| SPAMRESPONSE num_list
 		| MDA STRING		{current.mda         = xstrdup($2);}
-		| BSMTP STRING		{current.bsmtp       = xstrdup($2);}
+		| BSMTP STRING		{current.bsmtp       = prependdir ($2, rcfiledir);}
 		| LMTP			{current.listener    = LMTP_MODE;}
 		| PRECONNECT STRING	{current.preconnect  = xstrdup($2);}
 		| POSTCONNECT STRING	{current.postconnect = xstrdup($2);}
 <at>  <at>  -347,8 +350,8  <at>  <at> 
 		    yyerror(GT_("SSL is not enabled"));
 #endif 
 		}
-		| SSLKEY STRING		{current.sslkey = xstrdup($2);}
-		| SSLCERT STRING	{current.sslcert = xstrdup($2);}
+		| SSLKEY STRING		{current.sslkey = prependdir ($2, rcfiledir);}
+		| SSLCERT STRING	{current.sslcert = prependdir ($2, rcfiledir);}
 		| SSLPROTO STRING	{current.sslproto = xstrdup($2);}
 		| SSLCERTCK             {current.sslcertck = FLAG_TRUE;}
 		| SSLCERTPATH STRING    {current.sslcertpath = xstrdup($2);}
 <at>  <at>  -568,6 +571,22  <at>  <at> 
 {
     (void) hostalloc(&current);
     trailer = TRUE;
+}
+
+char *prependdir (const char *file, const char *dir)
+/* if a filename is relative to dir, convert it to an absolute path */
+{
+    char *newfile;
+    if (!file[0] ||			/* null path */
+	file[0] == '/' ||		/* absolute path */
+	!dir[0])			/* we don't HAVE_GETCWD */
+	return xstrdup (file);
+    newfile = xmalloc (strlen (dir) + 1 + strlen (file) + 1);
+    if (dir[strlen(dir) - 1] != '/')
+	sprintf (newfile, "%s/%s", dir, file);
+    else
+	sprintf (newfile, "%s%s", dir, file);
+    return newfile;
 }

 /* easier to do this than cope with variations in where the library lives */
_______________________________________________
Fetchmail-friends mailing list
Fetchmail-friends <at> lists.ccil.org
http://lists.ccil.org/mailman/listinfo/fetchmail-friends
Michael Fleming | 2 Jul 11:25 2002
Picon

Re: [fetchmail] cant send email

On Tue, 2 Jul 2002 15:15:12 +0800
"Toto Gamez" <egamez <at> bonheur.com.ph> waffled thusly:

> hi 
> Im new to Linux and try to install fetchmail and installed it, my
> problem I successfully retrieved my email using Outlook Express but
> when I tried to send an email. is fetchamil also capable of doing this
> if yes how would i configure it to send an email.

Hi,

Fetchmail isn't capable of sending mail - it's a mail retrieval tool
only.
If your mail program can't talk to an SMTP server directly (or you
prefer
your mail program to call a "sendmail"-style program) you'll need to
install
a mail server program such as Sendmail, Postfix, Exim or qmail on your
Linux box.

Your Linux distribution will have one as part of the package/sources set
(Sendmail, Postfix
or Exim on most)

> Thanks,
> Toto

Michael.

--

-- 
Michael Fleming <mfleming <at> zip.com.au>

"Bother" said the Borg, "We've assimilated Pooh!"

_______________________________________________
Fetchmail-friends mailing list
Fetchmail-friends <at> lists.ccil.org
http://lists.ccil.org/mailman/listinfo/fetchmail-friends

Pellegrini Giuliano | 3 Jul 09:09 2002

[fetchmail] FectchMail and qmail/vpopmail and format.

Hi all,

 my name is Giuliano and I write from Italy.

 I writing because I have the simple questions:

 1. I use fetchmail 5.9.13 with qmail1.0.3/vpopmail5.2.1/qmailadmin1.0.2
and sqwebmail 3.3.6.

 I don't understand the relation "fecthmail <-> vpopmail", and so if I
use the /root/fetchmailrc file
 with 710 permission is right or with vpopmail is necessary another file
?

2. If I use the Maildir format, fetchmail is right or is necessary set
qmail with the Mailbox format ?

 Thanking in advance and sorry for my english.

Pellegrini Giuliano.

_______________________________________________
Fetchmail-friends mailing list
Fetchmail-friends <at> lists.ccil.org
http://lists.ccil.org/mailman/listinfo/fetchmail-friends

Andreas Hasenack | 3 Jul 19:28 2002
Picon

[fetchmail] about that fetchmail imap message count vulnerability and alloca()

I tried several small programs experiencing with alloca and it just
NEVER returned NULL, even when asked to allocate 1Gb of memory. It
just returned a pointer which was, of course, unusable on my system
at least (128Mb ram + 128Mb swap).

fetchmail's driver.c(1338):
                    if (count > INT_MAX/sizeof(int))
                    {
                        report(stderr, GT_("bogus message count!"));
                        return(PS_PROTOCOL);
                    }

                    /* OK, we're going to gather size info next */
                    xalloca(msgsizes, int *, sizeof(int) * count);
                    xalloca(msgcodes, int *, sizeof(int) * count);
                    for (i = 0; i < count; i++)
                        msgcodes[i] = MSGLEN_UNKNOWN;

xalloca is:
#define xalloca(ptr, t, n)      if (!(ptr = (t) alloca(n)))\
       {report(stderr, GT_("alloca failed")); exit(PS_UNDEFINED);}

That patch seems to only take care of count's wraparound, where less
memory would be allocated but later written to. Or?

So, at least with linux's glibc and gcc, alloca never fails. Never.

_______________________________________________
Fetchmail-friends mailing list
Fetchmail-friends <at> lists.ccil.org
http://lists.ccil.org/mailman/listinfo/fetchmail-friends

Marcelo | 4 Jul 00:35 2002
Picon

[fetchmail] Fetchmail hangs

Hi, I'm getting a problem using fetchmail with linuxconf in Red Hat 7.2. The system hangs while configuring fetchmail in linuxconf and, when I try to reboot, the system hangs in "Configuring Linuxconf hooks". So, if I disable the module fetchmail in linuxconf, the system returns to its normal operation. Did anyone had a problem like this ? Is this a problem of fetchmail ?
 
The version of fetchmail I'm using is fetchmail -5.9.0-1
 
Thanks,
Marcelo.
 

Gmane