comparison svr-authpam.c @ 660:a842469ce8ad

- Fix minor leak
author Matt Johnston <matt@ucc.asn.au>
date Wed, 22 Feb 2012 22:05:24 +0800
parents a98a2138364a
children 8fe36617bf4e
comparison
equal deleted inserted replaced
659:1e0414b29ce9 660:a842469ce8ad
54 int rc = PAM_SUCCESS; 54 int rc = PAM_SUCCESS;
55 struct pam_response* resp = NULL; 55 struct pam_response* resp = NULL;
56 struct UserDataS* userDatap = (struct UserDataS*) appdata_ptr; 56 struct UserDataS* userDatap = (struct UserDataS*) appdata_ptr;
57 unsigned int msg_len = 0; 57 unsigned int msg_len = 0;
58 unsigned int i = 0; 58 unsigned int i = 0;
59 59 char * compare_message = NULL;
60 const char* message = (*msg)->msg;
61
62 /* make a copy we can strip */
63 char * compare_message = m_strdup(message);
64 60
65 TRACE(("enter pamConvFunc")) 61 TRACE(("enter pamConvFunc"))
66 62
67 if (num_msg != 1) { 63 if (num_msg != 1) {
68 /* If you're getting here - Dropbear probably can't support your pam 64 /* If you're getting here - Dropbear probably can't support your pam
69 * modules. This whole file is a bit of a hack around lack of 65 * modules. This whole file is a bit of a hack around lack of
70 * asynchronocity in PAM anyway. */ 66 * asynchronocity in PAM anyway. */
71 dropbear_log(LOG_INFO, "pamConvFunc() called with >1 messages: not supported."); 67 dropbear_log(LOG_INFO, "pamConvFunc() called with >1 messages: not supported.");
72 return PAM_CONV_ERR; 68 return PAM_CONV_ERR;
73 } 69 }
70
71 /* make a copy we can strip */
72 compare_message = m_strdup((*msg)->msg);
74 73
75 TRACE(("msg_style is %d", (*msg)->msg_style))
76 if (compare_message) {
77 TRACE(("message is '%s'", compare_message))
78 } else {
79 TRACE(("null message"))
80 }
81
82
83 /* Make the string lowercase. */ 74 /* Make the string lowercase. */
84 msg_len = strlen(compare_message); 75 msg_len = strlen(compare_message);
85 for (i = 0; i < msg_len; i++) { 76 for (i = 0; i < msg_len; i++) {
86 compare_message[i] = tolower(compare_message[i]); 77 compare_message[i] = tolower(compare_message[i]);
87 } 78 }