comparison svr-authpam.c @ 258:306499676384

* add -g (dbclient) and -a (dropbear) options for allowing non-local hosts to connect to forwarded ports. Rearranged various some of the tcp listening code. * changed to /* */ style brackets in svr-authpam.c
author Matt Johnston <matt@ucc.asn.au>
date Sun, 04 Dec 2005 16:13:11 +0000
parents 9a9c6d633972
children 517e76bdfb2d
comparison
equal deleted inserted replaced
257:63601217f5ab 258:306499676384
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 }