summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1998-04-06 22:10:30 +0000
committerKarl Heuer <kwzh@gnu.org>1998-04-06 22:10:30 +0000
commit359e08be241d34fd99999d567dfadf2dec21b0e0 (patch)
tree06f3a2bedf68a85da48a0bc87f575222471477e9 /lib-src
parente431196dca22504e6671877496fbe925f1380623 (diff)
downloademacs-359e08be241d34fd99999d567dfadf2dec21b0e0.tar.gz
[MAIL_USE_POP]: Add support for "-g" and "-k"
command-line flags to tell movemail to use GSS-API or Kerberos authentication if they are supported.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/movemail.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 7e29ab4150f..64cae0b46a7 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -188,16 +188,43 @@ main (argc, argv)
char *spool_name;
#endif
+#ifdef MAIL_USE_POP
+ int pop_flags = POP_NO_GETPASS | POP_NO_GSSAPI;
+# define ARGSTR "gkp"
+#else /* ! MAIL_USE_POP */
+# define ARGSTR "p"
+#endif /* MAIL_USE_POP */
+
delete_lockname = 0;
- while ((c = getopt (argc, argv, "p")) != EOF)
+ /*
+ 'g' enables Kerberos and disables GSS-API.
+ 'k' enables GSS-API and disables Kerberos.
+
+ By default, Kerberos is enabled (if it is compiled in) and
+ GSS-API is disabled, i.e., "-k" is the default. However, I'm
+ putting the flag in anyway, in case we decide to add new
+ authentication methods or change the default later.
+ */
+
+ while ((c = getopt (argc, argv, ARGSTR)) != EOF)
{
switch (c) {
+#ifdef MAIL_USE_POP
+ case 'g':
+ pop_flags |= POP_NO_KERBEROS;
+ pop_flags &= ~POP_NO_GSSAPI;
+ break;
+ case 'k':
+ pop_flags |= POP_NO_GSSAPI;
+ pop_flags &= ~POP_NO_KERBEROS;
+ break;
+#endif
case 'p':
preserve_mail++;
break;
default:
- exit(1);
+ goto usage;
}
}
@@ -209,11 +236,12 @@ main (argc, argv)
#endif
)
{
- fprintf (stderr, "Usage: movemail [-p] inbox destfile%s\n",
+ usage:
+ fprintf (stderr, "Usage: movemail %s[-p] inbox destfile%s\n",
#ifdef MAIL_USE_POP
- " [POP-password]"
+ "[-g|-k] ", " [POP-password]"
#else
- ""
+ "", ""
#endif
);
exit (1);
@@ -254,7 +282,7 @@ main (argc, argv)
int status;
status = popmail (inname + 3, outname, preserve_mail,
- (argc - optind == 3) ? argv[optind+2] : NULL);
+ (argc - optind == 3) ? argv[optind+2] : NULL, pop_flags);
exit (status);
}
@@ -673,11 +701,12 @@ char ibuffer[BUFSIZ];
char obuffer[BUFSIZ];
char Errmsg[80];
-popmail (user, outfile, preserve, password)
+popmail (user, outfile, preserve, password, flags)
char *user;
char *outfile;
int preserve;
char *password;
+ int flags;
{
int nmsgs, nbytes;
register int i;
@@ -686,7 +715,7 @@ popmail (user, outfile, preserve, password)
char *getenv ();
popserver server;
- server = pop_open (0, user, password, POP_NO_GETPASS);
+ server = pop_open (0, user, password, flags);
if (! server)
{
error (pop_error);