On Tue, Dec 22, 2015 at 12:49:07PM -0800, Serguey Parkhomovsky wrote:
> Rev 1.141 of smtpctl.c killed mail queueing for me:
> 
>       $ echo "test" | mail -s test sparkhom
>       $ send-mail: unknown option -- i
>       send-mail: unknown option -- t
>       send-mail: no recipients
> 

ugh

> The sendmail option parsing that was added eats the recipient list. I
> have attached a patch that fixes this issue, and also quiets the getopt
> "unknown option" errors, as most options are processed later.
>

looking into it, will fix in a couple minutes,

thanks for the diff


> Index: smtpctl.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/smtpctl.c,v
> retrieving revision 1.142
> diff -u -p -r1.142 smtpctl.c
> --- smtpctl.c 22 Dec 2015 15:59:10 -0000      1.142
> +++ smtpctl.c 22 Dec 2015 20:37:48 -0000
> @@ -990,6 +990,7 @@ main(int argc, char **argv)
>                * determine whether we are called with flags
>                * that should invoke makemap/newaliases.
>                */
> +             opterr = 0;
>               while ((ch = getopt(argc, argv, "b:C:O:")) != -1) {
>                       switch (ch) {
>                       case 'b':
> @@ -1006,10 +1007,13 @@ main(int argc, char **argv)
>                               break;
>                       }
>               }
> -             argc -= optind;
> -             argv += optind;
> -             optind = 0;
> +             opterr = 1;
> +
>               if (sendmail_makemap) {
> +                     argc -= optind;
> +                     argv += optind;
> +                     optind = 0;
> +
>                       memset(&args, 0, sizeof args);
>                       addargs(&args, "%s", "makemap");
>                       for (i = 0; i < argc; i++)
> @@ -1021,6 +1025,7 @@ main(int argc, char **argv)
>  
>                       return makemap(args.num, args.list);
>               }
> +             optind = 0;
>  
>               if (!srv_connect())
>                       offlinefp = offline_file();
> 

-- 
Gilles Chehade

https://www.poolp.org                                          @poolpOrg

Reply via email to