comparison pam/src/conv.rs @ 28:81a9f0479e50

conv: fix bug where pam prompts were not being shown
author holycleugh <holycleugh>
date Sun, 30 Dec 2018 03:40:04 -0500
parents 0ceeffe67ec4
children c16564971c05
comparison
equal deleted inserted replaced
27:0ceeffe67ec4 28:81a9f0479e50
53 /// Note that the user experience will depend on how the client implements 53 /// Note that the user experience will depend on how the client implements
54 /// these message styles - and not all applications implement all message 54 /// these message styles - and not all applications implement all message
55 /// styles. 55 /// styles.
56 pub fn send(&self, style: PamMessageStyle, msg: &str) -> PamResult<Option<String>> { 56 pub fn send(&self, style: PamMessageStyle, msg: &str) -> PamResult<Option<String>> {
57 let mut resp_ptr: *const PamResponse = ptr::null(); 57 let mut resp_ptr: *const PamResponse = ptr::null();
58 let msg_cstr = CString::new(msg).unwrap();
58 let msg = PamMessage { 59 let msg = PamMessage {
59 msg_style: style, 60 msg_style: style,
60 msg: CString::new(msg).unwrap().as_ptr(), 61 msg: msg_cstr.as_ptr(),
61 }; 62 };
62 63
63 let ret = (self.conv)(1, &&msg, &mut resp_ptr, self.appdata_ptr); 64 let ret = (self.conv)(1, &&msg, &mut resp_ptr, self.appdata_ptr);
64 65
65 if PamResultCode::PAM_SUCCESS == ret { 66 if PamResultCode::PAM_SUCCESS == ret {