I am creating a website where users can log in using the kerberos service. Although, this is completely irrelevant to my problem.
Since I use kerberos, I want to use the system call to call kinit , but I don't know how to do this.
So far I have received:
module Kerberos where system :: String -> IO ExitCode -- system is loaded through imports type Username = String type Password = String kerberosValidate :: Username -> Password -> IO Bool kerberosValidate username password = fmap (== ExitSuccess) $ system $ "echo " ++ password ++ " | kinit " ++ username
Something like this that should work so-so. I have three problems with this though.
- Unable to escape
username and password strings. This is important because the website passes any input received to this function. - Ideally,
password should not be passed to the kinit process using echo password | . Is there any function that takes a standard as an argument? - Similarly for
username , username should be passed as an argument. I think rawSystem solves this though.
Is there some kind of system function that helps me here?
source share