Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Nov 2003 00:37:00 -0800 (PST)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 42758 for review
Message-ID:  <200311190837.hAJ8b0Zb024113@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=42758

Change 42758 by des@des.at.des.thinksec.com on 2003/11/19 00:36:36

	Belatedly fix confusion about the layout of resp, cf. similar changes
	in OpenSSH-portable.

Affected files ...

.. //depot/projects/openpam/lib/openpam_ttyconv.c#23 edit

Differences ...

==== //depot/projects/openpam/lib/openpam_ttyconv.c#23 (text+ko) ====

@@ -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#22 $
+ * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#23 $
  */
 
 #include <sys/types.h>
@@ -179,13 +179,13 @@
 		resp[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)
+			(*resp[i]).resp = prompt_echo_off(msg[i]->msg);
+			if ((*resp[i]).resp == NULL)
 				goto fail;
 			break;
 		case PAM_PROMPT_ECHO_ON:
-			resp[i]->resp = prompt(msg[i]->msg);
-			if (resp[i]->resp == NULL)
+			(*resp[i]).resp = prompt(msg[i]->msg);
+			if ((*resp[i]).resp == NULL)
 				goto fail;
 			break;
 		case PAM_ERROR_MSG:
@@ -206,11 +206,13 @@
 	}
 	RETURNC(PAM_SUCCESS);
  fail:
-	while (i)
-		if (resp[--i]->resp) {
-			memset(resp[i]->resp, 0, strlen(resp[i]->resp));
-			FREE(resp[i]->resp);
+	for (i = 0; i < n; ++i) {
+		if ((*resp[i]).resp != NULL) {
+			memset((*resp[i]).resp, 0, strlen((*resp[i]).resp));
+			FREE((*resp[i]).resp);
 		}
+	}
+	memset(*resp, 0, n * sizeof **resp);
 	FREE(*resp);
 	RETURNC(PAM_CONV_ERR);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311190837.hAJ8b0Zb024113>