comparison svr-authpam.c @ 293:9d110777f345 contrib-blacklist

propagate from branch 'au.asn.ucc.matt.dropbear' (head 7ad1775ed65e75dbece27fe6b65bf1a234db386a) to branch 'au.asn.ucc.matt.dropbear.contrib.blacklist' (head 1d86a4f0a401cc68c2670d821a2f6366c37af143)
author Matt Johnston <matt@ucc.asn.au>
date Fri, 10 Mar 2006 06:31:29 +0000
parents 306499676384
children 517e76bdfb2d
comparison
equal deleted inserted replaced
247:c07de41b53d7 293:9d110777f345
57 unsigned int msg_len = 0; 57 unsigned int msg_len = 0;
58 unsigned int i = 0; 58 unsigned int i = 0;
59 59
60 const char* message = (*msg)->msg; 60 const char* message = (*msg)->msg;
61 61
62 // make a copy we can strip 62 /* make a copy we can strip */
63 char * compare_message = m_strdup(message); 63 char * compare_message = m_strdup(message);
64 64
65 TRACE(("enter pamConvFunc")) 65 TRACE(("enter pamConvFunc"))
66 66
67 if (num_msg != 1) { 67 if (num_msg != 1) {
78 } else { 78 } else {
79 TRACE(("null message")) 79 TRACE(("null message"))
80 } 80 }
81 81
82 82
83 // Make the string lowercase. 83 /* Make the string lowercase. */
84 msg_len = strlen(compare_message); 84 msg_len = strlen(compare_message);
85 for (i = 0; i < msg_len; i++) { 85 for (i = 0; i < msg_len; i++) {
86 compare_message[i] = tolower(compare_message[i]); 86 compare_message[i] = tolower(compare_message[i]);
87 } 87 }
88 88
89 // If the string ends with ": ", remove the space. 89 /* If the string ends with ": ", remove the space.
90 // ie "login: " vs "login:" 90 ie "login: " vs "login:" */
91 if (msg_len > 2 91 if (msg_len > 2
92 && compare_message[msg_len-2] == ':' 92 && compare_message[msg_len-2] == ':'
93 && compare_message[msg_len-1] == ' ') { 93 && compare_message[msg_len-1] == ' ') {
94 compare_message[msg_len-1] = '\0'; 94 compare_message[msg_len-1] = '\0';
95 } 95 }
97 switch((*msg)->msg_style) { 97 switch((*msg)->msg_style) {
98 98
99 case PAM_PROMPT_ECHO_OFF: 99 case PAM_PROMPT_ECHO_OFF:
100 100
101 if (!(strcmp(compare_message, "password:") == 0)) { 101 if (!(strcmp(compare_message, "password:") == 0)) {
102 // We don't recognise the prompt as asking for a password, 102 /* We don't recognise the prompt as asking for a password,
103 // so can't handle it. Add more above as required for 103 so can't handle it. Add more above as required for
104 // different pam modules/implementations 104 different pam modules/implementations */
105 dropbear_log(LOG_NOTICE, "PAM unknown prompt %s (no echo)", 105 dropbear_log(LOG_NOTICE, "PAM unknown prompt %s (no echo)",
106 compare_message); 106 compare_message);
107 rc = PAM_CONV_ERR; 107 rc = PAM_CONV_ERR;
108 break; 108 break;
109 } 109 }
123 123
124 case PAM_PROMPT_ECHO_ON: 124 case PAM_PROMPT_ECHO_ON:
125 125
126 if (!((strcmp(compare_message, "login:" ) == 0) 126 if (!((strcmp(compare_message, "login:" ) == 0)
127 || (strcmp(compare_message, "please enter username:") == 0))) { 127 || (strcmp(compare_message, "please enter username:") == 0))) {
128 // We don't recognise the prompt as asking for a username, 128 /* We don't recognise the prompt as asking for a username,
129 // so can't handle it. Add more above as required for 129 so can't handle it. Add more above as required for
130 // different pam modules/implementations 130 different pam modules/implementations */
131 dropbear_log(LOG_NOTICE, "PAM unknown prompt %s (with echo)", 131 dropbear_log(LOG_NOTICE, "PAM unknown prompt %s (with echo)",
132 compare_message); 132 compare_message);
133 rc = PAM_CONV_ERR; 133 rc = PAM_CONV_ERR;
134 break; 134 break;
135 } 135 }