[2676] in Kerberos_V5_Development

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

kdb5_util argument parsing....

daemon@ATHENA.MIT.EDU (Ezra Peisach)
Tue Oct 28 11:20:13 1997

Date: Tue, 28 Oct 1997 11:19:25 -0500
From: Ezra Peisach <epeisach@MIT.EDU>
To: krbdev@MIT.EDU


Background:
kdb5_util has an interesting method or parsing arguments.  For a given
command line argument, first a check is made to see if this is a
global option, like "-r realm". If so it is acted upon. If not, the
argument is checked for a command name - like "create" and is stored
away if so. Otherwise the option is stashed away for passing down to
the subprogram that does the work. 

The problem:

If one of the global options is the same as a subprograms, the
subprogram never receives the option. The particular example is 
kdb5_util destroy -f

or

krb5_util stash -f /tmp/a

Now, -f is un undocumented option that sets the stash file name and is
handled before being passed to the stash or destroy functions. In the
former case, one gets an error about a missing filename - or worse
still the next command line element is treated as the stash file name.

Solution:

a) Rewrite the command parsing so that there will be no mistakes. All
global command options must come before the command.

I.e. 

kdb5_util -r KANGAROO.MIT.EDU create -s

must be used instead of

kdb5_util create -s -r KANGAROO.MIT.EDU 

b) Change the conflicting option. I.e. change "-f stashfile" to "-sf
stashfile"

I like (b) because it is easier to code and should (hopefull) not
cause anyone to lose as the option was undocumented to start with...


What do people think?

	Ezra


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