aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fetchmail.c92
-rw-r--r--options.c26
-rw-r--r--pop2.c36
-rw-r--r--pop3.c76
4 files changed, 115 insertions, 115 deletions
diff --git a/fetchmail.c b/fetchmail.c
index 81aafe1d..705c4643 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -43,11 +43,11 @@
#ifdef HAVE_PROTOTYPES
/* prototypes for internal functions */
-int showoptions (struct hostrec *options);
-int parseMDAargs (struct hostrec *options);
+int showoptions (struct hostrec *queryctl);
+int parseMDAargs (struct hostrec *queryctl);
int showversioninfo (void);
-int dump_options (struct hostrec *options);
-int query_host(struct hostrec *options);
+int dump_options (struct hostrec *queryctl);
+int query_host(struct hostrec *queryctl);
#endif
/* controls the detail level of status/progress messages written to stderr */
@@ -226,19 +226,19 @@ void termhook()
exit(popstatus);
}
-int query_host(options)
+int query_host(queryctl)
/* perform fetch transaction with single host */
-struct hostrec *options;
+struct hostrec *queryctl;
{
if (outlevel != O_SILENT)
- fprintf(stderr, "popclient: querying %s\n", options->servername);
- switch (options->protocol) {
+ fprintf(stderr, "popclient: querying %s\n", queryctl->servername);
+ switch (queryctl->protocol) {
case P_POP2:
- return(doPOP2(options));
+ return(doPOP2(queryctl));
break;
case P_POP3:
case P_APOP:
- return(doPOP3(options));
+ return(doPOP3(queryctl));
break;
default:
fprintf(stderr,"popclient: unsupported protocol selected.\n");
@@ -264,21 +264,21 @@ int showversioninfo()
function: dump_options
description: display program options in English
arguments:
- options merged options
+ queryctl merged options
return value: none.
calls: none.
globals: linelimit, outlimit.
*********************************************************************/
-int dump_options (options)
-struct hostrec *options;
+int dump_options (queryctl)
+struct hostrec *queryctl;
{
- printf(" Username = '%s'\n", options->remotename);
- printf(" Password = '%s'\n", options->password);
+ printf(" Username = '%s'\n", queryctl->remotename);
+ printf(" Password = '%s'\n", queryctl->password);
printf(" Protocol is ");
- switch (options->protocol)
+ switch (queryctl->protocol)
{
case P_POP2: printf("POP2\n"); break;
case P_POP3: printf("POP3\n"); break;
@@ -289,22 +289,22 @@ struct hostrec *options;
}
printf(" Fetched messages will%s be kept on the server (--keep %s).\n",
- options->keep ? "" : " not",
- options->keep ? "on" : "off");
+ queryctl->keep ? "" : " not",
+ queryctl->keep ? "on" : "off");
printf(" %s messages will be retrieved (--all %s).\n",
- options->fetchall ? "All" : "Only new",
- options->fetchall ? "on" : "off");
+ queryctl->fetchall ? "All" : "Only new",
+ queryctl->fetchall ? "on" : "off");
printf(" Old messages will%s be flushed before message retrieval (--flush %s).\n",
- options->flush ? "" : " not",
- options->flush ? "on" : "off");
+ queryctl->flush ? "" : " not",
+ queryctl->flush ? "on" : "off");
- switch(options->output)
+ switch(queryctl->output)
{
case TO_FOLDER:
- printf(" Messages will be appended to '%s'\n", options->userfolder);
+ printf(" Messages will be appended to '%s'\n", queryctl->userfolder);
break;
case TO_MDA:
- printf(" Messages will be delivered with %s\n", options->mda);
+ printf(" Messages will be delivered with %s\n", queryctl->mda);
break;
case TO_STDOUT:
printf(" Messages will be dumped to standard output\n");
@@ -313,10 +313,10 @@ struct hostrec *options;
}
if (outlevel == O_VERBOSE)
{
- if (options->output != TO_FOLDER)
- printf(" (Mail folder would have been '%s')\n", options->userfolder);
- if (options->output != TO_MDA)
- printf(" (MDA would have been '%s')\n", options->mda);
+ if (queryctl->output != TO_FOLDER)
+ printf(" (Mail folder would have been '%s')\n", queryctl->userfolder);
+ if (queryctl->output != TO_MDA)
+ printf(" (MDA would have been '%s')\n", queryctl->mda);
}
if (linelimit == 0)
@@ -332,7 +332,7 @@ struct hostrec *options;
be appended. Write-lock the folder if possible.
arguments:
- options fully-determined options (i.e. parsed, defaults invoked,
+ queryctl fully-determined options (i.e. parsed, defaults invoked,
etc).
return value: file descriptor for the open file, else -1.
@@ -340,15 +340,15 @@ struct hostrec *options;
globals: none.
*********************************************************************/
-int openuserfolder (options)
-struct hostrec *options;
+int openuserfolder (queryctl)
+struct hostrec *queryctl;
{
int fd;
- if (options->output == TO_STDOUT)
+ if (queryctl->output == TO_STDOUT)
return(1);
- else /* options->output == TO_FOLDER */
- if ((fd = open(options->userfolder,O_CREAT|O_WRONLY|O_APPEND,0600)) >= 0) {
+ else /* queryctl->output == TO_FOLDER */
+ if ((fd = open(queryctl->userfolder,O_CREAT|O_WRONLY|O_APPEND,0600)) >= 0) {
#ifdef HAVE_FLOCK
if (flock(fd, LOCK_EX) == -1)
{
@@ -371,7 +371,7 @@ struct hostrec *options;
function: openmailpipe
description: open a one-way pipe to the mail delivery agent.
arguments:
- options fully-determined options (i.e. parsed, defaults invoked,
+ queryctl fully-determined options (i.e. parsed, defaults invoked,
etc).
return value: open file descriptor for the pipe or -1.
@@ -379,8 +379,8 @@ struct hostrec *options;
globals: reads mda_argv.
*********************************************************************/
-int openmailpipe (options)
-struct hostrec *options;
+int openmailpipe (queryctl)
+struct hostrec *queryctl;
{
int pipefd [2];
int childpid;
@@ -404,7 +404,7 @@ struct hostrec *options;
exit(1);
}
- execv(options->mda,mda_argv);
+ execv(queryctl->mda,mda_argv);
/* if we got here, an error occurred */
perror("popclient: openmailpipe: exec");
@@ -453,7 +453,7 @@ int fd;
function: closemailpipe
description: close pipe to the mail delivery agent.
arguments:
- options fully-determined options record
+ queryctl fully-determined options record
fd pipe descriptor.
return value: 0 if success, else -1.
@@ -486,24 +486,24 @@ int fd;
description: parse the argument string given in agent option into
a regular *argv[] array.
arguments:
- options fully-determined options record pointer.
+ queryctl fully-determined options record pointer.
return value: none.
calls: none.
globals: writes mda_argv.
*********************************************************************/
-int parseMDAargs (options)
-struct hostrec *options;
+int parseMDAargs (queryctl)
+struct hostrec *queryctl;
{
int argi;
char *argp;
/* first put the last segment of the MDA pathname in argv[0] */
- argp = strrchr(options->mda, '/');
- mda_argv[0] = argp ? (argp + 1) : options->mda;
+ argp = strrchr(queryctl->mda, '/');
+ mda_argv[0] = argp ? (argp + 1) : queryctl->mda;
- argp = options->mda;
+ argp = queryctl->mda;
while (*argp != '\0' && isspace(*argp)) /* skip null first arg */
argp++;
diff --git a/options.c b/options.c
index 7ae374d8..4e782ba8 100644
--- a/options.c
+++ b/options.c
@@ -74,7 +74,7 @@ static struct option longoptions[] = {
arguments:
argc argument count.
argv argument strings.
- options pointer to a struct hostrec to receive the parsed
+ queryctl pointer to a struct hostrec to receive the parsed
options.
return value: if positive, argv index of last parsed option + 1
@@ -276,39 +276,39 @@ struct hostrec *options;
globals: writes outlevel, poprcfile.
*********************************************************************/
-int setdefaults (options)
-struct hostrec *options;
+int setdefaults (queryctl)
+struct hostrec *queryctl;
{
int uid;
struct passwd *pw;
char *mailvar;
- bzero(options,sizeof(*options));
+ bzero(queryctl,sizeof(*queryctl));
if ((pw = getpwuid(uid = getuid())) == NULL) {
fprintf(stderr,"No passwd entry for uid %d\n",uid);
return(-1);
}
- options->protocol = DEF_PROTOCOL;
+ queryctl->protocol = DEF_PROTOCOL;
#if defined(KEEP_IS_DEFAULT)
- options->keep = 1;
+ queryctl->keep = 1;
#else
- options->keep = 0;
+ queryctl->keep = 0;
#endif
- strcpy(options->localname,pw->pw_name);
- strcpy(options->remotename,pw->pw_name);
+ strcpy(queryctl->localname,pw->pw_name);
+ strcpy(queryctl->remotename,pw->pw_name);
#if defined(USERFOLDER) && defined(HAVE_FLOCK)
- options->output = TO_FOLDER;
- sprintf(options->userfolder, USERFOLDER, pw->pw_name);
+ queryctl->output = TO_FOLDER;
+ sprintf(queryctl->userfolder, USERFOLDER, pw->pw_name);
#else
- options->output = TO_MDA;
+ queryctl->output = TO_MDA;
#endif
- (void) sprintf(options->mda, DEF_MDA, options->localname);
+ (void) sprintf(queryctl->mda, DEF_MDA, queryctl->localname);
poprcfile =
(char *) xmalloc(strlen(pw->pw_dir)+strlen(POPRC_NAME)+2);
diff --git a/pop2.c b/pop2.c
index 28056b13..affe8496 100644
--- a/pop2.c
+++ b/pop2.c
@@ -51,7 +51,7 @@ int POP2_stateXFER (int msgsize, int socket, int mboxfd, int topipe);
using Post Office Protocol 2.
arguments:
- options fully-specified options (i.e. parsed, defaults invoked,
+ queryctl fully-specified options (i.e. parsed, defaults invoked,
etc).
return value: exit code from the set of PS_.* constants defined in
@@ -63,8 +63,8 @@ int POP2_stateXFER (int msgsize, int socket, int mboxfd, int topipe);
globals: reads outlevel.
*********************************************************************/
-int doPOP2 (options)
-struct hostrec *options;
+int doPOP2 (queryctl)
+struct hostrec *queryctl;
{
int mboxfd;
int socket;
@@ -76,11 +76,11 @@ struct hostrec *options;
fprintf(stderr,"Option --limit is not supported in POP2\n");
return(PS_SYNTAX);
}
- else if (options->flush) {
+ else if (queryctl->flush) {
fprintf(stderr,"Option --flush is not supported in POP2\n");
return(PS_SYNTAX);
}
- else if (options->fetchall) {
+ else if (queryctl->fetchall) {
fprintf(stderr,"Option --all is not supported in POP2\n");
return(PS_SYNTAX);
}
@@ -88,14 +88,14 @@ struct hostrec *options;
;
/* open the socket to the POP server */
- if ((socket = Socket(options->servername,POP2_PORT)) < 0) {
+ if ((socket = Socket(queryctl->servername,POP2_PORT)) < 0) {
perror("doPOP2: socket");
return(PS_SOCKET);
}
/* open/lock the folder if it is a user folder or stdout */
- if (options->output == TO_FOLDER)
- if ((mboxfd = openuserfolder(options)) < 0)
+ if (queryctl->output == TO_FOLDER)
+ if ((mboxfd = openuserfolder(queryctl)) < 0)
return(PS_IOERR);
/* wait for the POP2 greeting */
@@ -106,7 +106,7 @@ struct hostrec *options;
}
/* log the user onto the server */
- POP2_sendHELO(options->remotename,options->password,socket);
+ POP2_sendHELO(queryctl->remotename,queryctl->password,socket);
if ((number = POP2_stateNMBR(socket)) < 0) {
POP2_quit(socket);
status = PS_AUTHFAIL;
@@ -114,8 +114,8 @@ struct hostrec *options;
}
/* set the remote folder if selected */
- if (*options->remotefolder != 0) {
- POP2_sendFOLD(options->remotefolder,socket);
+ if (*queryctl->remotefolder != 0) {
+ POP2_sendFOLD(queryctl->remotefolder,socket);
if ((number = POP2_stateNMBR(socket)) < 0) {
POP2_quit(socket);
status = PS_PROTOCOL;
@@ -125,7 +125,7 @@ struct hostrec *options;
/* tell 'em how many messages are waiting */
if (outlevel > O_SILENT && outlevel < O_VERBOSE)
- fprintf(stderr,"%d messages in folder %s\n",number,options->remotefolder);
+ fprintf(stderr,"%d messages in folder %s\n",number,queryctl->remotefolder);
else
;
@@ -137,17 +137,17 @@ struct hostrec *options;
while (msgsize > 0) {
/* open the pipe */
- if (options->output == TO_MDA)
- if ((mboxfd = openmailpipe(options)) < 0) {
+ if (queryctl->output == TO_MDA)
+ if ((mboxfd = openmailpipe(queryctl)) < 0) {
POP2_quit(socket);
return(PS_IOERR);
}
POP2_sendcmd("RETR",socket);
actsize = POP2_stateXFER(msgsize,socket,mboxfd,
- options->output == TO_MDA);
+ queryctl->output == TO_MDA);
if (actsize == msgsize)
- if (options->keep)
+ if (queryctl->keep)
POP2_sendcmd("ACKS",socket);
else
POP2_sendcmd("ACKD",socket);
@@ -160,7 +160,7 @@ struct hostrec *options;
}
/* close the pipe */
- if (options->output == TO_MDA)
+ if (queryctl->output == TO_MDA)
if (closemailpipe(mboxfd) < 0) {
POP2_quit(socket);
status = PS_IOERR;
@@ -178,7 +178,7 @@ struct hostrec *options;
}
closeUp:
- if (options->output == TO_FOLDER)
+ if (queryctl->output == TO_FOLDER)
closeuserfolder(mboxfd);
return(status);
diff --git a/pop3.c b/pop3.c
index 53ccd955..fab11a2b 100644
--- a/pop3.c
+++ b/pop3.c
@@ -51,7 +51,7 @@ int POP3_BuildDigest (char *buf, struct hostrec *options);
using Post Office Protocol 3.
arguments:
- options fully-specified options (i.e. parsed, defaults invoked,
+ queryctl fully-specified options (i.e. parsed, defaults invoked,
etc).
return value: exit code from the set of PS_.* constants defined in
@@ -60,8 +60,8 @@ int POP3_BuildDigest (char *buf, struct hostrec *options);
globals: reads outlevel.
*********************************************************************/
-int doPOP3 (options)
-struct hostrec *options;
+int doPOP3 (queryctl)
+struct hostrec *queryctl;
{
int ok;
int mboxfd;
@@ -71,12 +71,12 @@ struct hostrec *options;
/* open/lock the folder if we're using a mailbox */
- if (options->output == TO_FOLDER)
- if ((mboxfd = openuserfolder(options)) < 0)
+ if (queryctl->output == TO_FOLDER)
+ if ((mboxfd = openuserfolder(queryctl)) < 0)
return(PS_IOERR);
/* open the socket and get the greeting */
- if ((socket = Socket(options->servername,POP3_PORT)) < 0) {
+ if ((socket = Socket(queryctl->servername,POP3_PORT)) < 0) {
perror("doPOP3: socket");
ok = PS_SOCKET;
goto closeUp;
@@ -98,8 +98,8 @@ struct hostrec *options;
#if defined(HAVE_APOP_SUPPORT)
/* build MD5 digest from greeting timestamp + password */
- if (options->whichpop == P_APOP)
- if (POP3_BuildDigest(buf,options) != 0) {
+ if (queryctl->whichpop == P_APOP)
+ if (POP3_BuildDigest(buf,queryctl) != 0) {
ok = PS_AUTHFAIL;
goto closeUp;
} else
@@ -109,7 +109,7 @@ struct hostrec *options;
#endif
/* try to get authorized */
- ok = POP3_auth(options,socket);
+ ok = POP3_auth(queryctl,socket);
if (ok == PS_ERROR)
ok = PS_AUTHFAIL;
if (ok != 0)
@@ -122,7 +122,7 @@ struct hostrec *options;
}
/* Ask for number of last message retrieved */
- if (options->fetchall)
+ if (queryctl->fetchall)
first = 1;
else {
ok = POP3_sendLAST(&first, socket);
@@ -143,19 +143,19 @@ struct hostrec *options;
;
if (count > 0) {
- for (number = (options->flush || options->fetchall)? 1 : first;
+ for (number = (queryctl->flush || queryctl->fetchall)? 1 : first;
number <= count;
number++) {
/* open the mail pipe if we're using an MDA */
- if (options->output == TO_MDA
- && (options->fetchall || number >= first)) {
- ok = (mboxfd = openmailpipe(options)) < 0 ? -1 : 0;
+ if (queryctl->output == TO_MDA
+ && (queryctl->fetchall || number >= first)) {
+ ok = (mboxfd = openmailpipe(queryctl)) < 0 ? -1 : 0;
if (ok != 0)
goto cleanUp;
}
- if (options->flush && number < first && !options->fetchall)
+ if (queryctl->flush && number < first && !queryctl->fetchall)
ok = 0; /* no command to send here, will delete message below */
else if (linelimit)
ok = POP3_sendTOP(number,linelimit,socket);
@@ -164,14 +164,14 @@ struct hostrec *options;
if (ok != 0)
goto cleanUp;
- if (number >= first || options->fetchall)
- ok = POP3_readmsg(socket,mboxfd,options->servername,options->output == TO_MDA);
+ if (number >= first || queryctl->fetchall)
+ ok = POP3_readmsg(socket,mboxfd,queryctl->servername,queryctl->output == TO_MDA);
else
ok = 0;
if (ok != 0)
goto cleanUp;
- if ((number < first && options->flush) || !options->keep) {
+ if ((number < first && queryctl->flush) || !queryctl->keep) {
if (outlevel > O_SILENT && outlevel < O_VERBOSE)
fprintf(stderr,"flushing message %d\n", number);
else
@@ -184,8 +184,8 @@ struct hostrec *options;
; /* message is kept */
/* close the mail pipe if we're using the system mailbox */
- if (options->output == TO_MDA
- && (options->fetchall || number >= first)) {
+ if (queryctl->output == TO_MDA
+ && (queryctl->fetchall || number >= first)) {
ok = closemailpipe(mboxfd);
if (ok != 0)
goto cleanUp;
@@ -211,7 +211,7 @@ cleanUp:
POP3_sendQUIT(socket);
closeUp:
- if (options->output == TO_FOLDER)
+ if (queryctl->output == TO_FOLDER)
if (closeuserfolder(mboxfd) < 0 && ok == 0)
ok = PS_IOERR;
@@ -281,7 +281,7 @@ int socket;
description: send the USER and PASS commands to the server, and
get the server's response.
arguments:
- options merged options record.
+ queryctl merged options record.
socket socket to which the server is connected.
return value: zero if success, else status code.
@@ -289,21 +289,21 @@ int socket;
globals: read outlevel.
*********************************************************************/
-int POP3_auth (options,socket)
-struct hostrec *options;
+int POP3_auth (queryctl,socket)
+struct hostrec *queryctl;
int socket;
{
char buf [POPBUFSIZE];
- switch (options->protocol) {
+ switch (queryctl->protocol) {
case P_POP3:
- SockPrintf(socket,"USER %s\r\n",options->remotename);
+ SockPrintf(socket,"USER %s\r\n",queryctl->remotename);
if (outlevel == O_VERBOSE)
- fprintf(stderr,"> USER %s\n",options->remotename);
+ fprintf(stderr,"> USER %s\n",queryctl->remotename);
if (POP3_OK(buf,socket) != 0)
goto badAuth;
- SockPrintf(socket,"PASS %s\r\n",options->password);
+ SockPrintf(socket,"PASS %s\r\n",queryctl->password);
if (outlevel == O_VERBOSE)
fprintf(stderr,"> PASS password\n");
if (POP3_OK(buf,socket) != 0)
@@ -314,9 +314,9 @@ int socket;
#if defined(HAVE_APOP_SUPPORT)
case P_APOP:
SockPrintf(socket,"APOP %s %s\r\n",
- options->remotename, options->digest);
+ queryctl->remotename, queryctl->digest);
if (outlevel == O_VERBOSE)
- fprintf(stderr,"> APOP %s %s\n",options->remotename, options->digest);
+ fprintf(stderr,"> APOP %s %s\n",queryctl->remotename, queryctl->digest);
if (POP3_OK(buf,socket) != 0)
goto badAuth;
break;
@@ -324,11 +324,11 @@ int socket;
#if defined(HAVE_RPOP_SUPPORT)
case P_RPOP:
- SockPrintf(socket, "RPOP %s\r\n", options->remotename);
+ SockPrintf(socket, "RPOP %s\r\n", queryctl->remotename);
if (POP3_OK(buf,socket) != 0)
goto badAuth;
if (outlevel == O_VERBOSE)
- fprintf(stderr,"> RPOP %s %s\n",options->remotename);
+ fprintf(stderr,"> RPOP %s %s\n",queryctl->remotename);
break;
#endif /* HAVE_RPOP_SUPPORT */
@@ -702,7 +702,7 @@ int socket;
stamp in the POP3 greeting.
arguments:
buf greeting string
- options merged options record.
+ queryctl merged options record.
ret. value: zero on success, nonzero if no timestamp found in
greeting.
@@ -711,9 +711,9 @@ int socket;
*****************************************************************/
#if defined(HAVE_APOP_SUPPORT)
-POP3_BuildDigest (buf,options)
+POP3_BuildDigest (buf,queryctl)
char *buf;
-struct hostrec *options;
+struct hostrec *queryctl;
{
char *start,*end;
char *msg;
@@ -735,12 +735,12 @@ struct hostrec *options;
}
/* copy timestamp and password into digestion buffer */
- msg = (char *) malloc((end-start-1) + strlen(options->password) + 1);
+ msg = (char *) malloc((end-start-1) + strlen(queryctl->password) + 1);
*(++end) = 0;
strcpy(msg,start);
- strcat(msg,options->password);
+ strcat(msg,queryctl->password);
- strcpy(options->digest, MD5Digest(msg));
+ strcpy(queryctl->digest, MD5Digest(msg));
free(msg);
return(0);
}