0

I'm currently trying to automate things in a macOS status bar application.

Now I had tried to make the Kerberos Login in a Process (previous called NSTask). In my playground, the code creates successfully the token. But when I move the code to the real app, it failed. I get this error message: "kinit: resolving credentials cache: malloc: out of memory"

Here is my code:

import Cocoa

// user credentials
let username = "user@example.com"
let password = "password"

// previous called NSTask
let process = Process()

// set process parameters
process.launchPath = "/bin/sh"
process.arguments = ["-c", "/bin/echo \(password) | /usr/bin/kinit --password-file=STDIN \(username)"]

// create a pipe to lauch process
let pipe = Pipe()
process.standardOutput = pipe

// launch process
process.launch()

// get outcome
let data = pipe.fileHandleForReading.readDataToEndOfFile()
let output = NSString(data: data, encoding: String.Encoding.utf8.rawValue)

print(output!)

I think that it is a problem with the Credential cache. When I enter the command "klist -A", I get the following error: "klist: krb5_cc_cache_get_first: Failed to open kcm init".

Does anybody know what can I do to get this code running?

MOE
  • 769
  • 6
  • 19

0 Answers0