Java Kadmin

Ken Raeburn raeburn at MIT.EDU
Tue Nov 13 13:31:54 EST 2007


On Nov 13, 2007, at 13:09, Jonathan Javier Cordoba Gonzalez wrote:
> Well I’m try to do a interface that admin the user database on  
> java. My
> first solution was call kadmin.local from java through
>
> Runtime.getRuntime().exec("kadmin.local –q \"addprinc –pw lola
> lola at SAKURA.COM\"")
>
> Well there seems ok, but when I execute on a linux box the process  
> on Java
> tries to connect with the user w at SAKURA.COM... (funny isn’t it?)  
> and kadmin
> doesn’t found on KDC.

Sounds like exec isn't parsing the string the way a shell would, and  
kadmin.local sees a separate "-pw" argument and takes that as an  
indication that the principal name is "w".  According to http:// 
java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#exec 
(java.lang.String) the string is parsed using a StringTokenizer that  
doesn't understand quoted strings in the input.

Probably you want to use the exec(String[]) method instead, and  
construct the argument array yourself, either as an array directly,  
or by more shell-like tokenization.

Ken






More information about the Kerberos mailing list