summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-12-10 16:46:08 +0000
committerdes <des@FreeBSD.org>2003-12-10 16:46:08 +0000
commit7484d38bbb5835c55f2b8d156e8ee36a028a5f22 (patch)
treee640f40a5e14ef71432a21b30930b0ba993586cf /contrib
parentacccb1539f99aeeb5b58b7467640401d3debf76c (diff)
parent0ac9b614f9f226bd46f9d2f378dba4a0a2ecb797 (diff)
downloadFreeBSD-src-7484d38bbb5835c55f2b8d156e8ee36a028a5f22.zip
FreeBSD-src-7484d38bbb5835c55f2b8d156e8ee36a028a5f22.tar.gz
This commit was generated by cvs2svn to compensate for changes in r123394,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/openpam/lib/openpam_ttyconv.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/contrib/openpam/lib/openpam_ttyconv.c b/contrib/openpam/lib/openpam_ttyconv.c
index 1b91f16..0e240ac 100644
--- a/contrib/openpam/lib/openpam_ttyconv.c
+++ b/contrib/openpam/lib/openpam_ttyconv.c
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#23 $
+ * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#24 $
*/
#include <sys/types.h>
@@ -119,7 +119,7 @@ prompt(const char *msg)
}
/* trim trailing whitespace */
for (len = strlen(buf); len > 0; --len)
- if (!isspace(buf[len - 1]))
+ if (buf[len - 1] != '\r' && buf[len - 1] != '\n')
break;
buf[len] = '\0';
retval = strdup(buf);
@@ -166,26 +166,27 @@ openpam_ttyconv(int n,
struct pam_response **resp,
void *data)
{
+ struct pam_response *aresp;
int i;
ENTER();
(void)data;
if (n <= 0 || n > PAM_MAX_NUM_MSG)
RETURNC(PAM_CONV_ERR);
- if ((*resp = calloc(n, sizeof **resp)) == NULL)
+ if ((aresp = calloc(n, sizeof *aresp)) == NULL)
RETURNC(PAM_BUF_ERR);
for (i = 0; i < n; ++i) {
- resp[i]->resp_retcode = 0;
- resp[i]->resp = NULL;
+ aresp[i].resp_retcode = 0;
+ aresp[i].resp = NULL;
switch (msg[i]->msg_style) {
case PAM_PROMPT_ECHO_OFF:
- (*resp[i]).resp = prompt_echo_off(msg[i]->msg);
- if ((*resp[i]).resp == NULL)
+ aresp[i].resp = prompt_echo_off(msg[i]->msg);
+ if (aresp[i].resp == NULL)
goto fail;
break;
case PAM_PROMPT_ECHO_ON:
- (*resp[i]).resp = prompt(msg[i]->msg);
- if ((*resp[i]).resp == NULL)
+ aresp[i].resp = prompt(msg[i]->msg);
+ if (aresp[i].resp == NULL)
goto fail;
break;
case PAM_ERROR_MSG:
@@ -204,16 +205,18 @@ openpam_ttyconv(int n,
goto fail;
}
}
+ *resp = aresp;
RETURNC(PAM_SUCCESS);
fail:
for (i = 0; i < n; ++i) {
- if ((*resp[i]).resp != NULL) {
- memset((*resp[i]).resp, 0, strlen((*resp[i]).resp));
- FREE((*resp[i]).resp);
+ if (aresp[i].resp != NULL) {
+ memset(aresp[i].resp, 0, strlen(aresp[i].resp));
+ FREE(aresp[i].resp);
}
}
- memset(*resp, 0, n * sizeof **resp);
- FREE(*resp);
+ memset(aresp, 0, n * sizeof *aresp);
+ FREE(aresp);
+ *resp = NULL;
RETURNC(PAM_CONV_ERR);
}
OpenPOWER on IntegriCloud