comparison lib-src/movemail.c @ 22235:ee90e9da3a70

Undo this previous change: [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.
author Richard M. Stallman <rms@gnu.org>
date Mon, 25 May 1998 20:10:50 +0000
parents b1e64615e700
children 95d38cf99591
comparison
equal deleted inserted replaced
22234:40229c79e16b 22235:ee90e9da3a70
195 195
196 #ifdef MAIL_USE_MAILLOCK 196 #ifdef MAIL_USE_MAILLOCK
197 char *spool_name; 197 char *spool_name;
198 #endif 198 #endif
199 199
200 #ifdef MAIL_USE_POP
201 int pop_flags = POP_NO_GETPASS | POP_NO_GSSAPI;
202 # define ARGSTR "gkp"
203 #else /* ! MAIL_USE_POP */
204 # define ARGSTR "p"
205 #endif /* MAIL_USE_POP */
206
207 delete_lockname = 0; 200 delete_lockname = 0;
208 201
209 /* 202 while ((c = getopt (argc, argv, "p")) != EOF)
210 'g' enables Kerberos and disables GSS-API.
211 'k' enables GSS-API and disables Kerberos.
212
213 By default, Kerberos is enabled (if it is compiled in) and
214 GSS-API is disabled, i.e., "-k" is the default. However, I'm
215 putting the flag in anyway, in case we decide to add new
216 authentication methods or change the default later.
217 */
218
219 while ((c = getopt (argc, argv, ARGSTR)) != EOF)
220 { 203 {
221 switch (c) { 204 switch (c) {
222 #ifdef MAIL_USE_POP
223 case 'g':
224 pop_flags |= POP_NO_KERBEROS;
225 pop_flags &= ~POP_NO_GSSAPI;
226 break;
227 case 'k':
228 pop_flags |= POP_NO_GSSAPI;
229 pop_flags &= ~POP_NO_KERBEROS;
230 break;
231 #endif
232 case 'p': 205 case 'p':
233 preserve_mail++; 206 preserve_mail++;
234 break; 207 break;
235 default: 208 default:
236 goto usage; 209 exit(1);
237 } 210 }
238 } 211 }
239 212
240 if ( 213 if (
241 #ifdef MAIL_USE_POP 214 #ifdef MAIL_USE_POP
243 #else 216 #else
244 (argc - optind != 2) 217 (argc - optind != 2)
245 #endif 218 #endif
246 ) 219 )
247 { 220 {
248 usage: 221 fprintf (stderr, "Usage: movemail [-p] inbox destfile%s\n",
249 fprintf (stderr, "Usage: movemail %s[-p] inbox destfile%s\n",
250 #ifdef MAIL_USE_POP 222 #ifdef MAIL_USE_POP
251 "[-g|-k] ", " [POP-password]" 223 " [POP-password]"
252 #else 224 #else
253 "", "" 225 ""
254 #endif 226 #endif
255 ); 227 );
256 exit (1); 228 exit (1);
257 } 229 }
258 230
289 if (!strncmp (inname, "po:", 3)) 261 if (!strncmp (inname, "po:", 3))
290 { 262 {
291 int status; 263 int status;
292 264
293 status = popmail (inname + 3, outname, preserve_mail, 265 status = popmail (inname + 3, outname, preserve_mail,
294 (argc - optind == 3) ? argv[optind+2] : NULL, pop_flags); 266 (argc - optind == 3) ? argv[optind+2] : NULL);
295 exit (status); 267 exit (status);
296 } 268 }
297 269
298 setuid (getuid ()); 270 setuid (getuid ());
299 #endif /* MAIL_USE_POP */ 271 #endif /* MAIL_USE_POP */
708 FILE *sfo; 680 FILE *sfo;
709 char ibuffer[BUFSIZ]; 681 char ibuffer[BUFSIZ];
710 char obuffer[BUFSIZ]; 682 char obuffer[BUFSIZ];
711 char Errmsg[80]; 683 char Errmsg[80];
712 684
713 popmail (user, outfile, preserve, password, flags) 685 popmail (user, outfile, preserve, password)
714 char *user; 686 char *user;
715 char *outfile; 687 char *outfile;
716 int preserve; 688 int preserve;
717 char *password; 689 char *password;
718 int flags;
719 { 690 {
720 int nmsgs, nbytes; 691 int nmsgs, nbytes;
721 register int i; 692 register int i;
722 int mbfi; 693 int mbfi;
723 FILE *mbf; 694 FILE *mbf;
724 char *getenv (); 695 char *getenv ();
725 popserver server; 696 popserver server;
726 697
727 server = pop_open (0, user, password, flags); 698 server = pop_open (0, user, password, POP_NO_GETPASS);
728 if (! server) 699 if (! server)
729 { 700 {
730 error (pop_error); 701 error (pop_error);
731 return (1); 702 return (1);
732 } 703 }