Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jun 2002 14:11:55 -0700 (PDT)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 13662 for review
Message-ID:  <200206302111.g5ULBtWW037939@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=13662

Change 13662 by des@des.at.des.thinksec.com on 2002/06/30 14:11:38

	Add the PAM_REPOSITORY item (from Solaris 9).
	
	Sponsored by:	DARPA, NAI Labs

Affected files ...

.. //depot/projects/openpam/include/security/pam_constants.h#17 edit
.. //depot/projects/openpam/lib/pam_get_item.c#13 edit
.. //depot/projects/openpam/lib/pam_set_item.c#15 edit

Differences ...

==== //depot/projects/openpam/include/security/pam_constants.h#17 (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/include/security/pam_constants.h#16 $
+ * $P4: //depot/projects/openpam/include/security/pam_constants.h#17 $
  */
 
 #ifndef _PAM_CONSTANTS_H_INCLUDED
@@ -122,6 +122,7 @@
 	PAM_USER_PROMPT			=   9,
 	PAM_AUTHTOK_PROMPT		=  10,		/* OpenPAM extension */
 	PAM_OLDAUTHTOK_PROMPT		=  11,		/* OpenPAM extension */
+	PAM_REPOSITORY			=  12,
 	PAM_NUM_ITEMS					/* OpenPAM extension */
 };
 

==== //depot/projects/openpam/lib/pam_get_item.c#13 (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/pam_get_item.c#12 $
+ * $P4: //depot/projects/openpam/lib/pam_get_item.c#13 $
  */
 
 #include <sys/param.h>
@@ -67,6 +67,7 @@
 	case PAM_USER_PROMPT:
 	case PAM_AUTHTOK_PROMPT:
 	case PAM_OLDAUTHTOK_PROMPT:
+	case PAM_REPOSITORY:
 		*item = pamh->item[item_type];
 		return (PAM_SUCCESS);
 	default:

==== //depot/projects/openpam/lib/pam_set_item.c#15 (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/pam_set_item.c#14 $
+ * $P4: //depot/projects/openpam/lib/pam_set_item.c#15 $
  */
 
 #include <sys/param.h>
@@ -56,13 +56,12 @@
 	const void *item)
 {
 	void **slot, *tmp;
-	size_t size;
+	size_t nsize, osize;
 
 	if (pamh == NULL)
 		return (PAM_SYSTEM_ERR);
 
 	slot = &pamh->item[item_type];
-	tmp = NULL;
 	switch (item_type) {
 	case PAM_SERVICE:
 	case PAM_USER:
@@ -74,27 +73,31 @@
 	case PAM_USER_PROMPT:
 	case PAM_AUTHTOK_PROMPT:
 	case PAM_OLDAUTHTOK_PROMPT:
+		if (item != NULL)
+			nsize = strlen(item) + 1;
 		if (*slot != NULL)
-			size = strlen(*slot) + 1;
-		if (item != NULL)
-			if ((tmp = strdup(item)) == NULL)
-				return (PAM_BUF_ERR);
+			osize = strlen(*slot) + 1;
+		break;
+	case PAM_REPOSITORY:
+		osize = nsize = sizeof(struct pam_repository);
 		break;
 	case PAM_CONV:
-		size = sizeof(struct pam_conv);
-		if (item != NULL) {
-			if ((tmp = malloc(size)) == NULL)
-				return (PAM_BUF_ERR);
-			memcpy(tmp, item, sizeof(struct pam_conv));
-		}
+		osize = nsize = sizeof(struct pam_conv);
 		break;
 	default:
 		return (PAM_SYMBOL_ERR);
 	}
 	if (*slot != NULL) {
-		memset(*slot, 0xd0, size);
+		memset(*slot, 0xd0, osize);
 		free(*slot);
 	}
+	if (item != NULL) {
+		if ((tmp = malloc(nsize)) == NULL)
+			return (PAM_BUF_ERR);
+		memcpy(tmp, item, nsize);
+	} else {
+		tmp = NULL;
+	}
 	*slot = tmp;
 	return (PAM_SUCCESS);
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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