[1644] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: preliminary appdefaults patch

daemon@ATHENA.MIT.EDU (Ken Raeburn)
Tue Aug 27 15:52:00 1996

To: Sam Hartman <hartmans@MIT.EDU>
Cc: Mark Eichin <eichin@cygnus.com>, "E. Jay Berkenbilt" <ejb@ql.org>,
        kenh@cmf.nrl.navy.mil, krbdev@MIT.EDU
From: Ken Raeburn <raeburn@cygnus.com>
Date: 27 Aug 1996 15:51:15 -0400
In-Reply-To: Sam Hartman's message of 27 Aug 1996 13:29:26 -0400


>     Mark> It looks like rlogin uses:
>     Mark>     { "noforwardable", 0, &off_option, 'F' },
>     Mark>     { "noforward", 0, &off_option, 'f' },
>     Mark>     { "noencrypt", 0, &off_option, 'x' },
>     Mark>     { "forwardable", 0, NULL, 'F' },
>     Mark>     { "forward", 0, NULL, 'f' },
>     Mark>     { "encrypt", 0, NULL, 'x' },
>     Mark>     { "noflow", 0, NULL, 0 },

Sigh.  Those should've been "no-", IMO.  (Plus "noflow" for backwards
compatibility.)

> 	I'm not quite sure what the meaning of that is; it sounds like
> you use the same option to tuern something off that you do to turn it
> on.

The getopt_long interface is kind of weird.  If the third (pointer)
field is non-null, the pointed-to int gets the specified value ('F' or
whatever) and zero is returned.  Also, an extra pointer argument to
getopt_long can be used to pass back the index into the option table.

So you get something like this:

    while ((i = getopt_long(argc, argv, "LD:l:de:cat:78k:xfFn",
			      long_options, NULL)) != EOF) {
	switch(i) {
	case 0:
	    switch(off_option) {
	    default:
		goto usage;
		break;
	    case 0:
  	        flow = 0;		
		break;
#ifdef KERBEROS
	    case 'x':
	        encrypt_flag = 0;
	        encrypt_done = 1;
	        break;
	    case 'f':
	        forward_flag = 0;
	        forward_done = 1;
	    case 'F':
	        forwardable_flag = 0;
	        forwardable_done = 1;
	        break;
#endif
	    }
	    break;
	....

Ken

home help back first fref pref prev next nref lref last post