Mercurial > dropbear
comparison svr-authpam.c @ 165:0cfba3034be5
Fixed DEBUG_TRACE macro so that we don't get semicolons left about the place
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 02 Jan 2005 20:25:56 +0000 |
parents | 364a75cfebab |
children | 21e99b6190dd |
comparison
equal
deleted
inserted
replaced
161:b9d3f725e00b | 165:0cfba3034be5 |
---|---|
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 | 57 |
58 const char* message = (*msg)->msg; | 58 const char* message = (*msg)->msg; |
59 | 59 |
60 TRACE(("enter pamConvFunc")); | 60 TRACE(("enter pamConvFunc")) |
61 | 61 |
62 if (num_msg != 1) { | 62 if (num_msg != 1) { |
63 /* If you're getting here - Dropbear probably can't support your pam | 63 /* If you're getting here - Dropbear probably can't support your pam |
64 * modules. This whole file is a bit of a hack around lack of | 64 * modules. This whole file is a bit of a hack around lack of |
65 * asynchronocity in PAM anyway */ | 65 * asynchronocity in PAM anyway */ |
66 dropbear_log(LOG_INFO, "pamConvFunc() called with >1 messages: not supported."); | 66 dropbear_log(LOG_INFO, "pamConvFunc() called with >1 messages: not supported."); |
67 return PAM_CONV_ERR; | 67 return PAM_CONV_ERR; |
68 } | 68 } |
69 | 69 |
70 TRACE(("msg_style is %d", (*msg)->msg_style)); | 70 TRACE(("msg_style is %d", (*msg)->msg_style)) |
71 if (message) { | 71 if (message) { |
72 TRACE(("message is '%s'", message)); | 72 TRACE(("message is '%s'", message)) |
73 } else { | 73 } else { |
74 TRACE(("null message")); | 74 TRACE(("null message")) |
75 } | 75 } |
76 | 76 |
77 switch((*msg)->msg_style) { | 77 switch((*msg)->msg_style) { |
78 | 78 |
79 case PAM_PROMPT_ECHO_OFF: | 79 case PAM_PROMPT_ECHO_OFF: |
80 | 80 |
81 if (strcmp(message, "Password:") != 0) { | 81 if (strcmp(message, "Password:") != 0) { |
82 TRACE(("PAM_PROMPT_ECHO_OFF: unrecognized prompt")); | 82 TRACE(("PAM_PROMPT_ECHO_OFF: unrecognized prompt")) |
83 rc = PAM_CONV_ERR; | 83 rc = PAM_CONV_ERR; |
84 break; | 84 break; |
85 } | 85 } |
86 | 86 |
87 /* You have to read the PAM module-writers' docs (do we look like | 87 /* You have to read the PAM module-writers' docs (do we look like |
100 case PAM_PROMPT_ECHO_ON: | 100 case PAM_PROMPT_ECHO_ON: |
101 | 101 |
102 if ((strcmp(message, "login: " ) != 0) | 102 if ((strcmp(message, "login: " ) != 0) |
103 && (strcmp(message, "login:" ) != 0) | 103 && (strcmp(message, "login:" ) != 0) |
104 && (strcmp(message, "Please enter username: " ) != 0)) { | 104 && (strcmp(message, "Please enter username: " ) != 0)) { |
105 TRACE(("PAM_PROMPT_ECHO_ON: unrecognized prompt")); | 105 TRACE(("PAM_PROMPT_ECHO_ON: unrecognized prompt")) |
106 rc = PAM_CONV_ERR; | 106 rc = PAM_CONV_ERR; |
107 break; | 107 break; |
108 } | 108 } |
109 | 109 |
110 /* You have to read the PAM module-writers' docs (do we look like | 110 /* You have to read the PAM module-writers' docs (do we look like |
115 memset(resp, 0, sizeof(struct pam_response)); | 115 memset(resp, 0, sizeof(struct pam_response)); |
116 | 116 |
117 /* Safe to just use the direct pointer (no strdup) since | 117 /* Safe to just use the direct pointer (no strdup) since |
118 * it shouldn't be getting munged at all */ | 118 * it shouldn't be getting munged at all */ |
119 resp->resp = m_strdup(userDatap->user); | 119 resp->resp = m_strdup(userDatap->user); |
120 TRACE(("userDatap->user='%s'", userDatap->user)); | 120 TRACE(("userDatap->user='%s'", userDatap->user)) |
121 (*respp) = resp; | 121 (*respp) = resp; |
122 break; | 122 break; |
123 | 123 |
124 default: | 124 default: |
125 TRACE(("Unknown message type")); | 125 TRACE(("Unknown message type")) |
126 rc = PAM_CONV_ERR; | 126 rc = PAM_CONV_ERR; |
127 break; | 127 break; |
128 } | 128 } |
129 | 129 |
130 TRACE(("leave pamConvFunc, rc %d", rc)); | 130 TRACE(("leave pamConvFunc, rc %d", rc)) |
131 | 131 |
132 return rc; | 132 return rc; |
133 } | 133 } |
134 | 134 |
135 /* Process a password auth request, sending success or failure messages as | 135 /* Process a password auth request, sending success or failure messages as |
222 if (password != NULL) { | 222 if (password != NULL) { |
223 m_burn(password, passwordlen); | 223 m_burn(password, passwordlen); |
224 m_free(password); | 224 m_free(password); |
225 } | 225 } |
226 if (pamHandlep != NULL) { | 226 if (pamHandlep != NULL) { |
227 TRACE(("pam_end")); | 227 TRACE(("pam_end")) |
228 (void) pam_end(pamHandlep, 0 /* pam_status */); | 228 (void) pam_end(pamHandlep, 0 /* pam_status */); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 #endif /* ENABLE_SVR_PAM_AUTH */ | 232 #endif /* ENABLE_SVR_PAM_AUTH */ |