diff options
-rw-r--r-- | fetchmail.c | 20 | ||||
-rw-r--r-- | fetchmail.h | 2 | ||||
-rw-r--r-- | options.c | 1 |
3 files changed, 15 insertions, 8 deletions
diff --git a/fetchmail.c b/fetchmail.c index 95e41013..3b9dfc1c 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -90,17 +90,22 @@ main (argc,argv) int argc; char **argv; { - int mboxfd, st; + int mboxfd, st, sargc; struct hostrec cmd_opts, def_opts; int parsestatus; - char *servername, *user, *tmpdir, tmpbuf[256]; + char *servername, *user, *tmpdir, tmpbuf[256], *sargv[64]; FILE *tmpfp; pid_t pid; if (setdefaults(&def_opts) != 0) exit(PS_UNDEFINED); - if ((parsestatus = parsecmdline(argc,argv,&cmd_opts)) < 0) + if (argc > sizeof(sargv)) + exit(PS_SYNTAX); + for (sargc = 0; sargc < argc; sargc++) + sargv[sargc] = argv[sargc]; + + if ((parsestatus = parsecmdline(sargc,sargv,&cmd_opts)) < 0) exit(PS_SYNTAX); if (versioninfo) @@ -110,10 +115,10 @@ char **argv; exit(PS_SYNTAX); if (optind >= argc) - append_server_names(&argc, argv); + append_server_names(&sargc, sargv, sizeof(sargv)); /* build in-core data list on all hosts */ - while ((servername = getnextserver(argc, argv, &parsestatus)) != (char *)0) + while ((servername = getnextserver(sargc, sargv, &parsestatus)) != (char *)0) { if (strcmp(servername, "defaults") == 0) continue; @@ -151,7 +156,8 @@ char **argv; printf(" Lockfile at %s\n", tmpbuf); } if (hostlist == NULL) - (void) printf("No mailservers set up -- perhaps %s is missing?\n", + (void) fprintf(stderr, + "No mailservers set up -- perhaps %s is missing?\n", poprcfile); exit(0); } @@ -386,7 +392,7 @@ struct hostrec *queryctl; char *cp; printf(" Username = '%s'\n", queryctl->remotename); - if (queryctl->password) + if (queryctl->password && outlevel == O_VERBOSE) printf(" Password = '%s'\n", queryctl->password); if (queryctl->rpopid) printf(" RPOP id = '%s'\n", queryctl->rpopid); diff --git a/fetchmail.h b/fetchmail.h index 43d34868..7bfb1921 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -131,7 +131,7 @@ int closeuserfolder (int); int openmailpipe (struct hostrec *); int closemailpipe (int); char *MD5Digest (char *); -void append_server_names(int *, char **); +void append_server_names(int *, char **, int); int daemonize(const char *, void (*)(int)); #else @@ -220,6 +220,7 @@ struct hostrec *queryctl; break; case 'm': case LA_MDA: + queryctl->output = TO_MDA; strncpy(queryctl->mda,optarg,sizeof(queryctl->mda)-1); break; case 'P': |